mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 07:58:07 +02:00
svga: fix invalid component access of domain location
Tesscoord is declared as vec3 in the incoming shader but the z component of a tesscoord should only be referenced in the domain shader if the tessellator domain is of triangle type. Fixes vmx crash running GFXBench-Tessellation with MTL Renderer. Reviewed-by: Martin Krastev <krastevm@vmware.com> Reviewed-by: Min-Yu Huang <min-yuhuang@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18185>
This commit is contained in:
parent
6e311dd722
commit
f73862d339
1 changed files with 15 additions and 0 deletions
|
|
@ -413,6 +413,7 @@ struct svga_shader_emitter_v10
|
|||
boolean vertices_order_cw;
|
||||
boolean point_mode;
|
||||
unsigned tesscoord_sys_index;
|
||||
unsigned swizzle_max;
|
||||
unsigned prim_id_index; /* primitive id */
|
||||
struct {
|
||||
unsigned in_index; /* real tessinner input register */
|
||||
|
|
@ -1780,6 +1781,14 @@ emit_src_register(struct svga_shader_emitter_v10 *emit,
|
|||
operand0.numComponents = VGPU10_OPERAND_4_COMPONENT;
|
||||
operand0.operandType = VGPU10_OPERAND_TYPE_INPUT_DOMAIN_POINT;
|
||||
index = 0;
|
||||
|
||||
/* Make sure swizzles are of those components allowed according
|
||||
* to the tessellator domain.
|
||||
*/
|
||||
swizzleX = MIN2(swizzleX, emit->tes.swizzle_max);
|
||||
swizzleY = MIN2(swizzleY, emit->tes.swizzle_max);
|
||||
swizzleZ = MIN2(swizzleZ, emit->tes.swizzle_max);
|
||||
swizzleW = MIN2(swizzleW, emit->tes.swizzle_max);
|
||||
}
|
||||
else if (index == emit->tes.inner.tgsi_index) {
|
||||
file = TGSI_FILE_TEMPORARY;
|
||||
|
|
@ -3145,6 +3154,12 @@ emit_domain_shader_declarations(struct svga_shader_emitter_v10 *emit)
|
|||
end_emit_instruction(emit);
|
||||
|
||||
emit_tessellator_domain(emit, emit->tes.prim_mode);
|
||||
|
||||
/* Specify a max for swizzles of the domain point according to the
|
||||
* tessellator domain type.
|
||||
*/
|
||||
emit->tes.swizzle_max = emit->tes.prim_mode == PIPE_PRIM_TRIANGLES ?
|
||||
TGSI_SWIZZLE_Z : TGSI_SWIZZLE_Y;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue