spirv: Add SpvCapabilityShaderViewportIndexLayerEXT
This capability allows gl_ViewportIndex and gl_Layer to also be used as outputs in Vertex and Tesselation shaders. v2: Make conditional to the capability, add gl_Layer, add tesselation shaders. (Iago) v3: Don't export to tesselation control shader. v4: Add Reviewd-by tag. Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
This commit is contained in:

committed by
Samuel Iglesias Gonsálvez

parent
487f8d48c9
commit
c17808562e
@@ -43,6 +43,7 @@ struct spirv_supported_capabilities {
|
|||||||
bool multiview;
|
bool multiview;
|
||||||
bool variable_pointers;
|
bool variable_pointers;
|
||||||
bool storage_16bit;
|
bool storage_16bit;
|
||||||
|
bool shader_viewport_index_layer;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct shader_info {
|
typedef struct shader_info {
|
||||||
|
@@ -3203,6 +3203,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
|
|||||||
spv_check_supported(storage_16bit, cap);
|
spv_check_supported(storage_16bit, cap);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SpvCapabilityShaderViewportIndexLayerEXT:
|
||||||
|
spv_check_supported(shader_viewport_index_layer, cap);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
vtn_fail("Unhandled capability");
|
vtn_fail("Unhandled capability");
|
||||||
}
|
}
|
||||||
|
@@ -1187,6 +1187,10 @@ vtn_get_builtin_location(struct vtn_builder *b,
|
|||||||
*mode = nir_var_shader_in;
|
*mode = nir_var_shader_in;
|
||||||
else if (b->shader->info.stage == MESA_SHADER_GEOMETRY)
|
else if (b->shader->info.stage == MESA_SHADER_GEOMETRY)
|
||||||
*mode = nir_var_shader_out;
|
*mode = nir_var_shader_out;
|
||||||
|
else if (b->options && b->options->caps.shader_viewport_index_layer &&
|
||||||
|
(b->shader->info.stage == MESA_SHADER_VERTEX ||
|
||||||
|
b->shader->info.stage == MESA_SHADER_TESS_EVAL))
|
||||||
|
*mode = nir_var_shader_out;
|
||||||
else
|
else
|
||||||
vtn_fail("invalid stage for SpvBuiltInLayer");
|
vtn_fail("invalid stage for SpvBuiltInLayer");
|
||||||
break;
|
break;
|
||||||
@@ -1194,6 +1198,10 @@ vtn_get_builtin_location(struct vtn_builder *b,
|
|||||||
*location = VARYING_SLOT_VIEWPORT;
|
*location = VARYING_SLOT_VIEWPORT;
|
||||||
if (b->shader->info.stage == MESA_SHADER_GEOMETRY)
|
if (b->shader->info.stage == MESA_SHADER_GEOMETRY)
|
||||||
*mode = nir_var_shader_out;
|
*mode = nir_var_shader_out;
|
||||||
|
else if (b->options && b->options->caps.shader_viewport_index_layer &&
|
||||||
|
(b->shader->info.stage == MESA_SHADER_VERTEX ||
|
||||||
|
b->shader->info.stage == MESA_SHADER_TESS_EVAL))
|
||||||
|
*mode = nir_var_shader_out;
|
||||||
else if (b->shader->info.stage == MESA_SHADER_FRAGMENT)
|
else if (b->shader->info.stage == MESA_SHADER_FRAGMENT)
|
||||||
*mode = nir_var_shader_in;
|
*mode = nir_var_shader_in;
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user