mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-12-18 05:50:02 +00:00
turnip: clamp to zero negative upper left corner of viewport
We cannot send negative viewport coordinates to the hardware, so clamp them since negative min.x/y is valid per spec. The negative origin still counts in calculations of guardband. Fixes crash in 3DMark's "Sling Shot Extreme" test. Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9629>
This commit is contained in:
parent
efd1d5cc59
commit
243724031b
@ -1731,8 +1731,12 @@ tu6_emit_viewport(struct tu_cs *cs, const VkViewport *viewports, uint32_t num_vi
|
||||
/* allow viewport->width = 0.0f for un-initialized viewports: */
|
||||
if (min.x == max.x)
|
||||
max.x++;
|
||||
assert(min.x >= 0 && min.x < max.x);
|
||||
assert(min.y >= 0 && min.y < max.y);
|
||||
|
||||
min.x = MAX2(min.x, 0);
|
||||
min.y = MAX2(min.y, 0);
|
||||
|
||||
assert(min.x < max.x);
|
||||
assert(min.y < max.y);
|
||||
tu_cs_emit(cs, A6XX_GRAS_SC_VIEWPORT_SCISSOR_TL_X(min.x) |
|
||||
A6XX_GRAS_SC_VIEWPORT_SCISSOR_TL_Y(min.y));
|
||||
tu_cs_emit(cs, A6XX_GRAS_SC_VIEWPORT_SCISSOR_TL_X(max.x - 1) |
|
||||
|
Loading…
Reference in New Issue
Block a user