tgsi: drop instruction predicates.

These will never be sent to use from the guest, and upstream mesa
has removed them.
macos/master
Dave Airlie 7 years ago
parent bf238fdcbc
commit 751b7c4a08
  1. 66
      src/gallium/auxiliary/tgsi/tgsi_build.c
  2. 24
      src/gallium/auxiliary/tgsi/tgsi_dump.c
  3. 4
      src/gallium/auxiliary/tgsi/tgsi_parse.c
  4. 1
      src/gallium/auxiliary/tgsi/tgsi_parse.h
  5. 37
      src/gallium/auxiliary/tgsi/tgsi_text.c
  6. 56
      src/gallium/auxiliary/tgsi/tgsi_ureg.c
  7. 114
      src/gallium/auxiliary/tgsi/tgsi_ureg.h
  8. 20
      src/gallium/include/pipe/p_shader_tokens.h

@ -611,7 +611,6 @@ tgsi_default_instruction( void )
instruction.NrTokens = 0;
instruction.Opcode = TGSI_OPCODE_MOV;
instruction.Saturate = 0;
instruction.Predicate = 0;
instruction.NumDstRegs = 1;
instruction.NumSrcRegs = 1;
instruction.Label = 0;
@ -624,7 +623,6 @@ tgsi_default_instruction( void )
static struct tgsi_instruction
tgsi_build_instruction(unsigned opcode,
unsigned saturate,
unsigned predicate,
unsigned num_dst_regs,
unsigned num_src_regs,
struct tgsi_header *header)
@ -639,7 +637,6 @@ tgsi_build_instruction(unsigned opcode,
instruction = tgsi_default_instruction();
instruction.Opcode = opcode;
instruction.Saturate = saturate;
instruction.Predicate = predicate;
instruction.NumDstRegs = num_dst_regs;
instruction.NumSrcRegs = num_src_regs;
@ -660,47 +657,6 @@ instruction_grow(
header_bodysize_grow( header );
}
struct tgsi_instruction_predicate
tgsi_default_instruction_predicate(void)
{
struct tgsi_instruction_predicate instruction_predicate;
instruction_predicate.SwizzleX = TGSI_SWIZZLE_X;
instruction_predicate.SwizzleY = TGSI_SWIZZLE_Y;
instruction_predicate.SwizzleZ = TGSI_SWIZZLE_Z;
instruction_predicate.SwizzleW = TGSI_SWIZZLE_W;
instruction_predicate.Negate = 0;
instruction_predicate.Index = 0;
instruction_predicate.Padding = 0;
return instruction_predicate;
}
static struct tgsi_instruction_predicate
tgsi_build_instruction_predicate(int index,
unsigned negate,
unsigned swizzleX,
unsigned swizzleY,
unsigned swizzleZ,
unsigned swizzleW,
struct tgsi_instruction *instruction,
struct tgsi_header *header)
{
struct tgsi_instruction_predicate instruction_predicate;
instruction_predicate = tgsi_default_instruction_predicate();
instruction_predicate.SwizzleX = swizzleX;
instruction_predicate.SwizzleY = swizzleY;
instruction_predicate.SwizzleZ = swizzleZ;
instruction_predicate.SwizzleW = swizzleW;
instruction_predicate.Negate = negate;
instruction_predicate.Index = index;
instruction_grow(instruction, header);
return instruction_predicate;
}
static struct tgsi_instruction_label
tgsi_default_instruction_label( void )
{
@ -1005,7 +961,6 @@ tgsi_default_full_instruction( void )
unsigned i;
full_instruction.Instruction = tgsi_default_instruction();
full_instruction.Predicate = tgsi_default_instruction_predicate();
full_instruction.Label = tgsi_default_instruction_label();
full_instruction.Texture = tgsi_default_instruction_texture();
for( i = 0; i < TGSI_FULL_MAX_TEX_OFFSETS; i++ ) {
@ -1040,32 +995,11 @@ tgsi_build_full_instruction(
*instruction = tgsi_build_instruction(full_inst->Instruction.Opcode,
full_inst->Instruction.Saturate,
full_inst->Instruction.Predicate,
full_inst->Instruction.NumDstRegs,
full_inst->Instruction.NumSrcRegs,
header);
prev_token = (struct tgsi_token *) instruction;
if (full_inst->Instruction.Predicate) {
struct tgsi_instruction_predicate *instruction_predicate;
if (maxsize <= size) {
return 0;
}
instruction_predicate = (struct tgsi_instruction_predicate *)&tokens[size];
size++;
*instruction_predicate =
tgsi_build_instruction_predicate(full_inst->Predicate.Index,
full_inst->Predicate.Negate,
full_inst->Predicate.SwizzleX,
full_inst->Predicate.SwizzleY,
full_inst->Predicate.SwizzleZ,
full_inst->Predicate.SwizzleW,
instruction,
header);
}
if (full_inst->Instruction.Label) {
struct tgsi_instruction_label *instruction_label;

@ -524,30 +524,6 @@ iter_instruction(
TXT( " " );
ctx->indent += info->post_indent;
if (inst->Instruction.Predicate) {
CHR( '(' );
if (inst->Predicate.Negate)
CHR( '!' );
TXT( "PRED[" );
SID( inst->Predicate.Index );
CHR( ']' );
if (inst->Predicate.SwizzleX != TGSI_SWIZZLE_X ||
inst->Predicate.SwizzleY != TGSI_SWIZZLE_Y ||
inst->Predicate.SwizzleZ != TGSI_SWIZZLE_Z ||
inst->Predicate.SwizzleW != TGSI_SWIZZLE_W) {
CHR( '.' );
ENM( inst->Predicate.SwizzleX, tgsi_swizzle_names );
ENM( inst->Predicate.SwizzleY, tgsi_swizzle_names );
ENM( inst->Predicate.SwizzleZ, tgsi_swizzle_names );
ENM( inst->Predicate.SwizzleW, tgsi_swizzle_names );
}
TXT( ") " );
}
TXT( info->mnemonic );
if (inst->Instruction.Saturate) {

@ -179,10 +179,6 @@ tgsi_parse_token(
memset(inst, 0, sizeof *inst);
copy_token(&inst->Instruction, &token);
if (inst->Instruction.Predicate) {
next_token(ctx, &inst->Predicate);
}
if (inst->Instruction.Label) {
next_token( ctx, &inst->Label);
}

@ -88,7 +88,6 @@ struct tgsi_full_property
struct tgsi_full_instruction
{
struct tgsi_instruction Instruction;
struct tgsi_instruction_predicate Predicate;
struct tgsi_instruction_label Label;
struct tgsi_instruction_texture Texture;
struct tgsi_full_dst_register Dst[TGSI_FULL_MAX_DST_REGISTERS];

@ -979,43 +979,6 @@ parse_instruction(
inst = tgsi_default_full_instruction();
/* Parse predicate.
*/
eat_opt_white( &ctx->cur );
if (*ctx->cur == '(') {
uint file;
int index;
uint swizzle[4];
boolean parsed_swizzle;
inst.Instruction.Predicate = 1;
ctx->cur++;
if (*ctx->cur == '!') {
ctx->cur++;
inst.Predicate.Negate = 1;
}
if (!parse_register_1d( ctx, &file, &index ))
return FALSE;
if (parse_optional_swizzle( ctx, swizzle, &parsed_swizzle, 4 )) {
if (parsed_swizzle) {
inst.Predicate.SwizzleX = swizzle[0];
inst.Predicate.SwizzleY = swizzle[1];
inst.Predicate.SwizzleZ = swizzle[2];
inst.Predicate.SwizzleW = swizzle[3];
}
}
if (*ctx->cur != ')') {
report_error( ctx, "Expected `)'" );
return FALSE;
}
ctx->cur++;
}
/* Parse instruction name.
*/
eat_opt_white( &ctx->cur );

@ -54,7 +54,6 @@ union tgsi_any_token {
struct tgsi_immediate imm;
union tgsi_immediate_data imm_data;
struct tgsi_instruction insn;
struct tgsi_instruction_predicate insn_predicate;
struct tgsi_instruction_label insn_label;
struct tgsi_instruction_texture insn_texture;
struct tgsi_texture_offset insn_texture_offset;
@ -256,7 +255,6 @@ ureg_dst_register( unsigned file,
dst.IndirectIndex = 0;
dst.IndirectSwizzle = 0;
dst.Saturate = 0;
dst.Predicate = 0;
dst.PredNegate = 0;
dst.PredSwizzleX = TGSI_SWIZZLE_X;
dst.PredSwizzleY = TGSI_SWIZZLE_Y;
@ -925,17 +923,11 @@ struct ureg_emit_insn_result
ureg_emit_insn(struct ureg_program *ureg,
unsigned opcode,
boolean saturate,
boolean predicate,
boolean pred_negate,
unsigned pred_swizzle_x,
unsigned pred_swizzle_y,
unsigned pred_swizzle_z,
unsigned pred_swizzle_w,
unsigned num_dst,
unsigned num_src )
{
union tgsi_any_token *out;
uint count = predicate ? 2 : 1;
uint count = 1;
struct ureg_emit_insn_result result;
validate( opcode, num_dst, num_src );
@ -950,16 +942,6 @@ ureg_emit_insn(struct ureg_program *ureg,
result.insn_token = ureg->domain[DOMAIN_INSN].count - count;
result.extended_token = result.insn_token;
if (predicate) {
out[0].insn.Predicate = 1;
out[1].insn_predicate = tgsi_default_instruction_predicate();
out[1].insn_predicate.Negate = pred_negate;
out[1].insn_predicate.SwizzleX = pred_swizzle_x;
out[1].insn_predicate.SwizzleY = pred_swizzle_y;
out[1].insn_predicate.SwizzleZ = pred_swizzle_z;
out[1].insn_predicate.SwizzleW = pred_swizzle_w;
}
ureg->nr_instructions++;
return result;
@ -1061,7 +1043,6 @@ ureg_insn(struct ureg_program *ureg,
struct ureg_emit_insn_result insn;
unsigned i;
boolean saturate;
boolean predicate;
boolean negate = FALSE;
unsigned swizzle[4] = { 0 };
@ -1070,24 +1051,10 @@ ureg_insn(struct ureg_program *ureg,
}
saturate = nr_dst ? dst[0].Saturate : FALSE;
predicate = nr_dst ? dst[0].Predicate : FALSE;
if (predicate) {
negate = dst[0].PredNegate;
swizzle[0] = dst[0].PredSwizzleX;
swizzle[1] = dst[0].PredSwizzleY;
swizzle[2] = dst[0].PredSwizzleZ;
swizzle[3] = dst[0].PredSwizzleW;
}
insn = ureg_emit_insn(ureg,
opcode,
saturate,
predicate,
negate,
swizzle[0],
swizzle[1],
swizzle[2],
swizzle[3],
nr_dst,
nr_src);
@ -1114,7 +1081,6 @@ ureg_tex_insn(struct ureg_program *ureg,
struct ureg_emit_insn_result insn;
unsigned i;
boolean saturate;
boolean predicate;
boolean negate = FALSE;
unsigned swizzle[4] = { 0 };
@ -1123,24 +1089,10 @@ ureg_tex_insn(struct ureg_program *ureg,
}
saturate = nr_dst ? dst[0].Saturate : FALSE;
predicate = nr_dst ? dst[0].Predicate : FALSE;
if (predicate) {
negate = dst[0].PredNegate;
swizzle[0] = dst[0].PredSwizzleX;
swizzle[1] = dst[0].PredSwizzleY;
swizzle[2] = dst[0].PredSwizzleZ;
swizzle[3] = dst[0].PredSwizzleW;
}
insn = ureg_emit_insn(ureg,
opcode,
saturate,
predicate,
negate,
swizzle[0],
swizzle[1],
swizzle[2],
swizzle[3],
nr_dst,
nr_src);
@ -1172,12 +1124,6 @@ ureg_label_insn(struct ureg_program *ureg,
insn = ureg_emit_insn(ureg,
opcode,
FALSE,
FALSE,
FALSE,
TGSI_SWIZZLE_X,
TGSI_SWIZZLE_Y,
TGSI_SWIZZLE_Z,
TGSI_SWIZZLE_W,
0,
nr_src);

@ -509,12 +509,6 @@ struct ureg_emit_insn_result
ureg_emit_insn(struct ureg_program *ureg,
unsigned opcode,
boolean saturate,
boolean predicate,
boolean pred_negate,
unsigned pred_swizzle_x,
unsigned pred_swizzle_y,
unsigned pred_swizzle_z,
unsigned pred_swizzle_w,
unsigned num_dst,
unsigned num_src );
@ -553,12 +547,6 @@ static inline void ureg_##op( struct ureg_program *ureg ) \
insn = ureg_emit_insn(ureg, \
opcode, \
FALSE, \
FALSE, \
FALSE, \
TGSI_SWIZZLE_X, \
TGSI_SWIZZLE_Y, \
TGSI_SWIZZLE_Z, \
TGSI_SWIZZLE_W, \
0, \
0); \
ureg_fixup_insn_size( ureg, insn.insn_token ); \
@ -573,12 +561,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
FALSE, \
FALSE, \
FALSE, \
TGSI_SWIZZLE_X, \
TGSI_SWIZZLE_Y, \
TGSI_SWIZZLE_Z, \
TGSI_SWIZZLE_W, \
0, \
1); \
ureg_emit_src( ureg, src ); \
@ -594,12 +576,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
FALSE, \
FALSE, \
FALSE, \
TGSI_SWIZZLE_X, \
TGSI_SWIZZLE_Y, \
TGSI_SWIZZLE_Z, \
TGSI_SWIZZLE_W, \
0, \
0); \
ureg_emit_label( ureg, insn.extended_token, label_token ); \
@ -616,12 +592,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
FALSE, \
FALSE, \
FALSE, \
TGSI_SWIZZLE_X, \
TGSI_SWIZZLE_Y, \
TGSI_SWIZZLE_Z, \
TGSI_SWIZZLE_W, \
0, \
1); \
ureg_emit_label( ureg, insn.extended_token, label_token ); \
@ -640,12 +610,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
0); \
ureg_emit_dst( ureg, dst ); \
@ -665,12 +629,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
1); \
ureg_emit_dst( ureg, dst ); \
@ -691,12 +649,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
2); \
ureg_emit_dst( ureg, dst ); \
@ -719,12 +671,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
2); \
ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
@ -748,12 +694,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
2); \
ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
@ -777,12 +717,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
3); \
ureg_emit_dst( ureg, dst ); \
@ -807,12 +741,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
3); \
ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
@ -839,12 +767,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
4); \
ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
@ -872,12 +794,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
4); \
ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
@ -905,12 +821,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
4); \
ureg_emit_dst( ureg, dst ); \
@ -938,12 +848,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
5); \
ureg_emit_dst( ureg, dst ); \
@ -972,12 +876,6 @@ static inline void ureg_##op( struct ureg_program *ureg, \
insn = ureg_emit_insn(ureg, \
opcode, \
dst.Saturate, \
dst.Predicate, \
dst.PredNegate, \
dst.PredSwizzleX, \
dst.PredSwizzleY, \
dst.PredSwizzleZ, \
dst.PredSwizzleW, \
1, \
5); \
ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
@ -1152,12 +1050,6 @@ ureg_dst( struct ureg_src src )
dst.IndirectIndex = src.IndirectIndex;
dst.IndirectSwizzle = src.IndirectSwizzle;
dst.Saturate = 0;
dst.Predicate = 0;
dst.PredNegate = 0;
dst.PredSwizzleX = TGSI_SWIZZLE_X;
dst.PredSwizzleY = TGSI_SWIZZLE_Y;
dst.PredSwizzleZ = TGSI_SWIZZLE_Z;
dst.PredSwizzleW = TGSI_SWIZZLE_W;
dst.Index = src.Index;
dst.ArrayID = src.ArrayID;
@ -1235,12 +1127,6 @@ ureg_dst_undef( void )
dst.IndirectIndex = 0;
dst.IndirectSwizzle = 0;
dst.Saturate = 0;
dst.Predicate = 0;
dst.PredNegate = 0;
dst.PredSwizzleX = TGSI_SWIZZLE_X;
dst.PredSwizzleY = TGSI_SWIZZLE_Y;
dst.PredSwizzleZ = TGSI_SWIZZLE_Z;
dst.PredSwizzleW = TGSI_SWIZZLE_W;
dst.Index = 0;
dst.ArrayID = 0;

@ -551,8 +551,6 @@ struct tgsi_property_data {
* respectively. For a given operation code, those numbers are fixed and are
* present here only for convenience.
*
* If Predicate is TRUE, tgsi_instruction_predicate token immediately follows.
*
* Saturate controls how are final results in destination registers modified.
*/
@ -564,10 +562,9 @@ struct tgsi_instruction
unsigned Saturate : 1; /* BOOL */
unsigned NumDstRegs : 2; /* UINT */
unsigned NumSrcRegs : 4; /* UINT */
unsigned Predicate : 1; /* BOOL */
unsigned Label : 1;
unsigned Texture : 1;
unsigned Padding : 2;
unsigned Padding : 3;
};
/*
@ -639,21 +636,6 @@ struct tgsi_texture_offset
unsigned Padding : 6;
};
/*
* For SM3, the following constraint applies.
* - Swizzle is either set to identity or replicate.
*/
struct tgsi_instruction_predicate
{
int Index : 16; /* SINT */
unsigned SwizzleX : 2; /* TGSI_SWIZZLE_x */
unsigned SwizzleY : 2; /* TGSI_SWIZZLE_x */
unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_x */
unsigned SwizzleW : 2; /* TGSI_SWIZZLE_x */
unsigned Negate : 1; /* BOOL */
unsigned Padding : 7;
};
/**
* File specifies the register array to access.
*

Loading…
Cancel
Save