compiler: Use util/bitset.h for system_values_read
It is currently a bitset on top of a uint64_t but there are already more than 64 values. Change to use BITSET to cover all the SYSTEM_VALUE_MAX bits. Cc: mesa-stable Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Karol Herbst <kherbst@redhat.com> Acked-by: Jesse Natalie <jenatali@microsoft.com> Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Acked-by: Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8585>
This commit is contained in:

committed by
Marge Bot

parent
ecd0ae09f9
commit
9f3d5e99ea
@@ -1620,14 +1620,16 @@ ntq_setup_vs_inputs(struct v3d_compile *c)
|
||||
|
||||
unsigned num_components = 0;
|
||||
uint32_t vpm_components_queued = 0;
|
||||
bool uses_iid = c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_INSTANCE_ID |
|
||||
1ull << SYSTEM_VALUE_INSTANCE_INDEX);
|
||||
bool uses_biid = c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_BASE_INSTANCE);
|
||||
bool uses_vid = c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_VERTEX_ID |
|
||||
1ull << SYSTEM_VALUE_VERTEX_ID_ZERO_BASE);
|
||||
bool uses_iid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_INSTANCE_ID) ||
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_INSTANCE_INDEX);
|
||||
bool uses_biid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_BASE_INSTANCE);
|
||||
bool uses_vid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_VERTEX_ID) ||
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_VERTEX_ID_ZERO_BASE);
|
||||
|
||||
num_components += uses_iid;
|
||||
num_components += uses_biid;
|
||||
@@ -2079,16 +2081,16 @@ ntq_emit_load_input(struct v3d_compile *c, nir_intrinsic_instr *instr)
|
||||
* be slower if the VPM unit is busy with another QPU.
|
||||
*/
|
||||
int index = 0;
|
||||
if (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_INSTANCE_ID)) {
|
||||
if (BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_INSTANCE_ID)) {
|
||||
index++;
|
||||
}
|
||||
if (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_BASE_INSTANCE)) {
|
||||
if (BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_BASE_INSTANCE)) {
|
||||
index++;
|
||||
}
|
||||
if (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_VERTEX_ID)) {
|
||||
if (BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_VERTEX_ID)) {
|
||||
index++;
|
||||
}
|
||||
for (int i = 0; i < offset; i++)
|
||||
@@ -3130,16 +3132,18 @@ nir_to_vir(struct v3d_compile *c)
|
||||
c->uses_implicit_point_line_varyings = true;
|
||||
} else if (c->fs_key->is_lines &&
|
||||
(c->devinfo->ver < 40 ||
|
||||
(c->s->info.system_values_read &
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_LINE_COORD)))) {
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_LINE_COORD))) {
|
||||
c->line_x = emit_fragment_varying(c, NULL, -1, 0, 0);
|
||||
c->uses_implicit_point_line_varyings = true;
|
||||
}
|
||||
|
||||
c->force_per_sample_msaa =
|
||||
c->s->info.fs.uses_sample_qualifier ||
|
||||
(c->s->info.system_values_read & (SYSTEM_BIT_SAMPLE_ID |
|
||||
SYSTEM_BIT_SAMPLE_POS));
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_SAMPLE_ID) ||
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_SAMPLE_POS);
|
||||
break;
|
||||
case MESA_SHADER_COMPUTE:
|
||||
/* Set up the TSO for barriers, assuming we do some. */
|
||||
|
@@ -640,16 +640,18 @@ v3d_vs_set_prog_data(struct v3d_compile *c,
|
||||
prog_data->vpm_input_size += c->vattr_sizes[i];
|
||||
}
|
||||
|
||||
prog_data->uses_vid = (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_VERTEX_ID |
|
||||
1ull << SYSTEM_VALUE_VERTEX_ID_ZERO_BASE));
|
||||
prog_data->uses_vid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_VERTEX_ID) ||
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_VERTEX_ID_ZERO_BASE);
|
||||
|
||||
prog_data->uses_biid = (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_BASE_INSTANCE));
|
||||
prog_data->uses_biid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_BASE_INSTANCE);
|
||||
|
||||
prog_data->uses_iid = (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_INSTANCE_ID |
|
||||
1ull << SYSTEM_VALUE_INSTANCE_INDEX));
|
||||
prog_data->uses_iid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_INSTANCE_ID) ||
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_INSTANCE_INDEX);
|
||||
|
||||
if (prog_data->uses_vid)
|
||||
prog_data->vpm_input_size++;
|
||||
@@ -703,8 +705,8 @@ v3d_gs_set_prog_data(struct v3d_compile *c,
|
||||
* it after reading it if necessary, so it doesn't add to the VPM
|
||||
* size requirements.
|
||||
*/
|
||||
prog_data->uses_pid = (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_PRIMITIVE_ID));
|
||||
prog_data->uses_pid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_PRIMITIVE_ID);
|
||||
|
||||
/* Output segment size is in sectors (8 rows of 32 bits per channel) */
|
||||
prog_data->vpm_output_size = align(c->vpm_output_size, 8) / 8;
|
||||
|
@@ -124,7 +124,7 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
|
||||
prog->info.fs.uses_sample_qualifier |= var->data.sample;
|
||||
}
|
||||
} else if (var->data.mode == ir_var_system_value) {
|
||||
prog->info.system_values_read |= bitfield;
|
||||
BITSET_SET(prog->info.system_values_read, idx);
|
||||
} else {
|
||||
assert(var->data.mode == ir_var_shader_out);
|
||||
if (is_patch_generic) {
|
||||
@@ -432,7 +432,7 @@ do_set_program_inouts(exec_list *instructions, struct gl_program *prog,
|
||||
prog->info.outputs_read = 0;
|
||||
prog->info.patch_inputs_read = 0;
|
||||
prog->info.patch_outputs_written = 0;
|
||||
prog->info.system_values_read = 0;
|
||||
BITSET_ZERO(prog->info.system_values_read);
|
||||
if (shader_stage == MESA_SHADER_FRAGMENT) {
|
||||
prog->info.fs.uses_sample_qualifier = false;
|
||||
prog->info.fs.uses_discard = false;
|
||||
|
@@ -495,40 +495,40 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
|
||||
case nir_intrinsic_load_barycentric_model:
|
||||
case nir_intrinsic_load_gs_header_ir3:
|
||||
case nir_intrinsic_load_tcs_header_ir3:
|
||||
shader->info.system_values_read |=
|
||||
(1ull << nir_system_value_from_intrinsic(instr->intrinsic));
|
||||
BITSET_SET(shader->info.system_values_read,
|
||||
nir_system_value_from_intrinsic(instr->intrinsic));
|
||||
break;
|
||||
|
||||
case nir_intrinsic_load_barycentric_pixel:
|
||||
if (nir_intrinsic_interp_mode(instr) == INTERP_MODE_SMOOTH ||
|
||||
nir_intrinsic_interp_mode(instr) == INTERP_MODE_NONE) {
|
||||
shader->info.system_values_read |=
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL);
|
||||
BITSET_SET(shader->info.system_values_read,
|
||||
SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL);
|
||||
} else if (nir_intrinsic_interp_mode(instr) == INTERP_MODE_NOPERSPECTIVE) {
|
||||
shader->info.system_values_read |=
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_LINEAR_PIXEL);
|
||||
BITSET_SET(shader->info.system_values_read,
|
||||
SYSTEM_VALUE_BARYCENTRIC_LINEAR_PIXEL);
|
||||
}
|
||||
break;
|
||||
|
||||
case nir_intrinsic_load_barycentric_centroid:
|
||||
if (nir_intrinsic_interp_mode(instr) == INTERP_MODE_SMOOTH ||
|
||||
nir_intrinsic_interp_mode(instr) == INTERP_MODE_NONE) {
|
||||
shader->info.system_values_read |=
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID);
|
||||
BITSET_SET(shader->info.system_values_read,
|
||||
SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID);
|
||||
} else if (nir_intrinsic_interp_mode(instr) == INTERP_MODE_NOPERSPECTIVE) {
|
||||
shader->info.system_values_read |=
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_LINEAR_CENTROID);
|
||||
BITSET_SET(shader->info.system_values_read,
|
||||
SYSTEM_VALUE_BARYCENTRIC_LINEAR_CENTROID);
|
||||
}
|
||||
break;
|
||||
|
||||
case nir_intrinsic_load_barycentric_sample:
|
||||
if (nir_intrinsic_interp_mode(instr) == INTERP_MODE_SMOOTH ||
|
||||
nir_intrinsic_interp_mode(instr) == INTERP_MODE_NONE) {
|
||||
shader->info.system_values_read |=
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE);
|
||||
BITSET_SET(shader->info.system_values_read,
|
||||
SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE);
|
||||
} else if (nir_intrinsic_interp_mode(instr) == INTERP_MODE_NOPERSPECTIVE) {
|
||||
shader->info.system_values_read |=
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_LINEAR_SAMPLE);
|
||||
BITSET_SET(shader->info.system_values_read,
|
||||
SYSTEM_VALUE_BARYCENTRIC_LINEAR_SAMPLE);
|
||||
}
|
||||
if (shader->info.stage == MESA_SHADER_FRAGMENT)
|
||||
shader->info.fs.uses_sample_qualifier = true;
|
||||
@@ -831,7 +831,7 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
|
||||
shader->info.patch_outputs_read = 0;
|
||||
shader->info.patch_inputs_read = 0;
|
||||
shader->info.patch_outputs_written = 0;
|
||||
shader->info.system_values_read = 0;
|
||||
BITSET_ZERO(shader->info.system_values_read);
|
||||
shader->info.inputs_read_indirectly = 0;
|
||||
shader->info.outputs_accessed_indirectly = 0;
|
||||
shader->info.patch_inputs_read_indirectly = 0;
|
||||
@@ -864,8 +864,8 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
|
||||
|
||||
if (shader->info.stage == MESA_SHADER_FRAGMENT &&
|
||||
(shader->info.fs.uses_sample_qualifier ||
|
||||
(shader->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_SAMPLE_ID)) ||
|
||||
shader->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_SAMPLE_POS))) {
|
||||
(BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID) ||
|
||||
BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS)))) {
|
||||
/* This shouldn't be cleared because if optimizations remove all
|
||||
* sample-qualified inputs and that pass is run again, the sample
|
||||
* shading must stay enabled.
|
||||
|
@@ -382,15 +382,6 @@ const char *gl_varying_slot_name_for_stage(gl_varying_slot slot,
|
||||
#define VARYING_BIT_VAR(V) BITFIELD64_BIT(VARYING_SLOT_VAR0 + (V))
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Bitflags for system values.
|
||||
*/
|
||||
#define SYSTEM_BIT_SAMPLE_ID ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_ID)
|
||||
#define SYSTEM_BIT_SAMPLE_POS ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_POS)
|
||||
#define SYSTEM_BIT_SAMPLE_MASK_IN ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_MASK_IN)
|
||||
#define SYSTEM_BIT_LOCAL_INVOCATION_ID ((uint64_t)1 << SYSTEM_VALUE_LOCAL_INVOCATION_ID)
|
||||
#define SYSTEM_BIT_FRONT_FACE ((uint64_t)1 << SYSTEM_VALUE_FRONT_FACE)
|
||||
|
||||
/**
|
||||
* If the gl_register_file is PROGRAM_SYSTEM_VALUE, the register index will be
|
||||
* one of these values. If a NIR variable's mode is nir_var_system_value, it
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#ifndef SHADER_INFO_H
|
||||
#define SHADER_INFO_H
|
||||
|
||||
#include "util/bitset.h"
|
||||
#include "shader_enums.h"
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -144,7 +145,7 @@ typedef struct shader_info {
|
||||
/* Which outputs are actually read */
|
||||
uint64_t outputs_read;
|
||||
/* Which system values are actually read */
|
||||
uint64_t system_values_read;
|
||||
BITSET_DECLARE(system_values_read, SYSTEM_VALUE_MAX);
|
||||
|
||||
/* Which patch inputs are actually read */
|
||||
uint32_t patch_inputs_read;
|
||||
|
@@ -2789,7 +2789,7 @@ nir_to_tgsi(struct nir_shader *s,
|
||||
* gl-2.1-polygon-stipple-fs on softpipe.
|
||||
*/
|
||||
if ((s->info.inputs_read & VARYING_BIT_POS) ||
|
||||
(s->info.system_values_read & (1ull << SYSTEM_VALUE_FRAG_COORD))) {
|
||||
BITSET_TEST(s->info.system_values_read, SYSTEM_VALUE_FRAG_COORD)) {
|
||||
ureg_property(c->ureg, TGSI_PROPERTY_FS_COORD_ORIGIN,
|
||||
s->info.fs.origin_upper_left ?
|
||||
TGSI_FS_COORD_ORIGIN_UPPER_LEFT :
|
||||
|
@@ -653,8 +653,8 @@ ttn_src_for_file_and_index(struct ttn_compile *c, unsigned file, unsigned index,
|
||||
load = nir_swizzle(b, load, SWIZ(X, Y, Z, Z), 4);
|
||||
|
||||
src = nir_src_for_ssa(load);
|
||||
b->shader->info.system_values_read |=
|
||||
(1ull << nir_system_value_from_intrinsic(op));
|
||||
BITSET_SET(b->shader->info.system_values_read,
|
||||
nir_system_value_from_intrinsic(op));
|
||||
|
||||
break;
|
||||
}
|
||||
|
@@ -521,7 +521,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 = (fs->initial->info.system_values_read & SYSTEM_BIT_FRONT_FACE) ? 1 : 0;
|
||||
key.has_front_face = BITSET_TEST(fs->initial->info.system_values_read, SYSTEM_VALUE_FRONT_FACE);
|
||||
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);
|
||||
|
@@ -92,7 +92,7 @@ iris_update_draw_info(struct iris_context *ice,
|
||||
const struct shader_info *tcs_info =
|
||||
iris_get_shader_info(ice, MESA_SHADER_TESS_CTRL);
|
||||
if (tcs_info &&
|
||||
tcs_info->system_values_read & (1ull << SYSTEM_VALUE_VERTICES_IN)) {
|
||||
BITSET_TEST(tcs_info->system_values_read, SYSTEM_VALUE_VERTICES_IN)) {
|
||||
ice->state.stage_dirty |= IRIS_STAGE_DIRTY_CONSTANTS_TCS;
|
||||
ice->state.shaders[MESA_SHADER_TESS_CTRL].sysvals_need_upload = true;
|
||||
}
|
||||
|
@@ -1529,7 +1529,7 @@ iris_update_compiled_tes(struct iris_context *ice)
|
||||
|
||||
/* TODO: Could compare and avoid flagging this. */
|
||||
const struct shader_info *tes_info = &ish->nir->info;
|
||||
if (tes_info->system_values_read & (1ull << SYSTEM_VALUE_VERTICES_IN)) {
|
||||
if (BITSET_TEST(tes_info->system_values_read, SYSTEM_VALUE_VERTICES_IN)) {
|
||||
ice->state.stage_dirty |= IRIS_STAGE_DIRTY_CONSTANTS_TES;
|
||||
ice->state.shaders[MESA_SHADER_TESS_EVAL].sysvals_need_upload = true;
|
||||
}
|
||||
|
@@ -983,10 +983,8 @@ bool Converter::assignSlots() {
|
||||
info_out->numOutputs = 0;
|
||||
info_out->numSysVals = 0;
|
||||
|
||||
for (uint8_t i = 0; i < SYSTEM_VALUE_MAX; ++i) {
|
||||
if (!(nir->info.system_values_read & 1ull << i))
|
||||
continue;
|
||||
|
||||
uint8_t i;
|
||||
BITSET_FOREACH_SET(i, nir->info.system_values_read, SYSTEM_VALUE_MAX) {
|
||||
info_out->sv[info_out->numSysVals].sn = tgsi_get_sysval_semantic(i);
|
||||
info_out->sv[info_out->numSysVals].si = 0;
|
||||
info_out->sv[info_out->numSysVals].input = 0; // TODO inferSysValDirection(sn);
|
||||
@@ -1299,14 +1297,14 @@ Converter::parseNIR()
|
||||
case Program::TYPE_FRAGMENT:
|
||||
info_out->prop.fp.earlyFragTests = nir->info.fs.early_fragment_tests;
|
||||
prog->persampleInvocation =
|
||||
(nir->info.system_values_read & SYSTEM_BIT_SAMPLE_ID) ||
|
||||
(nir->info.system_values_read & SYSTEM_BIT_SAMPLE_POS);
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS);
|
||||
info_out->prop.fp.postDepthCoverage = nir->info.fs.post_depth_coverage;
|
||||
info_out->prop.fp.readsSampleLocations =
|
||||
(nir->info.system_values_read & SYSTEM_BIT_SAMPLE_POS);
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS);
|
||||
info_out->prop.fp.usesDiscard = nir->info.fs.uses_discard || nir->info.fs.uses_demote;
|
||||
info_out->prop.fp.usesSampleMaskIn =
|
||||
!!(nir->info.system_values_read & SYSTEM_BIT_SAMPLE_MASK_IN);
|
||||
!BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SAMPLE_MASK_IN);
|
||||
break;
|
||||
case Program::TYPE_GEOMETRY:
|
||||
info_out->prop.gp.instanceCount = nir->info.gs.invocations;
|
||||
@@ -1327,9 +1325,9 @@ Converter::parseNIR()
|
||||
break;
|
||||
case Program::TYPE_VERTEX:
|
||||
info_out->prop.vp.usesDrawParameters =
|
||||
(nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BASE_VERTEX)) ||
|
||||
(nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BASE_INSTANCE)) ||
|
||||
(nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_DRAW_ID));
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BASE_VERTEX) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BASE_INSTANCE) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_DRAW_ID);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@@ -302,8 +302,8 @@ panfrost_shader_compile(struct panfrost_context *ctx,
|
||||
state->sysval_count = program->sysval_count;
|
||||
memcpy(state->sysval, program->sysvals, sizeof(state->sysval[0]) * state->sysval_count);
|
||||
|
||||
bool vertex_id = s->info.system_values_read & (1 << SYSTEM_VALUE_VERTEX_ID);
|
||||
bool instance_id = s->info.system_values_read & (1 << SYSTEM_VALUE_INSTANCE_ID);
|
||||
bool vertex_id = BITSET_TEST(s->info.system_values_read, SYSTEM_VALUE_VERTEX_ID);
|
||||
bool instance_id = BITSET_TEST(s->info.system_values_read, SYSTEM_VALUE_INSTANCE_ID);
|
||||
|
||||
state->writes_global = s->info.writes_memory;
|
||||
|
||||
@@ -361,10 +361,10 @@ panfrost_shader_compile(struct panfrost_context *ctx,
|
||||
state->stack_size = program->tls_size;
|
||||
|
||||
state->reads_frag_coord = (s->info.inputs_read & (1 << VARYING_SLOT_POS)) ||
|
||||
(s->info.system_values_read & (1 << SYSTEM_VALUE_FRAG_COORD));
|
||||
BITSET_TEST(s->info.system_values_read, SYSTEM_VALUE_FRAG_COORD);
|
||||
state->reads_point_coord = s->info.inputs_read & (1 << VARYING_SLOT_PNTC);
|
||||
state->reads_face = (s->info.inputs_read & (1 << VARYING_SLOT_FACE)) ||
|
||||
(s->info.system_values_read & (1 << SYSTEM_VALUE_FRONT_FACE));
|
||||
BITSET_TEST(s->info.system_values_read, SYSTEM_VALUE_FRONT_FACE);
|
||||
state->writes_point_size = s->info.outputs_written & (1 << VARYING_SLOT_PSIZ);
|
||||
|
||||
if (outputs_written)
|
||||
|
@@ -374,28 +374,28 @@ void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *inf
|
||||
info->tessfactors_are_def_in_all_invocs = ac_are_tessfactors_def_in_all_invocs(nir);
|
||||
}
|
||||
|
||||
info->uses_frontface = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_FRONT_FACE);
|
||||
info->uses_instanceid = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_INSTANCE_ID);
|
||||
info->uses_base_vertex = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BASE_VERTEX);
|
||||
info->uses_base_instance = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BASE_INSTANCE);
|
||||
info->uses_invocationid = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_INVOCATION_ID);
|
||||
info->uses_grid_size = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_NUM_WORK_GROUPS);
|
||||
info->uses_subgroup_info = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_LOCAL_INVOCATION_INDEX) ||
|
||||
nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_SUBGROUP_ID) ||
|
||||
nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_NUM_SUBGROUPS);
|
||||
info->uses_variable_block_size = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_LOCAL_GROUP_SIZE);
|
||||
info->uses_drawid = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_DRAW_ID);
|
||||
info->uses_primid = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_PRIMITIVE_ID) ||
|
||||
info->uses_frontface = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_FRONT_FACE);
|
||||
info->uses_instanceid = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_INSTANCE_ID);
|
||||
info->uses_base_vertex = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BASE_VERTEX);
|
||||
info->uses_base_instance = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BASE_INSTANCE);
|
||||
info->uses_invocationid = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_INVOCATION_ID);
|
||||
info->uses_grid_size = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_NUM_WORK_GROUPS);
|
||||
info->uses_subgroup_info = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_LOCAL_INVOCATION_INDEX) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SUBGROUP_ID) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_NUM_SUBGROUPS);
|
||||
info->uses_variable_block_size = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_LOCAL_GROUP_SIZE);
|
||||
info->uses_drawid = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_DRAW_ID);
|
||||
info->uses_primid = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_PRIMITIVE_ID) ||
|
||||
nir->info.inputs_read & VARYING_BIT_PRIMITIVE_ID;
|
||||
info->reads_samplemask = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_SAMPLE_MASK_IN);
|
||||
info->reads_tess_factors = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_TESS_LEVEL_INNER) ||
|
||||
nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_TESS_LEVEL_OUTER);
|
||||
info->uses_linear_sample = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_LINEAR_SAMPLE);
|
||||
info->uses_linear_centroid = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_LINEAR_CENTROID);
|
||||
info->uses_linear_center = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_LINEAR_PIXEL);
|
||||
info->uses_persp_sample = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE);
|
||||
info->uses_persp_centroid = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID);
|
||||
info->uses_persp_center = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL);
|
||||
info->reads_samplemask = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SAMPLE_MASK_IN);
|
||||
info->reads_tess_factors = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_TESS_LEVEL_INNER) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_TESS_LEVEL_OUTER);
|
||||
info->uses_linear_sample = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BARYCENTRIC_LINEAR_SAMPLE);
|
||||
info->uses_linear_centroid = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BARYCENTRIC_LINEAR_CENTROID);
|
||||
info->uses_linear_center = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BARYCENTRIC_LINEAR_PIXEL);
|
||||
info->uses_persp_sample = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE);
|
||||
info->uses_persp_centroid = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID);
|
||||
info->uses_persp_center = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL);
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
|
||||
info->writes_z = nir->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_DEPTH);
|
||||
@@ -434,13 +434,12 @@ void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *inf
|
||||
info->uses_interp_at_sample || nir->info.writes_memory ||
|
||||
nir->info.fs.uses_fbfetch_output ||
|
||||
nir->info.fs.needs_quad_helper_invocations ||
|
||||
(nir->info.system_values_read &
|
||||
(BITFIELD64_BIT(SYSTEM_VALUE_FRAG_COORD) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_POINT_COORD) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_SAMPLE_ID) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_SAMPLE_POS) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_SAMPLE_MASK_IN) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_HELPER_INVOCATION))));
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_FRAG_COORD) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_POINT_COORD) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SAMPLE_MASK_IN) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_HELPER_INVOCATION));
|
||||
}
|
||||
|
||||
/* Add color inputs to the list of inputs. */
|
||||
|
@@ -792,8 +792,8 @@ lvp_graphics_pipeline_init(struct lvp_pipeline *pipeline,
|
||||
|
||||
if (pipeline->pipeline_nir[MESA_SHADER_FRAGMENT]) {
|
||||
if (pipeline->pipeline_nir[MESA_SHADER_FRAGMENT]->info.fs.uses_sample_qualifier ||
|
||||
pipeline->pipeline_nir[MESA_SHADER_FRAGMENT]->info.system_values_read & (SYSTEM_BIT_SAMPLE_ID |
|
||||
SYSTEM_BIT_SAMPLE_POS))
|
||||
BITSET_TEST(pipeline->pipeline_nir[MESA_SHADER_FRAGMENT]->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID) ||
|
||||
BITSET_TEST(pipeline->pipeline_nir[MESA_SHADER_FRAGMENT]->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS))
|
||||
pipeline->force_min_sample = true;
|
||||
}
|
||||
if (pipeline->pipeline_nir[MESA_SHADER_TESS_CTRL]) {
|
||||
|
@@ -8584,7 +8584,7 @@ fs_visitor::run_fs(bool allow_spilling, bool do_rep_send)
|
||||
emit_shader_time_begin();
|
||||
|
||||
if (nir->info.inputs_read > 0 ||
|
||||
(nir->info.system_values_read & (1ull << SYSTEM_VALUE_FRAG_COORD)) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_FRAG_COORD) ||
|
||||
(nir->info.outputs_read > 0 && !wm_key->coherent_fb_fetch)) {
|
||||
if (devinfo->gen < 6)
|
||||
emit_interpolation_setup_gen4();
|
||||
@@ -8965,7 +8965,7 @@ brw_nir_populate_wm_prog_data(const nir_shader *shader,
|
||||
struct brw_wm_prog_data *prog_data)
|
||||
{
|
||||
prog_data->uses_src_depth = prog_data->uses_src_w =
|
||||
shader->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_FRAG_COORD);
|
||||
BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_FRAG_COORD);
|
||||
|
||||
/* key->alpha_test_func means simulating alpha testing via discards,
|
||||
* so the shader definitely kills pixels.
|
||||
@@ -8981,14 +8981,14 @@ brw_nir_populate_wm_prog_data(const nir_shader *shader,
|
||||
prog_data->persample_dispatch =
|
||||
key->multisample_fbo &&
|
||||
(key->persample_interp ||
|
||||
(shader->info.system_values_read & (SYSTEM_BIT_SAMPLE_ID |
|
||||
SYSTEM_BIT_SAMPLE_POS)) ||
|
||||
BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID) ||
|
||||
BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS) ||
|
||||
shader->info.fs.uses_sample_qualifier ||
|
||||
shader->info.outputs_read);
|
||||
|
||||
if (devinfo->gen >= 6) {
|
||||
prog_data->uses_sample_mask =
|
||||
shader->info.system_values_read & SYSTEM_BIT_SAMPLE_MASK_IN;
|
||||
BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_SAMPLE_MASK_IN);
|
||||
|
||||
/* From the Ivy Bridge PRM documentation for 3DSTATE_PS:
|
||||
*
|
||||
@@ -9000,7 +9000,7 @@ brw_nir_populate_wm_prog_data(const nir_shader *shader,
|
||||
* persample dispatch, we hard-code it to 0.5.
|
||||
*/
|
||||
prog_data->uses_pos_offset = prog_data->persample_dispatch &&
|
||||
(shader->info.system_values_read & SYSTEM_BIT_SAMPLE_POS);
|
||||
BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS);
|
||||
}
|
||||
|
||||
prog_data->has_render_target_reads = shader->info.outputs_read != 0ull;
|
||||
|
@@ -186,11 +186,10 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
|
||||
* included here as it lives in its own vec4.
|
||||
*/
|
||||
const bool has_sgvs =
|
||||
nir->info.system_values_read &
|
||||
(BITFIELD64_BIT(SYSTEM_VALUE_FIRST_VERTEX) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_BASE_INSTANCE) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_INSTANCE_ID));
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_FIRST_VERTEX) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BASE_INSTANCE) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_INSTANCE_ID);
|
||||
|
||||
const unsigned num_inputs = util_bitcount64(nir->info.inputs_read);
|
||||
|
||||
|
@@ -2876,43 +2876,35 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,
|
||||
/* gl_VertexID and gl_InstanceID are system values, but arrive via an
|
||||
* incoming vertex attribute. So, add an extra slot.
|
||||
*/
|
||||
if (nir->info.system_values_read &
|
||||
(BITFIELD64_BIT(SYSTEM_VALUE_FIRST_VERTEX) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_BASE_INSTANCE) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_INSTANCE_ID))) {
|
||||
if (BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_FIRST_VERTEX) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BASE_INSTANCE) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_INSTANCE_ID)) {
|
||||
nr_attribute_slots++;
|
||||
}
|
||||
|
||||
/* gl_DrawID and IsIndexedDraw share its very own vec4 */
|
||||
if (nir->info.system_values_read &
|
||||
(BITFIELD64_BIT(SYSTEM_VALUE_DRAW_ID) |
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_IS_INDEXED_DRAW))) {
|
||||
if (BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_DRAW_ID) ||
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_IS_INDEXED_DRAW)) {
|
||||
nr_attribute_slots++;
|
||||
}
|
||||
|
||||
if (nir->info.system_values_read &
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_IS_INDEXED_DRAW))
|
||||
if (BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_IS_INDEXED_DRAW))
|
||||
prog_data->uses_is_indexed_draw = true;
|
||||
|
||||
if (nir->info.system_values_read &
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_FIRST_VERTEX))
|
||||
if (BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_FIRST_VERTEX))
|
||||
prog_data->uses_firstvertex = true;
|
||||
|
||||
if (nir->info.system_values_read &
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_BASE_INSTANCE))
|
||||
if (BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_BASE_INSTANCE))
|
||||
prog_data->uses_baseinstance = true;
|
||||
|
||||
if (nir->info.system_values_read &
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE))
|
||||
if (BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_VERTEX_ID_ZERO_BASE))
|
||||
prog_data->uses_vertexid = true;
|
||||
|
||||
if (nir->info.system_values_read &
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_INSTANCE_ID))
|
||||
if (BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_INSTANCE_ID))
|
||||
prog_data->uses_instanceid = true;
|
||||
|
||||
if (nir->info.system_values_read &
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_DRAW_ID))
|
||||
if (BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_DRAW_ID))
|
||||
prog_data->uses_drawid = true;
|
||||
|
||||
/* The 3DSTATE_VS documentation lists the lower bound on "Vertex URB Entry
|
||||
|
@@ -625,7 +625,7 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,
|
||||
nir->info.clip_distance_array_size;
|
||||
|
||||
prog_data->include_primitive_id =
|
||||
(nir->info.system_values_read & (1 << SYSTEM_VALUE_PRIMITIVE_ID)) != 0;
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_PRIMITIVE_ID);
|
||||
|
||||
prog_data->invocations = nir->info.gs.invocations;
|
||||
|
||||
|
@@ -392,7 +392,7 @@ brw_compile_tcs(const struct brw_compiler *compiler,
|
||||
brw_postprocess_nir(nir, compiler, is_scalar);
|
||||
|
||||
bool has_primitive_id =
|
||||
nir->info.system_values_read & (1 << SYSTEM_VALUE_PRIMITIVE_ID);
|
||||
BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_PRIMITIVE_ID);
|
||||
|
||||
prog_data->patch_count_threshold = brw::get_patch_count_threshold(key->input_vertices);
|
||||
|
||||
|
@@ -332,7 +332,7 @@ emit:
|
||||
* BRW_NEW_FRAGMENT_PROGRAM
|
||||
*/
|
||||
if (devinfo->gen == 4 && !devinfo->is_g4x &&
|
||||
(fp->info.system_values_read & (1ull << SYSTEM_VALUE_FRAG_COORD))) {
|
||||
BITSET_TEST(fp->info.system_values_read, SYSTEM_VALUE_FRAG_COORD)) {
|
||||
BEGIN_BATCH(2);
|
||||
OUT_BATCH(_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP << 16 | (2 - 2));
|
||||
OUT_BATCH(0);
|
||||
|
@@ -174,13 +174,13 @@ _mesa_update_primitive_id_is_unused(struct gl_context *ctx)
|
||||
* then the restriction on fragment shaders reading gl_PrimitiveID can be lifted.
|
||||
*/
|
||||
ctx->_PrimitiveIDIsUnused = !(
|
||||
(tcs && (tcs->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_PRIMITIVE_ID) ||
|
||||
(tcs && (BITSET_TEST(tcs->info.system_values_read, SYSTEM_VALUE_PRIMITIVE_ID) ||
|
||||
tcs->info.inputs_read & VARYING_BIT_PRIMITIVE_ID)) ||
|
||||
(tes && (tes->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_PRIMITIVE_ID) ||
|
||||
(tes && (BITSET_TEST(tes->info.system_values_read, SYSTEM_VALUE_PRIMITIVE_ID) ||
|
||||
tes->info.inputs_read & VARYING_BIT_PRIMITIVE_ID)) ||
|
||||
(gs && (gs->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_PRIMITIVE_ID) ||
|
||||
(gs && (BITSET_TEST(gs->info.system_values_read, SYSTEM_VALUE_PRIMITIVE_ID) ||
|
||||
gs->info.inputs_read & VARYING_BIT_PRIMITIVE_ID)) ||
|
||||
(fs && (fs->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_PRIMITIVE_ID) ||
|
||||
(fs && (BITSET_TEST(fs->info.system_values_read, SYSTEM_VALUE_PRIMITIVE_ID) ||
|
||||
fs->info.inputs_read & VARYING_BIT_PRIMITIVE_ID)));
|
||||
}
|
||||
|
||||
|
@@ -904,10 +904,8 @@ setup_registers_and_variables(struct ptn_compile *c)
|
||||
}
|
||||
|
||||
/* Create system value variables */
|
||||
uint64_t system_values_read = c->prog->info.system_values_read;
|
||||
while (system_values_read) {
|
||||
const int i = u_bit_scan64(&system_values_read);
|
||||
|
||||
int i;
|
||||
BITSET_FOREACH_SET(i, c->prog->info.system_values_read, SYSTEM_VALUE_MAX) {
|
||||
nir_variable *var =
|
||||
nir_variable_create(shader, nir_var_system_value, glsl_vec4_type(),
|
||||
ralloc_asprintf(shader, "sv_%d", i));
|
||||
|
@@ -524,8 +524,8 @@ _mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
|
||||
* forces per-sample shading"
|
||||
*/
|
||||
if (prog->info.fs.uses_sample_qualifier ||
|
||||
(prog->info.system_values_read & (SYSTEM_BIT_SAMPLE_ID |
|
||||
SYSTEM_BIT_SAMPLE_POS)))
|
||||
BITSET_TEST(prog->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID) ||
|
||||
BITSET_TEST(prog->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS))
|
||||
return MAX2(_mesa_geometric_samples(ctx->DrawBuffer), 1);
|
||||
else if (ctx->Multisample.SampleShading)
|
||||
return MAX2(ceilf(ctx->Multisample.MinSampleShadingValue *
|
||||
|
@@ -597,7 +597,7 @@ _mesa_program_fragment_position_to_sysval(struct gl_program *prog)
|
||||
return;
|
||||
|
||||
prog->info.inputs_read &= ~BITFIELD64_BIT(VARYING_SLOT_POS);
|
||||
prog->info.system_values_read |= 1 << SYSTEM_VALUE_FRAG_COORD;
|
||||
BITSET_SET(prog->info.system_values_read, SYSTEM_VALUE_FRAG_COORD);
|
||||
|
||||
for (i = 0; i < prog->arb.NumInstructions; i++) {
|
||||
struct prog_instruction *inst = prog->arb.Instructions + i;
|
||||
|
@@ -6886,11 +6886,7 @@ st_translate_program(
|
||||
|
||||
/* Declare misc input registers
|
||||
*/
|
||||
{
|
||||
GLbitfield64 sysInputs = proginfo->info.system_values_read;
|
||||
|
||||
for (i = 0; sysInputs; i++) {
|
||||
if (sysInputs & (1ull << i)) {
|
||||
BITSET_FOREACH_SET(i, proginfo->info.system_values_read, SYSTEM_VALUE_MAX) {
|
||||
enum tgsi_semantic semName = tgsi_get_sysval_semantic(i);
|
||||
|
||||
t->systemValues[i] = ureg_DECL_system_value(ureg, semName, 0);
|
||||
@@ -6925,10 +6921,6 @@ st_translate_program(
|
||||
if (procType == PIPE_SHADER_FRAGMENT &&
|
||||
semName == TGSI_SEMANTIC_SAMPLEPOS)
|
||||
emit_samplepos_adjustment(t, program->wpos_transform_const);
|
||||
|
||||
sysInputs &= ~(1ull << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
t->array_sizes = program->array_sizes;
|
||||
@@ -7231,8 +7223,8 @@ get_mesa_program_tgsi(struct gl_context *ctx,
|
||||
/* This must be done before the uniform storage is associated. */
|
||||
if (shader->Stage == MESA_SHADER_FRAGMENT &&
|
||||
(prog->info.inputs_read & VARYING_BIT_POS ||
|
||||
prog->info.system_values_read & (1ull << SYSTEM_VALUE_FRAG_COORD) ||
|
||||
prog->info.system_values_read & (1ull << SYSTEM_VALUE_SAMPLE_POS))) {
|
||||
BITSET_TEST(prog->info.system_values_read, SYSTEM_VALUE_FRAG_COORD) ||
|
||||
BITSET_TEST(prog->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS))) {
|
||||
static const gl_state_index16 wposTransformState[STATE_LENGTH] = {
|
||||
STATE_FB_WPOS_Y_TRANSFORM
|
||||
};
|
||||
|
@@ -4214,7 +4214,7 @@ allocate_sysvalues(struct ntd_context *ctx, nir_shader *s)
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(possible_sysvalues); ++i) {
|
||||
struct sysvalue_name *info = &possible_sysvalues[i];
|
||||
if ((1 << info->value) & s->info.system_values_read) {
|
||||
if (BITSET_TEST(s->info.system_values_read, info->value)) {
|
||||
if (!append_input_or_sysvalue(ctx, s, info->slot,
|
||||
info->value, info->name,
|
||||
driver_location++))
|
||||
|
Reference in New Issue
Block a user