const bool need_texcoord_semantic)
{
struct aa_transform_context transform;
- const uint num_new_tokens = 200; /* should be enough */
- const uint new_len = tgsi_num_tokens(tokens_in) + num_new_tokens;
+ const unsigned num_new_tokens = 200; /* should be enough */
+ const unsigned new_len = tgsi_num_tokens(tokens_in) + num_new_tokens;
/* setup transformation context */
memset(&transform, 0, sizeof(transform));
bool dump_float_as_hex;
- uint instno;
- uint immno;
+ unsigned instno;
+ unsigned immno;
int indent;
- uint indentation;
+ unsigned indentation;
FILE *file;
void (*dump_printf)(struct dump_ctx *ctx, const char *format, ...);
static void
dump_enum(
struct dump_ctx *ctx,
- uint e,
+ unsigned e,
const char **enums,
- uint enum_count )
+ unsigned enum_count )
{
if (e >= enum_count)
ctx->dump_printf( ctx, "%u", e );
static void
_dump_writemask(
struct dump_ctx *ctx,
- uint writemask )
+ unsigned writemask )
{
if (writemask != TGSI_WRITEMASK_XYZW) {
CHR( '.' );
struct tgsi_full_instruction *inst )
{
struct dump_ctx *ctx = (struct dump_ctx *) iter;
- uint instno = ctx->instno++;
+ unsigned instno = ctx->instno++;
const struct tgsi_opcode_info *info = tgsi_get_opcode_info( inst->Instruction.Opcode );
- uint i;
+ unsigned i;
bool first_reg = true;
INSTID( instno );
void
tgsi_dump_instruction(
const struct tgsi_full_instruction *inst,
- uint instno )
+ unsigned instno )
{
struct dump_ctx ctx;
memset(&ctx, 0, sizeof(ctx));
}
static void
-init_dump_ctx(struct dump_ctx *ctx, uint flags)
+init_dump_ctx(struct dump_ctx *ctx, unsigned flags)
{
memset(ctx, 0, sizeof(*ctx));
}
void
-tgsi_dump_to_file(const struct tgsi_token *tokens, uint flags, FILE *file)
+tgsi_dump_to_file(const struct tgsi_token *tokens, unsigned flags, FILE *file)
{
struct dump_ctx ctx;
memset(&ctx, 0, sizeof(ctx));
}
void
-tgsi_dump(const struct tgsi_token *tokens, uint flags)
+tgsi_dump(const struct tgsi_token *tokens, unsigned flags)
{
tgsi_dump_to_file(tokens, flags, NULL);
}
bool
tgsi_dump_str(
const struct tgsi_token *tokens,
- uint flags,
+ unsigned flags,
char *str,
size_t size)
{
void
tgsi_dump_instruction_str(
const struct tgsi_full_instruction *inst,
- uint instno,
+ unsigned instno,
char *str,
size_t size)
{
bool
tgsi_dump_str(
const struct tgsi_token *tokens,
- uint flags,
+ unsigned flags,
char *str,
size_t size);
void
-tgsi_dump_to_file(const struct tgsi_token *tokens, uint flags, FILE *file);
+tgsi_dump_to_file(const struct tgsi_token *tokens, unsigned flags, FILE *file);
void
tgsi_dump(
const struct tgsi_token *tokens,
- uint flags );
+ unsigned flags );
struct tgsi_full_immediate;
struct tgsi_full_instruction;
void
tgsi_dump_instruction_str(
const struct tgsi_full_instruction *inst,
- uint instno,
+ unsigned instno,
char *str,
size_t size);
void
tgsi_dump_instruction(
const struct tgsi_full_instruction *inst,
- uint instno );
+ unsigned instno );
#if defined __cplusplus
}
unsigned imm_count)
{
struct dIndexing_transform_context transform;
- const uint num_new_tokens = 1000; /* should be enough */
- const uint new_len = tgsi_num_tokens(tokens_in) + num_new_tokens;
+ const unsigned num_new_tokens = 1000; /* should be enough */
+ const unsigned new_len = tgsi_num_tokens(tokens_in) + num_new_tokens;
/* setup transformation context */
memset(&transform, 0, sizeof(transform));
{
#if DEBUG
/* Inf is okay for this instruction, so clamp it to silence assertions. */
- uint i;
+ unsigned i;
union tgsi_exec_channel clamped;
for (i = 0; i < 4; i++) {
#ifdef DEBUG
static void
-print_temp(const struct tgsi_exec_machine *mach, uint index)
+print_temp(const struct tgsi_exec_machine *mach, unsigned index)
{
const struct tgsi_exec_vector *tmp = &mach->Temps[index];
int i;
struct tgsi_image *image,
struct tgsi_buffer *buffer)
{
- uint k;
+ unsigned k;
struct tgsi_parse_context parse;
struct tgsi_full_instruction *instructions;
struct tgsi_full_declaration *declarations;
- uint maxInstructions = 10, numInstructions = 0;
- uint maxDeclarations = 10, numDeclarations = 0;
+ unsigned maxInstructions = 10, numInstructions = 0;
+ unsigned maxDeclarations = 10, numDeclarations = 0;
#if 0
tgsi_dump(tokens, 0);
}
while( !tgsi_parse_end_of_tokens( &parse ) ) {
- uint i;
+ unsigned i;
tgsi_parse_token( &parse );
switch( parse.FullToken.Token.Type ) {
case TGSI_TOKEN_TYPE_IMMEDIATE:
{
- uint size = parse.FullToken.FullImmediate.Immediate.NrTokens - 1;
+ unsigned size = parse.FullToken.FullImmediate.Immediate.NrTokens - 1;
assert( size <= 4 );
if (mach->ImmLimit >= mach->ImmsReserved) {
unsigned newReserved = mach->ImmsReserved ? 2 * mach->ImmsReserved : 128;
static void
fetch_src_file_channel(const struct tgsi_exec_machine *mach,
- const uint file,
- const uint swizzle,
+ const unsigned file,
+ const unsigned swizzle,
const union tgsi_exec_channel *index,
const union tgsi_exec_channel *index2D,
union tgsi_exec_channel *chan)
{
- uint i;
+ unsigned i;
assert(swizzle < 4);
switch (file) {
case TGSI_FILE_CONSTANT:
for (i = 0; i < TGSI_QUAD_SIZE; i++) {
- /* NOTE: copying the const value as a uint instead of float */
- const uint constbuf = index2D->i[i];
+ /* NOTE: copying the const value as a unsigned instead of float */
+ const unsigned constbuf = index2D->i[i];
const unsigned pos = index->i[i] * 4 + swizzle;
/* const buffer bounds check */
if (pos >= mach->ConstsSize[constbuf] / 4) {
}
chan->u[i] = 0;
} else {
- const uint *buf = (const uint *)mach->Consts[constbuf];
+ const unsigned *buf = (const unsigned *)mach->Consts[constbuf];
chan->u[i] = buf[pos];
}
}
* .x = Indirect.SwizzleX
*/
if (reg->Register.Indirect) {
- const uint execmask = mach->ExecMask;
+ const unsigned execmask = mach->ExecMask;
assert(reg->Indirect.File == TGSI_FILE_ADDRESS);
const union tgsi_exec_channel *addr = &mach->Addrs[reg->Indirect.Index].xyzw[reg->Indirect.Swizzle];
* .y = DimIndirect.SwizzleX
*/
if (reg->Dimension.Indirect) {
- const uint execmask = mach->ExecMask;
+ const unsigned execmask = mach->ExecMask;
assert(reg->DimIndirect.File == TGSI_FILE_ADDRESS);
const union tgsi_exec_channel *addr = &mach->Addrs[reg->DimIndirect.Index].xyzw[reg->DimIndirect.Swizzle];
fetch_source_d(const struct tgsi_exec_machine *mach,
union tgsi_exec_channel *chan,
const struct tgsi_full_src_register *reg,
- const uint chan_index)
+ const unsigned chan_index)
{
union tgsi_exec_channel index;
union tgsi_exec_channel index2D;
- uint swizzle;
+ unsigned swizzle;
get_index_registers(mach, reg, &index, &index2D);
fetch_source(const struct tgsi_exec_machine *mach,
union tgsi_exec_channel *chan,
const struct tgsi_full_src_register *reg,
- const uint chan_index,
+ const unsigned chan_index,
enum tgsi_exec_datatype src_datatype)
{
fetch_source_d(mach, chan, reg, chan_index);
store_dest_dstret(struct tgsi_exec_machine *mach,
const union tgsi_exec_channel *chan,
const struct tgsi_full_dst_register *reg,
- uint chan_index)
+ unsigned chan_index)
{
static union tgsi_exec_channel null;
union tgsi_exec_channel *dst;
if (reg->Register.Indirect) {
union tgsi_exec_channel index;
union tgsi_exec_channel indir_index;
- uint swizzle;
+ unsigned swizzle;
/* which address register (always zero for now) */
index.i[0] =
store_dest_double(struct tgsi_exec_machine *mach,
const union tgsi_exec_channel *chan,
const struct tgsi_full_dst_register *reg,
- uint chan_index)
+ unsigned chan_index)
{
union tgsi_exec_channel *dst;
- const uint execmask = mach->ExecMask;
+ const unsigned execmask = mach->ExecMask;
int i;
dst = store_dest_dstret(mach, chan, reg, chan_index);
const union tgsi_exec_channel *chan,
const struct tgsi_full_dst_register *reg,
const struct tgsi_full_instruction *inst,
- uint chan_index)
+ unsigned chan_index)
{
union tgsi_exec_channel *dst;
- const uint execmask = mach->ExecMask;
+ const unsigned execmask = mach->ExecMask;
int i;
dst = store_dest_dstret(mach, chan, reg, chan_index);
exec_kill_if(struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst)
{
- uint uniquemask;
- uint chan_index;
- uint kilmask = 0; /* bit 0 = pixel 0, bit 1 = pixel 1, etc */
+ unsigned uniquemask;
+ unsigned chan_index;
+ unsigned kilmask = 0; /* bit 0 = pixel 0, bit 1 = pixel 1, etc */
union tgsi_exec_channel r[1];
/* This mask stores component bits that were already tested. */
for (chan_index = 0; chan_index < 4; chan_index++)
{
- uint swizzle;
- uint i;
+ unsigned swizzle;
+ unsigned i;
/* unswizzle channel */
swizzle = tgsi_util_get_full_src_register_swizzle (
union tgsi_exec_channel *b,
union tgsi_exec_channel *a )
{
- uint j;
+ unsigned j;
float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
/* FIXME: handle explicit derivs, offsets */
derivs[1][3] = d.f[3];
}
-static uint
+static unsigned
fetch_sampler_unit(struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst,
- uint sampler)
+ unsigned sampler)
{
- uint unit = 0;
+ unsigned unit = 0;
int i;
if (inst->Src[sampler].Register.Indirect) {
const struct tgsi_full_src_register *reg = &inst->Src[sampler];
union tgsi_exec_channel indir_index, index2;
- const uint execmask = mach->ExecMask;
+ const unsigned execmask = mach->ExecMask;
index2.i[0] =
index2.i[1] =
index2.i[2] =
static void
exec_tex(struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst,
- enum tex_modifier modifier, uint sampler)
+ enum tex_modifier modifier, unsigned sampler)
{
const union tgsi_exec_channel *args[5], *proj = NULL;
union tgsi_exec_channel r[5];
enum tgsi_sampler_control control = TGSI_SAMPLER_LOD_NONE;
- uint chan;
- uint unit;
+ unsigned chan;
+ unsigned unit;
int8_t offsets[3];
int dim, shadow_ref, i;
exec_lodq(struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst)
{
- uint resource_unit, sampler_unit;
+ unsigned resource_unit, sampler_unit;
unsigned dim;
unsigned i;
union tgsi_exec_channel coords[4];
resource_unit = fetch_sampler_unit(mach, inst, 1);
if (inst->Instruction.Opcode == TGSI_OPCODE_LOD) {
- uint target = mach->SamplerViews[resource_unit].Resource;
+ unsigned target = mach->SamplerViews[resource_unit].Resource;
dim = tgsi_util_get_texture_coord_dim(target);
sampler_unit = fetch_sampler_unit(mach, inst, 2);
} else {
{
union tgsi_exec_channel r[4];
float derivs[3][2][TGSI_QUAD_SIZE];
- uint chan;
- uint unit;
+ unsigned chan;
+ unsigned unit;
int8_t offsets[3];
unit = fetch_sampler_unit(mach, inst, 3);
const struct tgsi_full_instruction *inst)
{
union tgsi_exec_channel r[4];
- uint chan;
- uint unit;
+ unsigned chan;
+ unsigned unit;
float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
int j;
int8_t offsets[3];
{
int result[4];
union tgsi_exec_channel r[4], src;
- uint chan;
- uint unit;
+ unsigned chan;
+ unsigned unit;
int i,j;
unit = fetch_sampler_unit(mach, inst, 1);
const struct tgsi_full_instruction *inst,
enum tex_modifier modifier, bool compare)
{
- const uint resource_unit = inst->Src[1].Register.Index;
- const uint sampler_unit = inst->Src[2].Register.Index;
+ const unsigned resource_unit = inst->Src[1].Register.Index;
+ const unsigned sampler_unit = inst->Src[2].Register.Index;
union tgsi_exec_channel r[5], c1;
const union tgsi_exec_channel *lod = &ZeroVec;
enum tgsi_sampler_control control = TGSI_SAMPLER_LOD_NONE;
- uint chan;
+ unsigned chan;
unsigned char swizzles[4];
int8_t offsets[3];
exec_sample_d(struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst)
{
- const uint resource_unit = inst->Src[1].Register.Index;
- const uint sampler_unit = inst->Src[2].Register.Index;
+ const unsigned resource_unit = inst->Src[1].Register.Index;
+ const unsigned sampler_unit = inst->Src[2].Register.Index;
union tgsi_exec_channel r[4];
float derivs[3][2][TGSI_QUAD_SIZE];
- uint chan;
+ unsigned chan;
unsigned char swizzles[4];
int8_t offsets[3];
if (mach->ShaderType == PIPE_SHADER_FRAGMENT) {
if (decl->Declaration.File == TGSI_FILE_INPUT) {
- uint first, last, mask;
+ unsigned first, last, mask;
first = decl->Range.First;
last = decl->Range.Last;
*/
/* XXX make FACE a system value */
if (decl->Semantic.Name == TGSI_SEMANTIC_FACE) {
- uint i;
+ unsigned i;
assert(decl->Semantic.Index == 0);
assert(first == last);
} else {
eval_coef_func eval;
apply_sample_offset_func interp;
- uint i, j;
+ unsigned i, j;
switch (decl->Interp.Interpolate) {
case TGSI_INTERPOLATE_CONSTANT:
}
if (DEBUG_EXECUTION) {
- uint i, j;
+ unsigned i, j;
for (i = first; i <= last; ++i) {
debug_printf("IN[%2u] = ", i);
for (j = 0; j < TGSI_NUM_CHANNELS; j++) {
exec_case(struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst)
{
- uint prevMask = mach->SwitchStack[mach->SwitchStackTop - 1].mask;
+ unsigned prevMask = mach->SwitchStack[mach->SwitchStackTop - 1].mask;
union tgsi_exec_channel src;
- uint mask = 0;
+ unsigned mask = 0;
fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_UINT);
static void
exec_default(struct tgsi_exec_machine *mach)
{
- uint prevMask = mach->SwitchStack[mach->SwitchStackTop - 1].mask;
+ unsigned prevMask = mach->SwitchStack[mach->SwitchStackTop - 1].mask;
mach->Switch.mask |= ~mach->Switch.defaultMask & prevMask;
fetch_double_channel(struct tgsi_exec_machine *mach,
union tgsi_double_channel *chan,
const struct tgsi_full_src_register *reg,
- uint chan_0,
- uint chan_1)
+ unsigned chan_0,
+ unsigned chan_1)
{
union tgsi_exec_channel src[2];
- uint i;
+ unsigned i;
fetch_source_d(mach, &src[0], reg, chan_0);
fetch_source_d(mach, &src[1], reg, chan_1);
const union tgsi_double_channel *chan,
const struct tgsi_full_dst_register *reg,
const struct tgsi_full_instruction *inst,
- uint chan_0,
- uint chan_1)
+ unsigned chan_0,
+ unsigned chan_1)
{
union tgsi_exec_channel dst[2];
- uint i;
+ unsigned i;
union tgsi_double_channel temp;
- const uint execmask = mach->ExecMask;
+ const unsigned execmask = mach->ExecMask;
if (!inst->Instruction.Saturate) {
for (i = 0; i < TGSI_QUAD_SIZE; i++)
const struct tgsi_full_instruction *inst)
{
union tgsi_exec_channel r[4], sample_r;
- uint unit;
+ unsigned unit;
int sample;
int i, j;
int dim;
- uint chan;
+ unsigned chan;
float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
struct tgsi_image_params params;
exec_load_membuf(mach, inst);
}
-static uint
+static unsigned
fetch_store_img_unit(struct tgsi_exec_machine *mach,
const struct tgsi_full_dst_register *dst)
{
- uint unit = 0;
+ unsigned unit = 0;
int i;
if (dst->Register.Indirect) {
union tgsi_exec_channel indir_index, index2;
- const uint execmask = mach->ExecMask;
+ const unsigned execmask = mach->ExecMask;
index2.i[0] =
index2.i[1] =
index2.i[2] =
int dim;
int sample;
int i, j;
- uint unit;
+ unsigned unit;
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);
int dim;
int sample;
int i, j;
- uint unit, chan;
+ unsigned unit, chan;
unit = fetch_sampler_unit(mach, inst, 0);
dim = get_image_coord_dim(inst->Memory.Texture);
sample = get_image_coord_sample(inst->Memory.Texture);
const struct tgsi_full_instruction *inst)
{
union tgsi_exec_channel offset, r0, r1;
- uint chan, i;
+ unsigned chan, i;
int execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
IFETCH(&offset, 1, TGSI_CHAN_X);
{
int result[4];
union tgsi_exec_channel r[4];
- uint unit;
+ unsigned unit;
int i, chan, j;
struct tgsi_image_params params;
case TGSI_OPCODE_ELSE:
/* invert CondMask wrt previous mask */
{
- uint prevMask;
+ unsigned prevMask;
assert(mach->CondStackTop > 0);
prevMask = mach->CondStack[mach->CondStackTop - 1];
mach->CondMask = ~mach->CondMask & prevMask;
static void
tgsi_exec_machine_setup_masks(struct tgsi_exec_machine *mach)
{
- uint default_mask = 0xf;
+ unsigned default_mask = 0xf;
mach->KillMask = 0;
mach->OutputVertexOffset = 0;
uint
tgsi_exec_machine_run( struct tgsi_exec_machine *mach, int start_pc )
{
- uint i;
+ unsigned i;
mach->pc = start_pc;
#if DEBUG_EXECUTION
struct tgsi_exec_vector temps[TGSI_EXEC_NUM_TEMPS];
struct tgsi_exec_vector outputs[PIPE_MAX_ATTRIBS];
- uint inst = 1;
+ unsigned inst = 1;
if (!start_pc) {
memset(mach->Temps, 0, sizeof(temps));
while (mach->pc != -1) {
bool barrier_hit;
#if DEBUG_EXECUTION
- uint i;
+ unsigned i;
tgsi_dump_instruction(&mach->Instructions[mach->pc], inst++);
#endif
#if DEBUG_EXECUTION
for (i = 0; i < TGSI_EXEC_NUM_TEMPS; i++) {
if (memcmp(&temps[i], &mach->Temps[i], sizeof(temps[i]))) {
- uint j;
+ unsigned j;
memcpy(&temps[i], &mach->Temps[i], sizeof(temps[i]));
debug_printf("TEMP[%2u] = ", i);
if (mach->Outputs) {
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
if (memcmp(&outputs[i], &mach->Outputs[i], sizeof(outputs[i]))) {
- uint j;
+ unsigned j;
memcpy(&outputs[i], &mach->Outputs[i], sizeof(outputs[i]));
debug_printf("OUT[%2u] = ", i);
/** function call/activation record */
struct tgsi_call_record
{
- uint CondStackTop;
- uint LoopStackTop;
- uint ContStackTop;
+ unsigned CondStackTop;
+ unsigned LoopStackTop;
+ unsigned ContStackTop;
int SwitchStackTop;
int BreakStackTop;
- uint ReturnAddr;
+ unsigned ReturnAddr;
};
/* should match draw_buffer_info */
/* Switch-case block state. */
struct tgsi_switch_record {
- uint mask; /**< execution mask */
+ unsigned mask; /**< execution mask */
union tgsi_exec_channel selector; /**< a value case statements are compared to */
- uint defaultMask; /**< non-execute mask for default case */
+ unsigned defaultMask; /**< non-execute mask for default case */
};
unsigned LocalMemSize;
/* See GLSL 4.50 specification for definition of helper invocations */
- uint NonHelperMask; /**< non-helpers */
+ unsigned NonHelperMask; /**< non-helpers */
/* Conditional execution masks */
- uint CondMask; /**< For IF/ELSE/ENDIF */
- uint LoopMask; /**< For BGNLOOP/ENDLOOP */
- 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 */
+ unsigned CondMask; /**< For IF/ELSE/ENDIF */
+ unsigned LoopMask; /**< For BGNLOOP/ENDLOOP */
+ unsigned ContMask; /**< For loop CONT statements */
+ unsigned FuncMask; /**< For function calls */
+ unsigned ExecMask; /**< = CondMask & LoopMask */
+ unsigned KillMask; /**< Mask of channels killed in the current shader execution */
/* Current switch-case state. */
struct tgsi_switch_record Switch;
enum tgsi_break_type BreakType;
/** Condition mask stack (for nested conditionals) */
- uint CondStack[TGSI_EXEC_MAX_COND_NESTING];
+ unsigned CondStack[TGSI_EXEC_MAX_COND_NESTING];
int CondStackTop;
/** Loop mask stack (for nested loops) */
- uint LoopStack[TGSI_EXEC_MAX_LOOP_NESTING];
+ unsigned LoopStack[TGSI_EXEC_MAX_LOOP_NESTING];
int LoopStackTop;
/** Loop label stack */
- uint LoopLabelStack[TGSI_EXEC_MAX_LOOP_NESTING];
+ unsigned LoopLabelStack[TGSI_EXEC_MAX_LOOP_NESTING];
int LoopLabelStackTop;
/** Loop continue mask stack (see comments in tgsi_exec.c) */
- uint ContStack[TGSI_EXEC_MAX_LOOP_NESTING];
+ unsigned ContStack[TGSI_EXEC_MAX_LOOP_NESTING];
int ContStackTop;
/** Switch case stack */
int BreakStackTop;
/** Function execution mask stack (for executing subroutine code) */
- uint FuncStack[TGSI_EXEC_MAX_CALL_NESTING];
+ unsigned FuncStack[TGSI_EXEC_MAX_CALL_NESTING];
int FuncStackTop;
/** Function call stack for saving/restoring the program counter */
int CallStackTop;
struct tgsi_full_instruction *Instructions;
- uint NumInstructions;
+ unsigned NumInstructions;
struct tgsi_full_declaration *Declarations;
- uint NumDeclarations;
+ unsigned NumDeclarations;
struct tgsi_declaration_sampler_view
SamplerViews[PIPE_MAX_SHADER_SAMPLER_VIEWS];
* infer the source type of a TGSI opcode.
*/
enum tgsi_opcode_type
-tgsi_opcode_infer_src_type(enum tgsi_opcode opcode, uint src_idx)
+tgsi_opcode_infer_src_type(enum tgsi_opcode opcode, unsigned src_idx)
{
if (src_idx == 1 &&
(opcode == TGSI_OPCODE_DLDEXP || opcode == TGSI_OPCODE_LDEXP))
* infer the destination type of a TGSI opcode.
*/
enum tgsi_opcode_type
-tgsi_opcode_infer_dst_type(enum tgsi_opcode opcode, uint dst_idx)
+tgsi_opcode_infer_dst_type(enum tgsi_opcode opcode, unsigned dst_idx)
{
return tgsi_opcode_infer_type(opcode);
}
}
enum tgsi_opcode_type
-tgsi_opcode_infer_src_type(enum tgsi_opcode opcode, uint src_idx);
+tgsi_opcode_infer_src_type(enum tgsi_opcode opcode, unsigned src_idx);
enum tgsi_opcode_type
-tgsi_opcode_infer_dst_type(enum tgsi_opcode opcode, uint dst_idx);
+tgsi_opcode_infer_dst_type(enum tgsi_opcode opcode, unsigned dst_idx);
#if defined __cplusplus
}
case TGSI_TOKEN_TYPE_IMMEDIATE:
{
struct tgsi_full_immediate *imm = &ctx->FullToken.FullImmediate;
- uint imm_count;
+ unsigned imm_count;
memset(imm, 0, sizeof *imm);
copy_token(&imm->Immediate, &token);
case TGSI_TOKEN_TYPE_PROPERTY:
{
struct tgsi_full_property *prop = &ctx->FullToken.FullProperty;
- uint prop_count;
+ unsigned prop_count;
memset(prop, 0, sizeof *prop);
copy_token(&prop->Property, &token);
int *aa_point_coord_index)
{
struct psprite_transform_context transform;
- const uint num_new_tokens = 200; /* should be enough */
- const uint new_len = tgsi_num_tokens(tokens_in) + num_new_tokens;
+ const unsigned num_new_tokens = 200; /* should be enough */
+ const unsigned new_len = tgsi_num_tokens(tokens_in) + num_new_tokens;
struct tgsi_token *new_tokens;
/* setup transformation context */
uint32_t file : 28;
/* max 2 dimensions */
uint32_t dimensions : 4;
- uint indices[2];
+ unsigned indices[2];
} scan_register;
struct sanity_check_ctx
struct cso_hash regs_used;
struct cso_hash regs_ind_used;
- uint num_imms;
- uint num_instructions;
- uint index_of_END;
+ unsigned num_imms;
+ unsigned num_instructions;
+ unsigned index_of_END;
- uint errors;
- uint warnings;
- uint implied_array_size;
- uint implied_out_array_size;
+ unsigned errors;
+ unsigned warnings;
+ unsigned implied_array_size;
+ unsigned implied_out_array_size;
bool print;
};
static void
fill_scan_register1d(scan_register *reg,
- enum tgsi_file_type file, uint index)
+ enum tgsi_file_type file, unsigned index)
{
reg->file = file;
reg->dimensions = 1;
static void
fill_scan_register2d(scan_register *reg,
- enum tgsi_file_type file, uint index1, uint index2)
+ enum tgsi_file_type file,
+ unsigned index1, unsigned index2)
{
reg->file = file;
reg->dimensions = 2;
{
struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
const struct tgsi_opcode_info *info;
- uint i;
+ unsigned i;
if (inst->Instruction.Opcode == TGSI_OPCODE_END) {
if (ctx->index_of_END != ~0u) {
{
struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
enum tgsi_file_type file;
- uint i;
+ unsigned i;
/* No declarations allowed after the first instruction.
*/
for (i = decl->Range.First; i <= decl->Range.Last; i++) {
/* declared TGSI_FILE_INPUT's for geometry and tessellation
* have an implied second dimension */
- uint processor = ctx->iter.processor.Processor;
- uint patch = decl->Semantic.Name == TGSI_SEMANTIC_PATCH ||
+ unsigned processor = ctx->iter.processor.Processor;
+ unsigned patch = decl->Semantic.Name == TGSI_SEMANTIC_PATCH ||
decl->Semantic.Name == TGSI_SEMANTIC_TESSOUTER ||
decl->Semantic.Name == TGSI_SEMANTIC_TESSINNER;
if (file == TGSI_FILE_INPUT && !patch && (
processor == PIPE_SHADER_GEOMETRY ||
processor == PIPE_SHADER_TESS_CTRL ||
processor == PIPE_SHADER_TESS_EVAL)) {
- uint vert;
+ unsigned vert;
for (vert = 0; vert < ctx->implied_array_size; ++vert) {
scan_register *reg = MALLOC(sizeof(scan_register));
fill_scan_register2d(reg, file, i, vert);
}
} else if (file == TGSI_FILE_OUTPUT && !patch &&
processor == PIPE_SHADER_TESS_CTRL) {
- uint vert;
+ unsigned vert;
for (vert = 0; vert < ctx->implied_out_array_size; ++vert) {
scan_register *reg = MALLOC(sizeof(scan_register));
fill_scan_register2d(reg, file, i, vert);
{
enum tgsi_file_type file = fulldecl->Declaration.File;
const unsigned procType = info->processor;
- uint reg;
+ unsigned reg;
if (fulldecl->Declaration.Array) {
unsigned array_id = fulldecl->Array.ArrayID;
static void
scan_immediate(struct tgsi_shader_info *info)
{
- uint reg = info->immediate_count++;
+ unsigned reg = info->immediate_count++;
enum tgsi_file_type file = TGSI_FILE_IMMEDIATE;
info->file_mask[file] |= (1 << reg);
tgsi_scan_shader(const struct tgsi_token *tokens,
struct tgsi_shader_info *info)
{
- uint procType, i;
+ unsigned procType, i;
struct tgsi_parse_context parse;
unsigned current_depth = 0;
*/
struct tgsi_shader_info
{
- uint num_tokens;
+ unsigned num_tokens;
uint8_t num_inputs;
uint8_t num_outputs;
uint8_t processor;
uint32_t file_mask[TGSI_FILE_COUNT]; /**< bitmask of declared registers */
- uint file_count[TGSI_FILE_COUNT]; /**< number of declared registers */
+ unsigned file_count[TGSI_FILE_COUNT]; /**< number of declared registers */
int file_max[TGSI_FILE_COUNT]; /**< highest index of declared registers */
int const_file_max[PIPE_MAX_CONSTANT_BUFFERS];
unsigned const_buffers_declared; /**< bitmask of declared const buffers */
uint8_t output_array_first[PIPE_MAX_SHADER_OUTPUTS];
unsigned array_max[TGSI_FILE_COUNT]; /**< highest index array per register file */
- uint immediate_count; /**< number of immediates declared */
- uint num_instructions;
- uint num_memory_instructions; /**< sampler, buffer, and image instructions */
+ unsigned immediate_count; /**< number of immediates declared */
+ unsigned num_instructions;
+ unsigned num_memory_instructions; /**< sampler, buffer, and image instructions */
- uint opcode_count[TGSI_OPCODE_LAST]; /**< opcode histogram */
+ unsigned opcode_count[TGSI_OPCODE_LAST]; /**< opcode histogram */
/**
* If a tessellation control shader reads outputs, this describes which ones.
/* Parse unsigned integer.
* No checks for overflow.
*/
-static bool parse_uint( const char **pcur, uint *val )
+static bool parse_uint( const char **pcur, unsigned *val )
{
const char *cur = *pcur;
if (*cur == '+' || *cur == '-')
cur++;
- if (parse_uint(&cur, (uint *)val)) {
+ if (parse_uint(&cur, (unsigned *)val)) {
*val *= sign;
*pcur = cur;
return true;
return true;
}
-static bool parse_label( struct translate_ctx *ctx, uint *val )
+static bool parse_label( struct translate_ctx *ctx, unsigned *val )
{
const char *cur = ctx->cur;
static bool
parse_opt_writemask(
struct translate_ctx *ctx,
- uint *writemask )
+ unsigned *writemask )
{
const char *cur;
enum tgsi_file_type *file,
int *index )
{
- uint uindex;
+ unsigned uindex;
if (!parse_register_file_bracket( ctx, file ))
return false;
enum tgsi_file_type ind_file;
int ind_index;
- uint ind_comp;
- uint ind_array;
+ unsigned ind_comp;
+ unsigned ind_array;
};
struct parsed_bracket *brackets)
{
const char *cur;
- uint uindex;
+ unsigned uindex;
memset(brackets, 0, sizeof(struct parsed_bracket));
}
struct parsed_dcl_bracket {
- uint first;
- uint last;
+ unsigned first;
+ unsigned last;
};
static bool
struct translate_ctx *ctx,
struct parsed_dcl_bracket *bracket)
{
- uint uindex;
+ unsigned uindex;
memset(bracket, 0, sizeof(struct parsed_dcl_bracket));
eat_opt_white( &ctx->cur );
eat_opt_white( &ctx->cur );
if (ctx->cur[0] == '.' && ctx->cur[1] == '.') {
- uint uindex;
+ unsigned uindex;
ctx->cur += 2;
eat_opt_white( &ctx->cur );
struct tgsi_full_dst_register *dst )
{
enum tgsi_file_type file;
- uint writemask;
+ unsigned writemask;
const char *cur;
struct parsed_bracket bracket[2];
int parsed_opt_brackets;
static bool
parse_optional_swizzle(
struct translate_ctx *ctx,
- uint *swizzle,
+ unsigned *swizzle,
bool *parsed_swizzle,
int components)
{
struct tgsi_full_src_register *src )
{
enum tgsi_file_type file;
- uint swizzle[4];
+ unsigned swizzle[4];
bool parsed_swizzle;
struct parsed_bracket bracket[2];
int parsed_opt_brackets;
struct tgsi_texture_offset *src )
{
enum tgsi_file_type file;
- uint swizzle[3];
+ unsigned swizzle[3];
bool parsed_swizzle;
struct parsed_bracket bracket;
bool has_label )
{
int i;
- uint saturate = 0;
- uint precise = 0;
+ unsigned saturate = 0;
+ unsigned precise = 0;
const struct tgsi_opcode_info *info;
struct tgsi_full_instruction inst;
const char *cur;
- uint advance;
+ unsigned advance;
inst = tgsi_default_full_instruction();
return false;
}
else {
- uint j;
+ unsigned j;
for (j = 0; j < TGSI_TEXTURE_COUNT; j++) {
if (str_match_nocase_whole( &ctx->cur, tgsi_texture_names[j] )) {
cur = ctx->cur;
eat_opt_white( &cur );
if (info->is_branch && *cur == ':') {
- uint target;
+ unsigned target;
cur++;
eat_opt_white( &cur );
&inst,
ctx->tokens_cur,
ctx->header,
- (uint) (ctx->tokens_end - ctx->tokens_cur) );
+ (unsigned) (ctx->tokens_end - ctx->tokens_cur) );
if (advance == 0)
return false;
ctx->tokens_cur += advance;
enum tgsi_file_type file;
struct parsed_dcl_bracket brackets[2];
int num_brackets;
- uint writemask;
+ unsigned writemask;
const char *cur, *cur2;
- uint advance;
+ unsigned advance;
bool is_vs_input;
if (!eat_white( &ctx->cur )) {
}
if (*cur == ',' && !is_vs_input) {
- uint i, j;
+ unsigned i, j;
cur++;
eat_opt_white( &cur );
for (i = 0; i < TGSI_SEMANTIC_COUNT; i++) {
if (str_match_nocase_whole(&cur, tgsi_semantic_names[i])) {
- uint index;
+ unsigned index;
cur2 = cur;
eat_opt_white( &cur2 );
cur++;
eat_opt_white(&cur);
if (str_match_nocase_whole(&cur, "STREAM")) {
- uint stream[4];
+ unsigned stream[4];
eat_opt_white(&cur);
if (*cur != '(') {
cur = ctx->cur;
eat_opt_white( &cur );
if (*cur == ',' && !is_vs_input) {
- uint i;
+ unsigned i;
cur++;
eat_opt_white( &cur );
cur = ctx->cur;
eat_opt_white( &cur );
if (*cur == ',' && !is_vs_input) {
- uint i;
+ unsigned i;
cur++;
eat_opt_white( &cur );
&decl,
ctx->tokens_cur,
ctx->header,
- (uint) (ctx->tokens_end - ctx->tokens_cur) );
+ (unsigned) (ctx->tokens_end - ctx->tokens_cur) );
if (advance == 0)
return false;
static bool parse_immediate( struct translate_ctx *ctx )
{
struct tgsi_full_immediate imm;
- uint advance;
- uint type;
+ unsigned advance;
+ unsigned type;
if (*ctx->cur == '[') {
- uint uindex;
+ unsigned uindex;
++ctx->cur;
&imm,
ctx->tokens_cur,
ctx->header,
- (uint) (ctx->tokens_end - ctx->tokens_cur) );
+ (unsigned) (ctx->tokens_end - ctx->tokens_cur) );
if (advance == 0)
return false;
ctx->tokens_cur += advance;
}
static bool
-parse_primitive( const char **pcur, uint *primitive )
+parse_primitive( const char **pcur, unsigned *primitive )
{
- uint i;
+ unsigned i;
for (i = 0; i < MESA_PRIM_COUNT; i++) {
const char *cur = *pcur;
}
static bool
-parse_fs_coord_origin( const char **pcur, uint *fs_coord_origin )
+parse_fs_coord_origin( const char **pcur, unsigned *fs_coord_origin )
{
- uint i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(tgsi_fs_coord_origin_names); i++) {
const char *cur = *pcur;
}
static bool
-parse_fs_coord_pixel_center( const char **pcur, uint *fs_coord_pixel_center )
+parse_fs_coord_pixel_center( const char **pcur, unsigned *fs_coord_pixel_center )
{
- uint i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(tgsi_fs_coord_pixel_center_names); i++) {
const char *cur = *pcur;
}
static bool
-parse_property_next_shader( const char **pcur, uint *next_shader )
+parse_property_next_shader( const char **pcur, unsigned *next_shader )
{
- uint i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(tgsi_processor_type_names); i++) {
const char *cur = *pcur;
{
struct tgsi_full_property prop;
enum tgsi_property_name property_name;
- uint values[8];
- uint advance;
+ unsigned values[8];
+ unsigned advance;
char id[64];
if (!eat_white( &ctx->cur )) {
&prop,
ctx->tokens_cur,
ctx->header,
- (uint) (ctx->tokens_end - ctx->tokens_cur) );
+ (unsigned) (ctx->tokens_end - ctx->tokens_cur) );
if (advance == 0)
return false;
ctx->tokens_cur += advance;
ctx->implied_array_size = 32;
while (*ctx->cur != '\0') {
- uint label_val = 0;
+ unsigned label_val = 0;
if (!eat_white( &ctx->cur )) {
report_error( ctx, "Syntax error" );
return false;
tgsi_text_translate(
const char *text,
struct tgsi_token *tokens,
- uint num_tokens )
+ unsigned num_tokens )
{
struct translate_ctx ctx = {0};
tgsi_text_translate(
const char *text,
struct tgsi_token *tokens,
- uint num_tokens );
+ unsigned num_tokens );
#if defined __cplusplus
}
*/
struct tgsi_token *
tgsi_transform_shader(const struct tgsi_token *tokens_in,
- uint initial_tokens_len,
+ unsigned initial_tokens_len,
struct tgsi_transform_context *ctx)
{
bool first_instruction = true;
#include "tgsi_text.h"
extern int tgsi_transform_foo( struct tgsi_token *tokens_out,
- uint max_tokens_out );
+ unsigned max_tokens_out );
/* This function exists only so that tgsi_text_translate() doesn't get
* magic-ed out of the libtgsi.a archive by the build system. Don't
*/
int
tgsi_transform_foo( struct tgsi_token *tokens_out,
- uint max_tokens_out )
+ unsigned max_tokens_out )
{
const char *text =
"FRAG\n"
const struct tgsi_full_property *prop);
struct tgsi_header *header;
- uint max_tokens_out;
+ unsigned max_tokens_out;
struct tgsi_token *tokens_out;
- uint ti;
+ unsigned ti;
bool fail;
};
extern struct tgsi_token *
tgsi_transform_shader(const struct tgsi_token *tokens_in,
- uint initial_tokens_len,
+ unsigned initial_tokens_len,
struct tgsi_transform_context *ctx);
struct two_side_transform_context
{
struct tgsi_transform_context base;
- uint num_temps;
- uint num_inputs;
- uint face_input; /**< index of the FACE input */
- uint front_color_input[2]; /**< INPUT regs */
+ unsigned num_temps;
+ unsigned num_inputs;
+ unsigned face_input; /**< index of the FACE input */
+ unsigned front_color_input[2]; /**< INPUT regs */
enum tgsi_interpolate_mode front_color_interp[2];/**< TGSI_INTERPOLATE_x */
- uint back_color_input[2]; /**< INPUT regs */
- uint new_colors[2]; /**< TEMP regs */
+ unsigned back_color_input[2]; /**< INPUT regs */
+ unsigned new_colors[2]; /**< TEMP regs */
};
struct two_side_transform_context *ts = two_side_transform_context(ctx);
struct tgsi_full_declaration decl;
struct tgsi_full_instruction inst;
- uint num_colors = 0;
- uint i;
+ unsigned num_colors = 0;
+ unsigned i;
/* Declare 0, 1 or 2 new BCOLOR inputs */
for (i = 0; i < 2; i++) {
struct two_side_transform_context *ts = two_side_transform_context(ctx);
const struct tgsi_opcode_info *info =
tgsi_get_opcode_info(inst->Instruction.Opcode);
- uint i, j;
+ unsigned i, j;
/* Look for src regs which reference the input color and replace
* them with the temp color.
tgsi_add_two_side(const struct tgsi_token *tokens_in)
{
struct two_side_transform_context transform;
- const uint num_new_tokens = 100; /* should be enough */
- const uint new_len = tgsi_num_tokens(tokens_in) + num_new_tokens;
+ const unsigned num_new_tokens = 100; /* should be enough */
+ const unsigned new_len = tgsi_num_tokens(tokens_in) + num_new_tokens;
/* setup transformation context */
memset(&transform, 0, sizeof(transform));
assert(index2D < PIPE_MAX_CONSTANT_BUFFERS);
if (decl->nr_constant_ranges < UREG_MAX_CONSTANT_RANGE) {
- uint i = decl->nr_constant_ranges++;
+ unsigned i = decl->nr_constant_ranges++;
decl->constant_range[i].first = first;
decl->constant_range[i].last = last;
struct hw_atomic_decl *decl = &ureg->hw_atomic_decls[buffer_id];
if (decl->nr_hw_atomic_ranges < UREG_MAX_HW_ATOMIC_RANGE) {
- uint i = decl->nr_hw_atomic_ranges++;
+ unsigned i = decl->nr_hw_atomic_ranges++;
decl->hw_atomic_range[i].first = first;
decl->hw_atomic_range[i].last = last;
enum tgsi_return_type return_type_w)
{
struct ureg_src reg = ureg_src_register(TGSI_FILE_SAMPLER_VIEW, index);
- uint i;
+ unsigned i;
for (i = 0; i < ureg->nr_sampler_views; i++) {
if (ureg->sampler_view[i].index == index) {
const unsigned *v,
unsigned nr )
{
- uint index;
- uint i;
+ unsigned index;
+ unsigned i;
if (ureg->nr_immediates + (nr + 3) / 4 > UREG_MAX_IMMEDIATE) {
set_bad(ureg);
ureg->immediate[i].nr = nr > 4 ? 4 : nr;
memcpy(ureg->immediate[i].value.u,
&v[(i - index) * 4],
- ureg->immediate[i].nr * sizeof(uint));
+ ureg->immediate[i].nr * sizeof(unsigned));
nr -= 4;
}
unsigned num_src)
{
union tgsi_any_token *out;
- uint count = 1;
+ unsigned count = 1;
struct ureg_emit_insn_result result;
validate( opcode, num_dst, num_src );
struct const_decl *decl = &ureg->const_decls[i];
if (decl->nr_constant_ranges) {
- uint j;
+ unsigned j;
for (j = 0; j < decl->nr_constant_ranges; j++) {
emit_decl_range2D(ureg,
struct hw_atomic_decl *decl = &ureg->hw_atomic_decls[i];
if (decl->nr_hw_atomic_ranges) {
- uint j;
+ unsigned j;
/* GLSL-to-TGSI generated HW atomic counters in order, and r600 depends
* on it.
ureg_create_with_screen(enum pipe_shader_type processor,
struct pipe_screen *screen)
{
- uint i;
+ unsigned i;
struct ureg_program *ureg = CALLOC_STRUCT( ureg_program );
if (!ureg)
goto no_ureg;
unsigned num_immediates)
{
struct write_vpos_context transform;
- const uint num_new_tokens = 1000; /* should be enough */
- const uint new_len = tgsi_num_tokens(tokens_in) + num_new_tokens;
+ const unsigned num_new_tokens = 1000; /* should be enough */
+ const unsigned new_len = tgsi_num_tokens(tokens_in) + num_new_tokens;
/* setup transformation context */
memset(&transform, 0, sizeof(transform));