gallium/tgsi_exec: Clean up storage of the pixel kill mask.

We need one dword per exec, rather than one per channel, since it's the
bitmask of channels killed.  Removes the remainder of the
TGSI_EXEC_NUM_TEMP_EXTRAS!

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8283>
This commit is contained in:
Eric Anholt 2020-12-22 13:45:33 -08:00 committed by Marge Bot
parent 6fb9365a07
commit d31c30007b
2 changed files with 18 additions and 42 deletions

View file

@ -971,12 +971,6 @@ enum tgsi_exec_datatype {
TGSI_EXEC_DATA_UINT64,
};
/*
* Shorthand locations of various utility registers (_I = Index, _C = Channel)
*/
#define TEMP_KILMASK_I TGSI_EXEC_TEMP_KILMASK_I
#define TEMP_KILMASK_C TGSI_EXEC_TEMP_KILMASK_C
/** The execution mask depends on the conditional mask and the loop mask */
#define UPDATE_EXEC_MASK(MACH) \
MACH->ExecMask = MACH->CondMask & MACH->LoopMask & MACH->ContMask & MACH->Switch.mask & MACH->FuncMask
@ -2006,7 +2000,7 @@ exec_kill_if(struct tgsi_exec_machine *mach,
/* restrict to fragments currently executing */
kilmask &= mach->ExecMask;
mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] |= kilmask;
mach->KillMask |= kilmask;
}
/**
@ -2015,11 +2009,10 @@ exec_kill_if(struct tgsi_exec_machine *mach,
static void
exec_kill(struct tgsi_exec_machine *mach)
{
uint kilmask; /* bit 0 = pixel 0, bit 1 = pixel 1, etc */
/* kill fragment for all fragments currently executing */
kilmask = mach->ExecMask;
mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] |= kilmask;
/* kill fragment for all fragments currently executing.
* bit 0 = pixel 0, bit 1 = pixel 1, etc.
*/
mach->KillMask |= mach->ExecMask;
}
static void
@ -3871,14 +3864,13 @@ exec_load_img(struct tgsi_exec_machine *mach,
uint chan;
float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
struct tgsi_image_params params;
int kilmask = mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];
unit = fetch_sampler_unit(mach, inst, 0);
dim = get_image_coord_dim(inst->Memory.Texture);
sample = get_image_coord_sample(inst->Memory.Texture);
assert(dim <= 3);
params.execmask = mach->ExecMask & mach->NonHelperMask & ~kilmask;
params.execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
params.unit = unit;
params.tgsi_tex_instr = inst->Memory.Texture;
params.format = inst->Memory.Format;
@ -4024,13 +4016,12 @@ exec_store_img(struct tgsi_exec_machine *mach,
int sample;
int i, j;
uint unit;
int kilmask = mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];
unit = fetch_store_img_unit(mach, &inst->Dst[0]);
dim = get_image_coord_dim(inst->Memory.Texture);
sample = get_image_coord_sample(inst->Memory.Texture);
assert(dim <= 3);
params.execmask = mach->ExecMask & mach->NonHelperMask & ~kilmask;
params.execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
params.unit = unit;
params.tgsi_tex_instr = inst->Memory.Texture;
params.format = inst->Memory.Format;
@ -4065,8 +4056,7 @@ exec_store_buf(struct tgsi_exec_machine *mach,
uint32_t size;
char *ptr = mach->Buffer->lookup(mach->Buffer, unit, &size);
int kilmask = mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];
int execmask = mach->ExecMask & mach->NonHelperMask & ~kilmask;
int execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
union tgsi_exec_channel offset;
IFETCH(&offset, 0, TGSI_CHAN_X);
@ -4099,8 +4089,7 @@ exec_store_mem(struct tgsi_exec_machine *mach,
union tgsi_exec_channel value[4];
uint i, chan;
char *ptr = mach->LocalMem;
int kilmask = mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];
int execmask = mach->ExecMask & mach->NonHelperMask & ~kilmask;
int execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
IFETCH(&r[0], 0, TGSI_CHAN_X);
@ -4148,13 +4137,12 @@ exec_atomop_img(struct tgsi_exec_machine *mach,
int sample;
int i, j;
uint unit, chan;
int kilmask = mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];
unit = fetch_sampler_unit(mach, inst, 0);
dim = get_image_coord_dim(inst->Memory.Texture);
sample = get_image_coord_sample(inst->Memory.Texture);
assert(dim <= 3);
params.execmask = mach->ExecMask & mach->NonHelperMask & ~kilmask;
params.execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
params.unit = unit;
params.tgsi_tex_instr = inst->Memory.Texture;
params.format = inst->Memory.Format;
@ -4209,8 +4197,7 @@ exec_atomop_membuf(struct tgsi_exec_machine *mach,
{
union tgsi_exec_channel offset, r0, r1;
uint chan, i;
int kilmask = mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];
int execmask = mach->ExecMask & mach->NonHelperMask & ~kilmask;
int execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
IFETCH(&offset, 1, TGSI_CHAN_X);
if (!(inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_X))
@ -4323,11 +4310,10 @@ exec_resq_img(struct tgsi_exec_machine *mach,
uint unit;
int i, chan, j;
struct tgsi_image_params params;
int kilmask = mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];
unit = fetch_sampler_unit(mach, inst, 0);
params.execmask = mach->ExecMask & mach->NonHelperMask & ~kilmask;
params.execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
params.unit = unit;
params.tgsi_tex_instr = inst->Memory.Texture;
params.format = inst->Memory.Format;
@ -6231,7 +6217,7 @@ tgsi_exec_machine_setup_masks(struct tgsi_exec_machine *mach)
{
uint default_mask = 0xf;
mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] = 0;
mach->KillMask = 0;
mach->OutputVertexOffset = 0;
if (mach->ShaderType == PIPE_SHADER_GEOMETRY) {
@ -6283,7 +6269,7 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach, int start_pc )
{
#if DEBUG_EXECUTION
struct tgsi_exec_vector temps[TGSI_EXEC_NUM_TEMPS + TGSI_EXEC_NUM_TEMP_EXTRAS];
struct tgsi_exec_vector temps[TGSI_EXEC_NUM_TEMPS];
struct tgsi_exec_vector outputs[PIPE_MAX_ATTRIBS];
uint inst = 1;
@ -6313,7 +6299,7 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach, int start_pc )
return 0;
#if DEBUG_EXECUTION
for (i = 0; i < TGSI_EXEC_NUM_TEMPS + TGSI_EXEC_NUM_TEMP_EXTRAS; i++) {
for (i = 0; i < TGSI_EXEC_NUM_TEMPS; i++) {
if (memcmp(&temps[i], &mach->Temps[i], sizeof(temps[i]))) {
uint j;
@ -6376,5 +6362,5 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach, int start_pc )
assert(mach->BreakStackTop == 0);
assert(mach->CallStackTop == 0);
return ~mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];
return ~mach->KillMask;
}

View file

@ -214,16 +214,6 @@ struct tgsi_sampler
#define TGSI_EXEC_NUM_TEMPS 4096
/*
* Locations of various utility registers (_I = Index, _C = Channel)
*/
#define TGSI_EXEC_TEMP_KILMASK_I (TGSI_EXEC_NUM_TEMPS + 0)
#define TGSI_EXEC_TEMP_KILMASK_C 0
#define TGSI_EXEC_NUM_TEMP_EXTRAS 1
#define TGSI_EXEC_MAX_NESTING 32
#define TGSI_EXEC_MAX_COND_NESTING TGSI_EXEC_MAX_NESTING
#define TGSI_EXEC_MAX_LOOP_NESTING TGSI_EXEC_MAX_NESTING
@ -300,8 +290,7 @@ struct tgsi_exec_machine
{
/* Total = program temporaries + internal temporaries
*/
struct tgsi_exec_vector Temps[TGSI_EXEC_NUM_TEMPS +
TGSI_EXEC_NUM_TEMP_EXTRAS];
struct tgsi_exec_vector Temps[TGSI_EXEC_NUM_TEMPS];
unsigned ImmsReserved;
float4 *Imms;
@ -359,6 +348,7 @@ struct tgsi_exec_machine
uint ContMask; /**< For loop CONT statements */
uint FuncMask; /**< For function calls */
uint ExecMask; /**< = CondMask & LoopMask */
uint KillMask; /**< Mask of channels killed in the current shader execution */
/* Current switch-case state. */
struct tgsi_switch_record Switch;