i915g: replace "uint" with normal uint32_t.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11617>
This commit is contained in:
Emma Anholt 2021-06-27 14:43:58 -07:00
parent c786159186
commit 247cee92df
13 changed files with 133 additions and 125 deletions

View file

@ -97,8 +97,8 @@ struct i915_fragment_shader {
struct draw_fragment_shader *draw_data; struct draw_fragment_shader *draw_data;
uint *program; uint32_t *program;
uint program_len; uint32_t program_len;
/** /**
* constants introduced during translation. * constants introduced during translation.
@ -109,7 +109,7 @@ struct i915_fragment_shader {
* and doesn't require regenerating/changing the fragment program to * and doesn't require regenerating/changing the fragment program to
* shuffle constants around. * shuffle constants around.
*/ */
uint num_constants; uint32_t num_constants;
float constants[I915_MAX_CONSTANT][4]; float constants[I915_MAX_CONSTANT][4];
/** /**
@ -137,7 +137,7 @@ struct i915_state {
unsigned dynamic[I915_MAX_DYNAMIC]; unsigned dynamic[I915_MAX_DYNAMIC];
/** number of constants passed in through a constant buffer */ /** number of constants passed in through a constant buffer */
uint num_user_constants[PIPE_SHADER_TYPES]; uint32_t num_user_constants[PIPE_SHADER_TYPES];
/* texture sampler state */ /* texture sampler state */
unsigned sampler[I915_TEX_UNITS][3]; unsigned sampler[I915_TEX_UNITS][3];

View file

@ -50,37 +50,37 @@ struct i915_fp_compile {
boolean used_constants[I915_MAX_CONSTANT]; boolean used_constants[I915_MAX_CONSTANT];
/** maps TGSI immediate index to constant slot */ /** maps TGSI immediate index to constant slot */
uint num_immediates; uint32_t num_immediates;
uint immediates_map[I915_MAX_CONSTANT]; uint32_t immediates_map[I915_MAX_CONSTANT];
float immediates[I915_MAX_CONSTANT][4]; float immediates[I915_MAX_CONSTANT][4];
boolean first_instruction; boolean first_instruction;
uint declarations[I915_PROGRAM_SIZE]; uint32_t declarations[I915_PROGRAM_SIZE];
uint program[I915_PROGRAM_SIZE]; uint32_t program[I915_PROGRAM_SIZE];
uint *csr; /**< Cursor, points into program. */ uint32_t *csr; /**< Cursor, points into program. */
uint *decl; /**< Cursor, points into declarations. */ uint32_t *decl; /**< Cursor, points into declarations. */
uint decl_s; /**< flags for which s regs need to be decl'd */ uint32_t decl_s; /**< flags for which s regs need to be decl'd */
uint decl_t; /**< flags for which t regs need to be decl'd */ uint32_t decl_t; /**< flags for which t regs need to be decl'd */
uint temp_flag; /**< Tracks temporary regs which are in use */ uint32_t temp_flag; /**< Tracks temporary regs which are in use */
uint utemp_flag; /**< Tracks TYPE_U temporary regs which are in use */ uint32_t utemp_flag; /**< Tracks TYPE_U temporary regs which are in use */
uint register_phases[I915_MAX_TEMPORARY]; uint32_t register_phases[I915_MAX_TEMPORARY];
uint nr_tex_indirect; uint32_t nr_tex_indirect;
uint nr_tex_insn; uint32_t nr_tex_insn;
uint nr_alu_insn; uint32_t nr_alu_insn;
uint nr_decl_insn; uint32_t nr_decl_insn;
bool log_program_errors; bool log_program_errors;
boolean error; /**< Set if i915_program_error() is called */ boolean error; /**< Set if i915_program_error() is called */
uint NumNativeInstructions; uint32_t NumNativeInstructions;
uint NumNativeAluInstructions; uint32_t NumNativeAluInstructions;
uint NumNativeTexInstructions; uint32_t NumNativeTexInstructions;
uint NumNativeTexIndirections; uint32_t NumNativeTexIndirections;
}; };
/* Having zero and one in here makes the definition of swizzle a lot /* Having zero and one in here makes the definition of swizzle a lot
@ -129,7 +129,7 @@ struct i915_fp_compile {
/* One neat thing about the UREG representation: /* One neat thing about the UREG representation:
*/ */
static inline int static inline int
swizzle(int reg, uint x, uint y, uint z, uint w) swizzle(int reg, uint32_t x, uint32_t y, uint32_t z, uint32_t w)
{ {
assert(x <= SRC_ONE); assert(x <= SRC_ONE);
assert(y <= SRC_ONE); assert(y <= SRC_ONE);
@ -180,28 +180,31 @@ swizzle(int reg, uint x, uint y, uint z, uint w)
extern void i915_translate_fragment_program(struct i915_context *i915, extern void i915_translate_fragment_program(struct i915_context *i915,
struct i915_fragment_shader *fs); struct i915_fragment_shader *fs);
extern uint i915_get_temp(struct i915_fp_compile *p); extern uint32_t i915_get_temp(struct i915_fp_compile *p);
extern uint i915_get_utemp(struct i915_fp_compile *p); extern uint32_t i915_get_utemp(struct i915_fp_compile *p);
extern void i915_release_utemps(struct i915_fp_compile *p); extern void i915_release_utemps(struct i915_fp_compile *p);
extern uint i915_emit_texld(struct i915_fp_compile *p, uint dest, uint destmask, extern uint32_t i915_emit_texld(struct i915_fp_compile *p, uint32_t dest,
uint sampler, uint coord, uint op, uint num_coord); uint32_t destmask, uint32_t sampler,
uint32_t coord, uint32_t op,
uint32_t num_coord);
extern uint i915_emit_arith(struct i915_fp_compile *p, uint op, uint dest, extern uint32_t i915_emit_arith(struct i915_fp_compile *p, uint32_t op,
uint mask, uint saturate, uint src0, uint src1, uint32_t dest, uint32_t mask, uint32_t saturate,
uint src2); uint32_t src0, uint32_t src1, uint32_t src2);
extern uint i915_emit_decl(struct i915_fp_compile *p, uint type, uint nr, extern uint32_t i915_emit_decl(struct i915_fp_compile *p, uint32_t type,
uint d0_flags); uint32_t nr, uint32_t d0_flags);
extern uint i915_emit_const1f(struct i915_fp_compile *p, float c0); extern uint32_t i915_emit_const1f(struct i915_fp_compile *p, float c0);
extern uint i915_emit_const2f(struct i915_fp_compile *p, float c0, float c1); extern uint32_t i915_emit_const2f(struct i915_fp_compile *p, float c0,
float c1);
extern uint i915_emit_const4fv(struct i915_fp_compile *p, const float *c); extern uint32_t i915_emit_const4fv(struct i915_fp_compile *p, const float *c);
extern uint i915_emit_const4f(struct i915_fp_compile *p, float c0, float c1, extern uint32_t i915_emit_const4f(struct i915_fp_compile *p, float c0, float c1,
float c2, float c3); float c2, float c3);
/*====================================================================== /*======================================================================
* i915_fpc_translate.c * i915_fpc_translate.c
@ -284,6 +287,6 @@ extern struct i915_token_list *i915_optimize(const struct tgsi_token *tokens);
extern void i915_optimize_free(struct i915_token_list *tokens); extern void i915_optimize_free(struct i915_token_list *tokens);
extern uint i915_num_coords(uint tex); extern uint32_t i915_num_coords(uint32_t tex);
#endif #endif

View file

@ -73,9 +73,10 @@ i915_release_utemps(struct i915_fp_compile *p)
} }
uint uint
i915_emit_decl(struct i915_fp_compile *p, uint type, uint nr, uint d0_flags) i915_emit_decl(struct i915_fp_compile *p, uint32_t type, uint32_t nr,
uint32_t d0_flags)
{ {
uint reg = UREG(type, nr); uint32_t reg = UREG(type, nr);
if (type == REG_TYPE_T) { if (type == REG_TYPE_T) {
if (p->decl_t & (1 << nr)) if (p->decl_t & (1 << nr))
@ -102,11 +103,12 @@ i915_emit_decl(struct i915_fp_compile *p, uint type, uint nr, uint d0_flags)
} }
uint uint
i915_emit_arith(struct i915_fp_compile *p, uint op, uint dest, uint mask, i915_emit_arith(struct i915_fp_compile *p, uint32_t op, uint32_t dest,
uint saturate, uint src0, uint src1, uint src2) uint32_t mask, uint32_t saturate, uint32_t src0, uint32_t src1,
uint32_t src2)
{ {
uint c[3]; uint32_t c[3];
uint nr_const = 0; uint32_t nr_const = 0;
assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST); assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)); dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest));
@ -125,7 +127,7 @@ i915_emit_arith(struct i915_fp_compile *p, uint op, uint dest, uint mask,
* this. * this.
*/ */
if (nr_const > 1) { if (nr_const > 1) {
uint s[3], first, i, old_utemp_flag; uint32_t s[3], first, i, old_utemp_flag;
s[0] = src0; s[0] = src0;
s[1] = src1; s[1] = src1;
@ -135,7 +137,7 @@ i915_emit_arith(struct i915_fp_compile *p, uint op, uint dest, uint mask,
first = GET_UREG_NR(s[c[0]]); first = GET_UREG_NR(s[c[0]]);
for (i = 1; i < nr_const; i++) { for (i = 1; i < nr_const; i++) {
if (GET_UREG_NR(s[c[i]]) != first) { if (GET_UREG_NR(s[c[i]]) != first) {
uint tmp = i915_get_utemp(p); uint32_t tmp = i915_get_utemp(p);
i915_emit_arith(p, A0_MOV, tmp, A0_DEST_CHANNEL_ALL, 0, s[c[i]], 0, i915_emit_arith(p, A0_MOV, tmp, A0_DEST_CHANNEL_ALL, 0, s[c[i]], 0,
0); 0);
@ -172,13 +174,14 @@ i915_emit_arith(struct i915_fp_compile *p, uint op, uint dest, uint mask,
* \param opcode the instruction opcode * \param opcode the instruction opcode
*/ */
uint uint
i915_emit_texld(struct i915_fp_compile *p, uint dest, uint destmask, i915_emit_texld(struct i915_fp_compile *p, uint32_t dest, uint32_t destmask,
uint sampler, uint coord, uint opcode, uint num_coord) uint32_t sampler, uint32_t coord, uint32_t opcode,
uint32_t num_coord)
{ {
const uint k = UREG(GET_UREG_TYPE(coord), GET_UREG_NR(coord)); const uint32_t k = UREG(GET_UREG_TYPE(coord), GET_UREG_NR(coord));
int temp = -1; int temp = -1;
uint ignore = 0; uint32_t ignore = 0;
/* Eliminate the useless texture coordinates. Otherwise we end up generating /* Eliminate the useless texture coordinates. Otherwise we end up generating
* a swizzle for no reason below. */ * a swizzle for no reason below. */
@ -201,7 +204,7 @@ i915_emit_texld(struct i915_fp_compile *p, uint dest, uint destmask,
/* texcoord is swizzled or negated. Need to allocate a new temporary /* texcoord is swizzled or negated. Need to allocate a new temporary
* register (a utemp / unpreserved temp) won't do. * register (a utemp / unpreserved temp) won't do.
*/ */
uint tempReg; uint32_t tempReg;
temp = i915_get_temp(p); /* get temp reg index */ temp = i915_get_temp(p); /* get temp reg index */
tempReg = UREG(REG_TYPE_R, temp); /* make i915 register */ tempReg = UREG(REG_TYPE_R, temp); /* make i915 register */
@ -219,7 +222,7 @@ i915_emit_texld(struct i915_fp_compile *p, uint dest, uint destmask,
*/ */
if (destmask != A0_DEST_CHANNEL_ALL) { if (destmask != A0_DEST_CHANNEL_ALL) {
/* if not writing to XYZW... */ /* if not writing to XYZW... */
uint tmp = i915_get_utemp(p); uint32_t tmp = i915_get_utemp(p);
i915_emit_texld(p, tmp, A0_DEST_CHANNEL_ALL, sampler, coord, opcode, i915_emit_texld(p, tmp, A0_DEST_CHANNEL_ALL, sampler, coord, opcode,
num_coord); num_coord);
i915_emit_arith(p, A0_MOV, dest, destmask, 0, tmp, 0, 0); i915_emit_arith(p, A0_MOV, dest, destmask, 0, tmp, 0, 0);

View file

@ -399,7 +399,7 @@ i915_tex_mask(union i915_full_token *instr)
} }
static boolean static boolean
target_is_texture2d(uint tex) target_is_texture2d(uint32_t tex)
{ {
switch (tex) { switch (tex) {
case TGSI_TEXTURE_2D: case TGSI_TEXTURE_2D:

View file

@ -97,7 +97,7 @@ negate(int reg, int x, int y, int z, int w)
static void static void
i915_use_passthrough_shader(struct i915_fragment_shader *fs) i915_use_passthrough_shader(struct i915_fragment_shader *fs)
{ {
fs->program = (uint *)MALLOC(sizeof(passthrough_program)); fs->program = (uint32_t *)MALLOC(sizeof(passthrough_program));
if (fs->program) { if (fs->program) {
memcpy(fs->program, passthrough_program, sizeof(passthrough_program)); memcpy(fs->program, passthrough_program, sizeof(passthrough_program));
fs->program_len = ARRAY_SIZE(passthrough_program); fs->program_len = ARRAY_SIZE(passthrough_program);
@ -144,8 +144,8 @@ src_vector(struct i915_fp_compile *p,
const struct i915_full_src_register *source, const struct i915_full_src_register *source,
struct i915_fragment_shader *fs) struct i915_fragment_shader *fs)
{ {
uint index = source->Register.Index; uint32_t index = source->Register.Index;
uint src = 0, sem_name, sem_ind; uint32_t src = 0, sem_name, sem_ind;
switch (source->Register.File) { switch (source->Register.File) {
case TGSI_FILE_TEMPORARY: case TGSI_FILE_TEMPORARY:
@ -228,7 +228,7 @@ src_vector(struct i915_fp_compile *p,
/* No HW abs flag, so we have to max with the negation. */ /* No HW abs flag, so we have to max with the negation. */
if (source->Register.Absolute) { if (source->Register.Absolute) {
uint tmp = i915_get_utemp(p); uint32_t tmp = i915_get_utemp(p);
i915_emit_arith(p, A0_MAX, tmp, A0_DEST_CHANNEL_ALL, 0, src, i915_emit_arith(p, A0_MAX, tmp, A0_DEST_CHANNEL_ALL, 0, src,
negate(src, 1, 1, 1, 1), 0); negate(src, 1, 1, 1, 1), 0);
src = tmp; src = tmp;
@ -254,7 +254,7 @@ get_result_vector(struct i915_fp_compile *p,
{ {
switch (dest->Register.File) { switch (dest->Register.File) {
case TGSI_FILE_OUTPUT: { case TGSI_FILE_OUTPUT: {
uint sem_name = uint32_t sem_name =
p->shader->info.output_semantic_name[dest->Register.Index]; p->shader->info.output_semantic_name[dest->Register.Index];
switch (sem_name) { switch (sem_name) {
case TGSI_SEMANTIC_POSITION: case TGSI_SEMANTIC_POSITION:
@ -280,8 +280,8 @@ get_result_vector(struct i915_fp_compile *p,
static uint static uint
get_result_flags(const struct i915_full_instruction *inst) get_result_flags(const struct i915_full_instruction *inst)
{ {
const uint writeMask = inst->Dst[0].Register.WriteMask; const uint32_t writeMask = inst->Dst[0].Register.WriteMask;
uint flags = 0x0; uint32_t flags = 0x0;
if (inst->Instruction.Saturate) if (inst->Instruction.Saturate)
flags |= A0_DEST_SATURATE; flags |= A0_DEST_SATURATE;
@ -302,7 +302,7 @@ get_result_flags(const struct i915_full_instruction *inst)
* Convert TGSI_TEXTURE_x token to DO_SAMPLE_TYPE_x token * Convert TGSI_TEXTURE_x token to DO_SAMPLE_TYPE_x token
*/ */
static uint static uint
translate_tex_src_target(struct i915_fp_compile *p, uint tex) translate_tex_src_target(struct i915_fp_compile *p, uint32_t tex)
{ {
switch (tex) { switch (tex) {
case TGSI_TEXTURE_SHADOW1D: case TGSI_TEXTURE_SHADOW1D:
@ -336,7 +336,7 @@ translate_tex_src_target(struct i915_fp_compile *p, uint tex)
* Return the number of coords needed to access a given TGSI_TEXTURE_* * Return the number of coords needed to access a given TGSI_TEXTURE_*
*/ */
uint uint
i915_num_coords(uint tex) i915_num_coords(uint32_t tex)
{ {
switch (tex) { switch (tex) {
case TGSI_TEXTURE_SHADOW1D: case TGSI_TEXTURE_SHADOW1D:
@ -364,13 +364,13 @@ i915_num_coords(uint tex)
*/ */
static void static void
emit_tex(struct i915_fp_compile *p, const struct i915_full_instruction *inst, emit_tex(struct i915_fp_compile *p, const struct i915_full_instruction *inst,
uint opcode, struct i915_fragment_shader *fs) uint32_t opcode, struct i915_fragment_shader *fs)
{ {
uint texture = inst->Texture.Texture; uint32_t texture = inst->Texture.Texture;
uint unit = inst->Src[1].Register.Index; uint32_t unit = inst->Src[1].Register.Index;
uint tex = translate_tex_src_target(p, texture); uint32_t tex = translate_tex_src_target(p, texture);
uint sampler = i915_emit_decl(p, REG_TYPE_S, unit, tex); uint32_t sampler = i915_emit_decl(p, REG_TYPE_S, unit, tex);
uint coord = src_vector(p, &inst->Src[0], fs); uint32_t coord = src_vector(p, &inst->Src[0], fs);
i915_emit_texld(p, get_result_vector(p, &inst->Dst[0]), i915_emit_texld(p, get_result_vector(p, &inst->Dst[0]),
get_result_flags(inst), sampler, coord, opcode, get_result_flags(inst), sampler, coord, opcode,
@ -384,10 +384,10 @@ emit_tex(struct i915_fp_compile *p, const struct i915_full_instruction *inst,
*/ */
static void static void
emit_simple_arith(struct i915_fp_compile *p, emit_simple_arith(struct i915_fp_compile *p,
const struct i915_full_instruction *inst, uint opcode, const struct i915_full_instruction *inst, uint32_t opcode,
uint numArgs, struct i915_fragment_shader *fs) uint32_t numArgs, struct i915_fragment_shader *fs)
{ {
uint arg1, arg2, arg3; uint32_t arg1, arg2, arg3;
assert(numArgs <= 3); assert(numArgs <= 3);
@ -402,8 +402,9 @@ emit_simple_arith(struct i915_fp_compile *p,
/** As above, but swap the first two src regs */ /** As above, but swap the first two src regs */
static void static void
emit_simple_arith_swap2(struct i915_fp_compile *p, emit_simple_arith_swap2(struct i915_fp_compile *p,
const struct i915_full_instruction *inst, uint opcode, const struct i915_full_instruction *inst,
uint numArgs, struct i915_fragment_shader *fs) uint32_t opcode, uint32_t numArgs,
struct i915_fragment_shader *fs)
{ {
struct i915_full_instruction inst2; struct i915_full_instruction inst2;
@ -432,8 +433,8 @@ i915_translate_instruction(struct i915_fp_compile *p,
const struct i915_full_instruction *inst, const struct i915_full_instruction *inst,
struct i915_fragment_shader *fs) struct i915_fragment_shader *fs)
{ {
uint src0, src1, src2, flags; uint32_t src0, src1, src2, flags;
uint tmp = 0; uint32_t tmp = 0;
switch (inst->Instruction.Opcode) { switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_ADD: case TGSI_OPCODE_ADD:
@ -844,7 +845,7 @@ i915_translate_token(struct i915_fp_compile *p,
case TGSI_TOKEN_TYPE_DECLARATION: case TGSI_TOKEN_TYPE_DECLARATION:
if (token->FullDeclaration.Declaration.File == TGSI_FILE_CONSTANT) { if (token->FullDeclaration.Declaration.File == TGSI_FILE_CONSTANT) {
uint i; uint32_t i;
for (i = token->FullDeclaration.Range.First; for (i = token->FullDeclaration.Range.First;
i <= i <=
MIN2(token->FullDeclaration.Range.Last, I915_MAX_CONSTANT - 1); MIN2(token->FullDeclaration.Range.Last, I915_MAX_CONSTANT - 1);
@ -854,7 +855,7 @@ i915_translate_token(struct i915_fp_compile *p,
} }
} else if (token->FullDeclaration.Declaration.File == } else if (token->FullDeclaration.Declaration.File ==
TGSI_FILE_TEMPORARY) { TGSI_FILE_TEMPORARY) {
uint i; uint32_t i;
for (i = token->FullDeclaration.Range.First; for (i = token->FullDeclaration.Range.First;
i <= token->FullDeclaration.Range.Last; i++) { i <= token->FullDeclaration.Range.Last; i++) {
if (i >= I915_MAX_TEMPORARY) if (i >= I915_MAX_TEMPORARY)
@ -868,8 +869,8 @@ i915_translate_token(struct i915_fp_compile *p,
case TGSI_TOKEN_TYPE_IMMEDIATE: { case TGSI_TOKEN_TYPE_IMMEDIATE: {
const struct tgsi_full_immediate *imm = &token->FullImmediate; const struct tgsi_full_immediate *imm = &token->FullImmediate;
const uint pos = p->num_immediates++; const uint32_t pos = p->num_immediates++;
uint j; uint32_t j;
assert(imm->Immediate.NrTokens <= 4 + 1); assert(imm->Immediate.NrTokens <= 4 + 1);
for (j = 0; j < imm->Immediate.NrTokens - 1; j++) { for (j = 0; j < imm->Immediate.NrTokens - 1; j++) {
p->immediates[pos][j] = imm->u[j].Float; p->immediates[pos][j] = imm->u[j].Float;
@ -879,7 +880,7 @@ i915_translate_token(struct i915_fp_compile *p,
case TGSI_TOKEN_TYPE_INSTRUCTION: case TGSI_TOKEN_TYPE_INSTRUCTION:
if (p->first_instruction) { if (p->first_instruction) {
/* resolve location of immediates */ /* resolve location of immediates */
uint i, j; uint32_t i, j;
for (i = 0; i < p->num_immediates; i++) { for (i = 0; i < p->num_immediates; i++) {
/* find constant slot for this immediate */ /* find constant slot for this immediate */
for (j = 0; j < I915_MAX_CONSTANT; j++) { for (j = 0; j < I915_MAX_CONSTANT; j++) {
@ -1017,7 +1018,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
assert(!ifs->program); assert(!ifs->program);
ifs->program_len = decl_size + program_size; ifs->program_len = decl_size + program_size;
ifs->program = (uint *)MALLOC(ifs->program_len * sizeof(uint)); ifs->program = (uint32_t *)MALLOC(ifs->program_len * sizeof(uint));
memcpy(ifs->program, p->declarations, decl_size * sizeof(uint)); memcpy(ifs->program, p->declarations, decl_size * sizeof(uint));
memcpy(&ifs->program[decl_size], p->program, program_size * sizeof(uint)); memcpy(&ifs->program[decl_size], p->program, program_size * sizeof(uint));
} }
@ -1039,7 +1040,7 @@ i915_fixup_depth_write(struct i915_fp_compile *p)
if (p->shader->info.output_semantic_name[i] != TGSI_SEMANTIC_POSITION) if (p->shader->info.output_semantic_name[i] != TGSI_SEMANTIC_POSITION)
continue; continue;
const uint depth = UREG(REG_TYPE_OD, 0); const uint32_t depth = UREG(REG_TYPE_OD, 0);
i915_emit_arith(p, A0_MOV, /* opcode */ i915_emit_arith(p, A0_MOV, /* opcode */
depth, /* dest reg */ depth, /* dest reg */

View file

@ -64,13 +64,13 @@ static inline void
emit_hw_vertex(struct i915_context *i915, const struct vertex_header *vertex) emit_hw_vertex(struct i915_context *i915, const struct vertex_header *vertex)
{ {
const struct vertex_info *vinfo = &i915->current.vertex_info; const struct vertex_info *vinfo = &i915->current.vertex_info;
uint i; uint32_t i;
uint count = 0; /* for debug/sanity */ uint32_t count = 0; /* for debug/sanity */
assert(!i915->dirty); assert(!i915->dirty);
for (i = 0; i < vinfo->num_attribs; i++) { for (i = 0; i < vinfo->num_attribs; i++) {
const uint j = vinfo->attrib[i].src_index; const uint32_t j = vinfo->attrib[i].src_index;
const float *attrib = vertex->data[j]; const float *attrib = vertex->data[j];
switch (vinfo->attrib[i].emit) { switch (vinfo->attrib[i].emit) {
case EMIT_1F: case EMIT_1F:

View file

@ -377,7 +377,7 @@ i915_vbuf_render_set_primitive(struct vbuf_render *render,
*/ */
static void static void
draw_arrays_generate_indices(struct vbuf_render *render, unsigned start, draw_arrays_generate_indices(struct vbuf_render *render, unsigned start,
uint nr, unsigned type) uint32_t nr, unsigned type)
{ {
struct i915_vbuf_render *i915_render = i915_vbuf_render(render); struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
struct i915_context *i915 = i915_render->i915; struct i915_context *i915 = i915_render->i915;
@ -419,7 +419,7 @@ draw_arrays_generate_indices(struct vbuf_render *render, unsigned start,
} }
static unsigned static unsigned
draw_arrays_calc_nr_indices(uint nr, unsigned type) draw_arrays_calc_nr_indices(uint32_t nr, unsigned type)
{ {
switch (type) { switch (type) {
case 0: case 0:
@ -440,7 +440,7 @@ draw_arrays_calc_nr_indices(uint nr, unsigned type)
} }
static void static void
draw_arrays_fallback(struct vbuf_render *render, unsigned start, uint nr) draw_arrays_fallback(struct vbuf_render *render, unsigned start, uint32_t nr)
{ {
struct i915_vbuf_render *i915_render = i915_vbuf_render(render); struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
struct i915_context *i915 = i915_render->i915; struct i915_context *i915 = i915_render->i915;
@ -483,7 +483,7 @@ out:
static void static void
i915_vbuf_render_draw_arrays(struct vbuf_render *render, unsigned start, i915_vbuf_render_draw_arrays(struct vbuf_render *render, unsigned start,
uint nr) uint32_t nr)
{ {
struct i915_vbuf_render *i915_render = i915_vbuf_render(render); struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
struct i915_context *i915 = i915_render->i915; struct i915_context *i915 = i915_render->i915;
@ -530,7 +530,7 @@ out:
*/ */
static void static void
draw_generate_indices(struct vbuf_render *render, const ushort *indices, draw_generate_indices(struct vbuf_render *render, const ushort *indices,
uint nr_indices, unsigned type) uint32_t nr_indices, unsigned type)
{ {
struct i915_vbuf_render *i915_render = i915_vbuf_render(render); struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
struct i915_context *i915 = i915_render->i915; struct i915_context *i915 = i915_render->i915;
@ -574,7 +574,7 @@ draw_generate_indices(struct vbuf_render *render, const ushort *indices,
} }
static unsigned static unsigned
draw_calc_nr_indices(uint nr_indices, unsigned type) draw_calc_nr_indices(uint32_t nr_indices, unsigned type)
{ {
switch (type) { switch (type) {
case 0: case 0:
@ -596,7 +596,7 @@ draw_calc_nr_indices(uint nr_indices, unsigned type)
static void static void
i915_vbuf_render_draw_elements(struct vbuf_render *render, i915_vbuf_render_draw_elements(struct vbuf_render *render,
const ushort *indices, uint nr_indices) const ushort *indices, uint32_t nr_indices)
{ {
struct i915_vbuf_render *i915_render = i915_vbuf_render(render); struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
struct i915_context *i915 = i915_render->i915; struct i915_context *i915 = i915_render->i915;

View file

@ -52,7 +52,7 @@ i915_resource_destroy(struct pipe_screen *screen,
} else { } else {
struct i915_texture *tex = i915_texture(resource); struct i915_texture *tex = i915_texture(resource);
struct i915_winsys *iws = i915_screen(screen)->iws; struct i915_winsys *iws = i915_screen(screen)->iws;
uint i; uint32_t i;
if (tex->buffer) if (tex->buffer)
iws->buffer_destroy(iws, tex->buffer); iws->buffer_destroy(iws, tex->buffer);

View file

@ -466,7 +466,7 @@ i915_is_format_supported(struct pipe_screen *screen, enum pipe_format format,
PIPE_FORMAT_NONE /* list terminator */ PIPE_FORMAT_NONE /* list terminator */
}; };
const enum pipe_format *list; const enum pipe_format *list;
uint i; uint32_t i;
if (sample_count > 1) if (sample_count > 1)
return false; return false;

View file

@ -613,7 +613,7 @@ i915_delete_vs_state(struct pipe_context *pipe, void *shader)
static void static void
i915_set_constant_buffer(struct pipe_context *pipe, i915_set_constant_buffer(struct pipe_context *pipe,
enum pipe_shader_type shader, uint index, enum pipe_shader_type shader, uint32_t index,
bool take_ownership, bool take_ownership,
const struct pipe_constant_buffer *cb) const struct pipe_constant_buffer *cb)
{ {
@ -688,7 +688,7 @@ i915_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
return; return;
} }
struct i915_context *i915 = i915_context(pipe); struct i915_context *i915 = i915_context(pipe);
uint i; uint32_t i;
assert(num <= PIPE_MAX_SAMPLERS); assert(num <= PIPE_MAX_SAMPLERS);

View file

@ -57,7 +57,7 @@ calculate_vertex_layout(struct i915_context *i915)
const struct i915_fragment_shader *fs = i915->fs; const struct i915_fragment_shader *fs = i915->fs;
struct vertex_info vinfo; struct vertex_info vinfo;
boolean texCoords[I915_TEX_UNITS], colors[2], fog, needW, face; boolean texCoords[I915_TEX_UNITS], colors[2], fog, needW, face;
uint i; uint32_t i;
int src; int src;
memset(texCoords, 0, sizeof(texCoords)); memset(texCoords, 0, sizeof(texCoords));
@ -70,7 +70,7 @@ calculate_vertex_layout(struct i915_context *i915)
for (i = 0; i < fs->info.num_inputs; i++) { for (i = 0; i < fs->info.num_inputs; i++) {
switch (fs->info.input_semantic_name[i]) { switch (fs->info.input_semantic_name[i]) {
case TGSI_SEMANTIC_POSITION: { case TGSI_SEMANTIC_POSITION: {
uint unit = I915_SEMANTIC_POS; uint32_t unit = I915_SEMANTIC_POS;
texCoords[find_mapping(fs, unit)] = TRUE; texCoords[find_mapping(fs, unit)] = TRUE;
} break; } break;
case TGSI_SEMANTIC_COLOR: case TGSI_SEMANTIC_COLOR:
@ -79,7 +79,7 @@ calculate_vertex_layout(struct i915_context *i915)
break; break;
case TGSI_SEMANTIC_GENERIC: { case TGSI_SEMANTIC_GENERIC: {
/* texcoords/varyings/other generic */ /* texcoords/varyings/other generic */
uint unit = fs->info.input_semantic_index[i]; uint32_t unit = fs->info.input_semantic_index[i];
texCoords[find_mapping(fs, unit)] = TRUE; texCoords[find_mapping(fs, unit)] = TRUE;
needW = TRUE; needW = TRUE;
@ -135,7 +135,7 @@ calculate_vertex_layout(struct i915_context *i915)
/* texcoords/varyings */ /* texcoords/varyings */
for (i = 0; i < I915_TEX_UNITS; i++) { for (i = 0; i < I915_TEX_UNITS; i++) {
uint hwtc; uint32_t hwtc;
if (texCoords[i]) { if (texCoords[i]) {
hwtc = TEXCOORDFMT_4D; hwtc = TEXCOORDFMT_4D;
if (fs->generic_mapping[i] == I915_SEMANTIC_POS) { if (fs->generic_mapping[i] == I915_SEMANTIC_POS) {
@ -154,7 +154,7 @@ calculate_vertex_layout(struct i915_context *i915)
/* front/back face */ /* front/back face */
if (face) { if (face) {
uint slot = find_mapping(fs, I915_SEMANTIC_FACE); uint32_t slot = find_mapping(fs, I915_SEMANTIC_FACE);
debug_printf("Front/back face is broken\n"); debug_printf("Front/back face is broken\n");
/* XXX Because of limitations in the draw module, currently src will be 0 /* XXX Because of limitations in the draw module, currently src will be 0
* for SEMANTIC_FACE, so this aliases to POS. We need to fix in the draw * for SEMANTIC_FACE, so this aliases to POS. We need to fix in the draw

View file

@ -117,7 +117,7 @@ validate_immediate(struct i915_context *i915, unsigned *batch_space)
} }
static void static void
emit_immediate_s5(struct i915_context *i915, uint imm) emit_immediate_s5(struct i915_context *i915, uint32_t imm)
{ {
struct i915_surface *surf = i915_surface(i915->framebuffer.cbufs[0]); struct i915_surface *surf = i915_surface(i915->framebuffer.cbufs[0]);
@ -241,8 +241,8 @@ emit_static(struct i915_context *i915)
static void static void
validate_map(struct i915_context *i915, unsigned *batch_space) validate_map(struct i915_context *i915, unsigned *batch_space)
{ {
const uint enabled = i915->current.sampler_enable_flags; const uint32_t enabled = i915->current.sampler_enable_flags;
uint unit; uint32_t unit;
struct i915_texture *tex; struct i915_texture *tex;
*batch_space = i915->current.sampler_enable_nr *batch_space = i915->current.sampler_enable_nr
@ -260,11 +260,11 @@ validate_map(struct i915_context *i915, unsigned *batch_space)
static void static void
emit_map(struct i915_context *i915) emit_map(struct i915_context *i915)
{ {
const uint nr = i915->current.sampler_enable_nr; const uint32_t nr = i915->current.sampler_enable_nr;
if (nr) { if (nr) {
const uint enabled = i915->current.sampler_enable_flags; const uint32_t enabled = i915->current.sampler_enable_flags;
uint unit; uint32_t unit;
uint count = 0; uint32_t count = 0;
OUT_BATCH(_3DSTATE_MAP_STATE | (3 * nr)); OUT_BATCH(_3DSTATE_MAP_STATE | (3 * nr));
OUT_BATCH(enabled); OUT_BATCH(enabled);
for (unit = 0; unit < I915_TEX_UNITS; unit++) { for (unit = 0; unit < I915_TEX_UNITS; unit++) {
@ -329,25 +329,25 @@ emit_constants(struct i915_context *i915)
/* Collate the user-defined constants with the fragment shader's /* Collate the user-defined constants with the fragment shader's
* immediates according to the constant_flags[] array. * immediates according to the constant_flags[] array.
*/ */
const uint nr = i915->fs->num_constants; const uint32_t nr = i915->fs->num_constants;
assert(nr < I915_MAX_CONSTANT); assert(nr < I915_MAX_CONSTANT);
if (nr) { if (nr) {
uint i; uint32_t i;
OUT_BATCH(_3DSTATE_PIXEL_SHADER_CONSTANTS | (nr * 4)); OUT_BATCH(_3DSTATE_PIXEL_SHADER_CONSTANTS | (nr * 4));
OUT_BATCH((1 << nr) - 1); OUT_BATCH((1 << nr) - 1);
for (i = 0; i < nr; i++) { for (i = 0; i < nr; i++) {
const uint *c; const uint32_t *c;
if (i915->fs->constant_flags[i] == I915_CONSTFLAG_USER) { if (i915->fs->constant_flags[i] == I915_CONSTFLAG_USER) {
/* grab user-defined constant */ /* grab user-defined constant */
c = c = (uint32_t *)i915_buffer(i915->constants[PIPE_SHADER_FRAGMENT])
(uint *)i915_buffer(i915->constants[PIPE_SHADER_FRAGMENT])->data; ->data;
c += 4 * i; c += 4 * i;
} else { } else {
/* emit program constant */ /* emit program constant */
c = (uint *)i915->fs->constants[i]; c = (uint32_t *)i915->fs->constants[i];
} }
#if 0 /* debug */ #if 0 /* debug */
{ {

View file

@ -57,10 +57,10 @@
* changes. * changes.
*/ */
static void update_map(struct i915_context *i915, uint unit, static void update_map(struct i915_context *i915, uint32_t unit,
const struct i915_texture *tex, const struct i915_texture *tex,
const struct i915_sampler_state *sampler, const struct i915_sampler_state *sampler,
const struct pipe_sampler_view *view, uint state[3]); const struct pipe_sampler_view *view, uint32_t state[3]);
/*********************************************************************** /***********************************************************************
* Samplers * Samplers
@ -75,7 +75,7 @@ static void update_map(struct i915_context *i915, uint unit,
* \param state returns the 3 words of compute state * \param state returns the 3 words of compute state
*/ */
static void static void
update_sampler(struct i915_context *i915, uint unit, update_sampler(struct i915_context *i915, uint32_t unit,
const struct i915_sampler_state *sampler, const struct i915_sampler_state *sampler,
const struct i915_texture *tex, unsigned state[3]) const struct i915_texture *tex, unsigned state[3])
{ {
@ -141,7 +141,7 @@ update_sampler(struct i915_context *i915, uint unit,
static void static void
update_samplers(struct i915_context *i915) update_samplers(struct i915_context *i915)
{ {
uint unit; uint32_t unit;
i915->current.sampler_enable_nr = 0; i915->current.sampler_enable_nr = 0;
i915->current.sampler_enable_flags = 0x0; i915->current.sampler_enable_flags = 0x0;
@ -286,18 +286,19 @@ ms3_tiling_bits(enum i915_winsys_buffer_tile tiling)
} }
static void static void
update_map(struct i915_context *i915, uint unit, const struct i915_texture *tex, update_map(struct i915_context *i915, uint32_t unit,
const struct i915_texture *tex,
const struct i915_sampler_state *sampler, const struct i915_sampler_state *sampler,
const struct pipe_sampler_view *view, uint state[3]) const struct pipe_sampler_view *view, uint32_t state[3])
{ {
const struct pipe_resource *pt = &tex->b; const struct pipe_resource *pt = &tex->b;
uint width = pt->width0, height = pt->height0, depth = pt->depth0; uint32_t width = pt->width0, height = pt->height0, depth = pt->depth0;
int first_level = view->u.tex.first_level; int first_level = view->u.tex.first_level;
const uint num_levels = pt->last_level - first_level; const uint32_t num_levels = pt->last_level - first_level;
unsigned max_lod = num_levels * 4; unsigned max_lod = num_levels * 4;
bool is_npot = (!util_is_power_of_two_or_zero(pt->width0) || bool is_npot = (!util_is_power_of_two_or_zero(pt->width0) ||
!util_is_power_of_two_or_zero(pt->height0)); !util_is_power_of_two_or_zero(pt->height0));
uint format, pitch; uint32_t format, pitch;
/* /*
* This is a bit messy. i915 doesn't support NPOT with mipmaps, but we can * This is a bit messy. i915 doesn't support NPOT with mipmaps, but we can
@ -348,7 +349,7 @@ update_map(struct i915_context *i915, uint unit, const struct i915_texture *tex,
static void static void
update_maps(struct i915_context *i915) update_maps(struct i915_context *i915)
{ {
uint unit; uint32_t unit;
for (unit = 0; for (unit = 0;
unit < i915->num_fragment_sampler_views && unit < i915->num_samplers; unit < i915->num_fragment_sampler_views && unit < i915->num_samplers;