microsoft/compiler: Support gl_Layer

Maps pretty nicely to SV_RenderTargetArrayIndex, so nothing complicated
here.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17039>
This commit is contained in:
Boris Brezillon 2022-06-14 22:28:39 +02:00 committed by Marge Bot
parent 9c45ee3f86
commit e11035bf6d
5 changed files with 17 additions and 8 deletions

View File

@ -212,10 +212,6 @@ spec/!opengl 3.2/gl-3.2-adj-prims line cull-front pv-first: fail
spec/!opengl 3.2/gl-3.2-adj-prims line cull-front pv-last: fail
spec/!opengl 3.2/gl-3.2-adj-prims pv-first: fail
spec/!opengl 3.2/gl-3.2-adj-prims pv-last: fail
spec/!opengl 3.2/layered-rendering/gl-layer-cube-map: fail
spec/!opengl 3.2/layered-rendering/gl-layer-render: fail
spec/!opengl 3.2/layered-rendering/gl-layer-render-clipped: fail
spec/!opengl 3.2/layered-rendering/gl-layer-render-storage: fail
spec/!opengl 4.2/gl-max-vertex-attrib-stride: skip
spec/!opengl 4.3/get_glsl_version: skip
spec/!opengl 4.5/compare-framebuffer-parameter-with-get: skip
@ -3521,8 +3517,8 @@ wgl/wgl-sanity: skip
summary:
name: results
---- --------
pass: 17849
fail: 2039
pass: 17853
fail: 2035
crash: 12
skip: 1450
timeout: 0

View File

@ -876,7 +876,7 @@ d3d12_fill_shader_key(struct d3d12_selection_context *sel_ctx,
if (stage == PIPE_SHADER_FRAGMENT || stage == PIPE_SHADER_GEOMETRY)
system_out_values |= VARYING_BIT_POS;
if (stage == PIPE_SHADER_FRAGMENT)
system_out_values |= VARYING_BIT_PSIZ | VARYING_BIT_VIEWPORT;
system_out_values |= VARYING_BIT_PSIZ | VARYING_BIT_VIEWPORT | VARYING_BIT_LAYER;
uint64_t mask = prev->current->nir->info.outputs_written & ~system_out_values;
fill_varyings(&key->required_varying_inputs, prev->current->nir,
nir_var_shader_out, mask, false);

View File

@ -68,6 +68,9 @@ get_semantic_name(int location, int driver_location, unsigned *index)
case VARYING_SLOT_VIEWPORT:
return "SV_ViewportArrayIndex";
case VARYING_SLOT_LAYER:
return "SV_RenderTargetArrayIndex";
default: {
*index = driver_location;
return "TEXCOORD";

View File

@ -104,6 +104,8 @@ in_sysvalue_name(nir_variable *var)
return "POS";
case VARYING_SLOT_FACE:
return "FACE";
case VARYING_SLOT_LAYER:
return "RTINDEX";
default:
return "NONE";
}
@ -326,6 +328,12 @@ get_semantic_name(nir_variable *var, struct semantic_info *info,
info->kind = DXIL_SEM_VIEWPORT_ARRAY_INDEX;
break;
case VARYING_SLOT_LAYER:
assert(glsl_get_components(var->type) == 1);
snprintf(info->name, 64, "%s", "SV_RenderTargetArrayIndex");
info->kind = DXIL_SEM_RENDERTARGET_ARRAY_INDEX;
break;
default: {
info->index = var->data.driver_location;
strcpy(info->name, "TEXCOORD");

View File

@ -5440,7 +5440,8 @@ emit_module(struct ntd_context *ctx, const struct nir_to_dxil_options *opts)
}
} else if (ctx->shader->info.stage == MESA_SHADER_VERTEX ||
ctx->shader->info.stage == MESA_SHADER_TESS_EVAL) {
if (ctx->shader->info.outputs_written & VARYING_BIT_VIEWPORT)
if (ctx->shader->info.outputs_written &
(VARYING_BIT_VIEWPORT | VARYING_BIT_LAYER))
ctx->mod.feats.array_layer_from_vs_or_ds = true;
}
@ -5880,6 +5881,7 @@ nir_var_to_dxil_sysvalue_type(nir_variable *var, uint64_t other_stage_mask)
case VARYING_SLOT_TESS_LEVEL_INNER:
case VARYING_SLOT_TESS_LEVEL_OUTER:
case VARYING_SLOT_VIEWPORT:
case VARYING_SLOT_LAYER:
if (!((1ull << var->data.location) & other_stage_mask))
return DXIL_SYSVALUE;
FALLTHROUGH;