We are currently experiencing downtime impacting viewing & cloning the Mesa repo, and some GitLab pages returning 503. Please see #freedesktop on IRC for more updates.

Commit c1780856 authored by Caio Marcelo de Oliveira Filho's avatar Caio Marcelo de Oliveira Filho Committed by Samuel Iglesias Gonsálvez

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's avatarIago Toral Quiroga <itoral@igalia.com>
parent 487f8d48
......@@ -43,6 +43,7 @@ struct spirv_supported_capabilities {
bool multiview;
bool variable_pointers;
bool storage_16bit;
bool shader_viewport_index_layer;
};
typedef struct shader_info {
......
......@@ -3203,6 +3203,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
spv_check_supported(storage_16bit, cap);
break;
case SpvCapabilityShaderViewportIndexLayerEXT:
spv_check_supported(shader_viewport_index_layer, cap);
break;
default:
vtn_fail("Unhandled capability");
}
......
......@@ -1187,6 +1187,10 @@ vtn_get_builtin_location(struct vtn_builder *b,
*mode = nir_var_shader_in;
else if (b->shader->info.stage == MESA_SHADER_GEOMETRY)
*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
vtn_fail("invalid stage for SpvBuiltInLayer");
break;
......@@ -1194,6 +1198,10 @@ vtn_get_builtin_location(struct vtn_builder *b,
*location = VARYING_SLOT_VIEWPORT;
if (b->shader->info.stage == MESA_SHADER_GEOMETRY)
*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)
*mode = nir_var_shader_in;
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment