mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
microsoft/compiler: Expect front-facing var as an input
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
This commit is contained in:
parent
4180cf39f0
commit
d4a15a048b
6 changed files with 10 additions and 47 deletions
|
|
@ -737,7 +737,7 @@ validate_geometry_shader_variant(struct d3d12_selection_context *sel_ctx)
|
|||
if (sel_ctx->fill_mode_lowered != PIPE_POLYGON_MODE_FILL) {
|
||||
key.fill_mode = sel_ctx->fill_mode_lowered;
|
||||
key.cull_mode = sel_ctx->cull_mode_lowered;
|
||||
key.has_front_face = BITSET_TEST(fs->initial->info.system_values_read, SYSTEM_VALUE_FRONT_FACE);
|
||||
key.has_front_face = (fs->initial->info.inputs_read & VARYING_BIT_FACE) != 0;
|
||||
if (key.cull_mode != PIPE_FACE_NONE || key.has_front_face)
|
||||
key.front_ccw = ctx->gfx_pipeline_state.rast->base.front_ccw ^ (ctx->flip_y < 0);
|
||||
key.edge_flag_fix = needs_edge_flag_fix(ctx->initial_api_prim);
|
||||
|
|
|
|||
|
|
@ -231,9 +231,6 @@ d3d12_get_param_default(struct pipe_screen *pscreen, enum pipe_cap param)
|
|||
case PIPE_CAP_FS_COORD_ORIGIN_UPPER_LEFT:
|
||||
return 1;
|
||||
|
||||
case PIPE_CAP_FS_FACE_IS_INTEGER_SYSVAL:
|
||||
return 1;
|
||||
|
||||
case PIPE_CAP_ACCELERATED:
|
||||
return screen->vendor_id != HW_VENDOR_MICROSOFT;
|
||||
|
||||
|
|
|
|||
|
|
@ -1470,9 +1470,6 @@ lower_sysval_to_load_input_impl(nir_builder *b, nir_intrinsic_instr *intr,
|
|||
{
|
||||
gl_system_value sysval = SYSTEM_VALUE_MAX;
|
||||
switch (intr->intrinsic) {
|
||||
case nir_intrinsic_load_front_face:
|
||||
sysval = SYSTEM_VALUE_FRONT_FACE;
|
||||
break;
|
||||
case nir_intrinsic_load_instance_id:
|
||||
sysval = SYSTEM_VALUE_INSTANCE_ID;
|
||||
break;
|
||||
|
|
@ -1487,22 +1484,13 @@ lower_sysval_to_load_input_impl(nir_builder *b, nir_intrinsic_instr *intr,
|
|||
nir_variable *var = sysval_vars[sysval];
|
||||
assert(var);
|
||||
|
||||
const nir_alu_type dest_type = (sysval == SYSTEM_VALUE_FRONT_FACE)
|
||||
? nir_type_uint32 : nir_get_nir_type_for_glsl_type(var->type);
|
||||
const unsigned bit_size = (sysval == SYSTEM_VALUE_FRONT_FACE)
|
||||
? 32 : intr->def.bit_size;
|
||||
const nir_alu_type dest_type = nir_get_nir_type_for_glsl_type(var->type);
|
||||
const unsigned bit_size = intr->def.bit_size;
|
||||
|
||||
b->cursor = nir_before_instr(&intr->instr);
|
||||
nir_def *result = nir_load_input(b, intr->def.num_components, bit_size, nir_imm_int(b, 0),
|
||||
.base = var->data.driver_location, .dest_type = dest_type);
|
||||
|
||||
/* The nir_type_uint32 is really a nir_type_bool32, but that type is very
|
||||
* inconvenient at this point during compilation. Convert to
|
||||
* nir_type_bool1 by comparing with zero.
|
||||
*/
|
||||
if (sysval == SYSTEM_VALUE_FRONT_FACE)
|
||||
result = nir_ine_imm(b, result, 0);
|
||||
|
||||
nir_def_rewrite_uses(&intr->def, result);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2268,36 +2256,17 @@ dxil_nir_lower_unsupported_subgroup_scan(nir_shader *s)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static bool
|
||||
lower_load_face(nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
||||
{
|
||||
if (intr->intrinsic != nir_intrinsic_load_front_face)
|
||||
return false;
|
||||
|
||||
b->cursor = nir_before_instr(&intr->instr);
|
||||
|
||||
nir_variable *var = data;
|
||||
nir_def *load = nir_ine_imm(b, nir_load_var(b, var), 0);
|
||||
|
||||
nir_def_rewrite_uses(&intr->def, load);
|
||||
nir_instr_remove(&intr->instr);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
dxil_nir_forward_front_face(nir_shader *nir)
|
||||
{
|
||||
assert(nir->info.stage == MESA_SHADER_FRAGMENT);
|
||||
|
||||
nir_variable *var = nir_variable_create(nir, nir_var_shader_in,
|
||||
glsl_uint_type(),
|
||||
"gl_FrontFacing");
|
||||
var->data.location = VARYING_SLOT_VAR12;
|
||||
var->data.interpolation = INTERP_MODE_FLAT;
|
||||
|
||||
return nir_shader_intrinsics_pass(nir, lower_load_face,
|
||||
nir_metadata_block_index | nir_metadata_dominance,
|
||||
var);
|
||||
nir_variable *var = nir_find_variable_with_location(nir, nir_var_shader_in, VARYING_SLOT_FACE);
|
||||
if (var) {
|
||||
var->data.location = VARYING_SLOT_VAR12;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
|||
|
|
@ -201,9 +201,6 @@ get_semantic_sv_name(nir_variable *var, struct semantic_info *info, gl_shader_st
|
|||
case SYSTEM_VALUE_VERTEX_ID_ZERO_BASE:
|
||||
info->kind = DXIL_SEM_VERTEX_ID;
|
||||
break;
|
||||
case SYSTEM_VALUE_FRONT_FACE:
|
||||
info->kind = DXIL_SEM_IS_FRONT_FACE;
|
||||
break;
|
||||
case SYSTEM_VALUE_INSTANCE_ID:
|
||||
info->kind = DXIL_SEM_INSTANCE_ID;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -589,7 +589,6 @@ struct ntd_context {
|
|||
const struct dxil_value **scratchvars;
|
||||
const struct dxil_value **consts;
|
||||
|
||||
nir_variable *ps_front_face;
|
||||
nir_variable *system_value[SYSTEM_VALUE_MAX];
|
||||
|
||||
nir_function *tess_ctrl_patch_constant_func;
|
||||
|
|
|
|||
|
|
@ -885,6 +885,7 @@ dxil_spirv_nir_passes(nir_shader *nir,
|
|||
const struct nir_lower_sysvals_to_varyings_options sysvals_to_varyings = {
|
||||
.frag_coord = true,
|
||||
.point_coord = true,
|
||||
.front_face = true,
|
||||
};
|
||||
NIR_PASS_V(nir, nir_lower_sysvals_to_varyings, &sysvals_to_varyings);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue