diff options
author | Roland Scheidegger <[email protected]> | 2013-01-25 16:33:43 -0800 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-01-28 06:58:06 -0800 |
commit | cbf0f666311a5cb2720a4d6f4c540da1dd33e418 (patch) | |
tree | 3c2009de6b8dc97d983bb38dfb55f8b3fc8b0574 /src | |
parent | c789b981b244333cfc903bcd1e2fefc010500013 (diff) |
gallivm,draw,llvmpipe: mass rename of unit->texture_unit/sampler_unit
Make it obvious what "unit" this is (no change in functionality).
draw still uses "unit" in places where it changes the shader by adding
texture sampling itself - it seems like this can't work with shaders
using dx10-style sample opcodes (can't mix gl-style and dx10-style
sample instructions in a shader).
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm_sample.c | 32 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample.c | 18 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample.h | 32 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample_aos.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 72 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_tex_sample.c | 32 |
7 files changed, 95 insertions, 95 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c index 9932b911120..03a25921d65 100644 --- a/src/gallium/auxiliary/draw/draw_llvm_sample.c +++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c @@ -86,7 +86,7 @@ struct draw_llvm_sampler_soa static LLVMValueRef draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base, struct gallivm_state *gallivm, - unsigned unit, + unsigned texture_unit, unsigned member_index, const char *member_name, boolean emit_load) @@ -98,14 +98,14 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base, LLVMValueRef ptr; LLVMValueRef res; - debug_assert(unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); + debug_assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); /* context[0] */ indices[0] = lp_build_const_int32(gallivm, 0); /* context[0].textures */ indices[1] = lp_build_const_int32(gallivm, DRAW_JIT_CTX_TEXTURES); /* context[0].textures[unit] */ - indices[2] = lp_build_const_int32(gallivm, unit); + indices[2] = lp_build_const_int32(gallivm, texture_unit); /* context[0].textures[unit].member */ indices[3] = lp_build_const_int32(gallivm, member_index); @@ -116,7 +116,7 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base, else res = ptr; - lp_build_name(res, "context.texture%u.%s", unit, member_name); + lp_build_name(res, "context.texture%u.%s", texture_unit, member_name); return res; } @@ -133,7 +133,7 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base, static LLVMValueRef draw_llvm_sampler_member(const struct lp_sampler_dynamic_state *base, struct gallivm_state *gallivm, - unsigned unit, + unsigned sampler_unit, unsigned member_index, const char *member_name, boolean emit_load) @@ -145,14 +145,14 @@ draw_llvm_sampler_member(const struct lp_sampler_dynamic_state *base, LLVMValueRef ptr; LLVMValueRef res; - debug_assert(unit < PIPE_MAX_SAMPLERS); + debug_assert(sampler_unit < PIPE_MAX_SAMPLERS); /* context[0] */ indices[0] = lp_build_const_int32(gallivm, 0); /* context[0].samplers */ indices[1] = lp_build_const_int32(gallivm, DRAW_JIT_CTX_SAMPLERS); /* context[0].samplers[unit] */ - indices[2] = lp_build_const_int32(gallivm, unit); + indices[2] = lp_build_const_int32(gallivm, sampler_unit); /* context[0].samplers[unit].member */ indices[3] = lp_build_const_int32(gallivm, member_index); @@ -163,7 +163,7 @@ draw_llvm_sampler_member(const struct lp_sampler_dynamic_state *base, else res = ptr; - lp_build_name(res, "context.sampler%u.%s", unit, member_name); + lp_build_name(res, "context.sampler%u.%s", sampler_unit, member_name); return res; } @@ -182,9 +182,9 @@ draw_llvm_sampler_member(const struct lp_sampler_dynamic_state *base, static LLVMValueRef \ draw_llvm_texture_##_name( const struct lp_sampler_dynamic_state *base, \ struct gallivm_state *gallivm, \ - unsigned unit) \ + unsigned texture_unit) \ { \ - return draw_llvm_texture_member(base, gallivm, unit, _index, #_name, _emit_load ); \ + return draw_llvm_texture_member(base, gallivm, texture_unit, _index, #_name, _emit_load ); \ } @@ -203,9 +203,9 @@ DRAW_LLVM_TEXTURE_MEMBER(mip_offsets, DRAW_JIT_TEXTURE_MIP_OFFSETS, FALSE) static LLVMValueRef \ draw_llvm_sampler_##_name( const struct lp_sampler_dynamic_state *base, \ struct gallivm_state *gallivm, \ - unsigned unit) \ + unsigned sampler_unit) \ { \ - return draw_llvm_sampler_member(base, gallivm, unit, _index, #_name, _emit_load ); \ + return draw_llvm_sampler_member(base, gallivm, sampler_unit, _index, #_name, _emit_load ); \ } @@ -268,19 +268,19 @@ static void draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, struct gallivm_state *gallivm, struct lp_type type, - unsigned unit, + unsigned texture_unit, LLVMValueRef explicit_lod, /* optional */ LLVMValueRef *sizes_out) { struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base; - assert(unit < PIPE_MAX_SAMPLERS); + assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); lp_build_size_query_soa(gallivm, - &sampler->dynamic_state.static_state[unit].texture_state, + &sampler->dynamic_state.static_state[texture_unit].texture_state, &sampler->dynamic_state.base, type, - unit, + texture_unit, explicit_lod, sizes_out); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 4e4bca3014f..53223973172 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -647,7 +647,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, */ void lp_build_nearest_mip_level(struct lp_build_sample_context *bld, - unsigned unit, + unsigned texture_unit, LLVMValueRef lod_ipart, LLVMValueRef *level_out) { @@ -655,9 +655,9 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld, LLVMValueRef first_level, last_level, level; first_level = bld->dynamic_state->first_level(bld->dynamic_state, - bld->gallivm, unit); + bld->gallivm, texture_unit); last_level = bld->dynamic_state->last_level(bld->dynamic_state, - bld->gallivm, unit); + bld->gallivm, texture_unit); first_level = lp_build_broadcast_scalar(perquadi_bld, first_level); last_level = lp_build_broadcast_scalar(perquadi_bld, last_level); @@ -675,7 +675,7 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld, */ void lp_build_linear_mip_levels(struct lp_build_sample_context *bld, - unsigned unit, + unsigned texture_unit, LLVMValueRef lod_ipart, LLVMValueRef *lod_fpart_inout, LLVMValueRef *level0_out, @@ -689,9 +689,9 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld, LLVMValueRef clamp_max; first_level = bld->dynamic_state->first_level(bld->dynamic_state, - bld->gallivm, unit); + bld->gallivm, texture_unit); last_level = bld->dynamic_state->last_level(bld->dynamic_state, - bld->gallivm, unit); + bld->gallivm, texture_unit); first_level = lp_build_broadcast_scalar(perquadi_bld, first_level); last_level = lp_build_broadcast_scalar(perquadi_bld, last_level); @@ -741,9 +741,9 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld, *lod_fpart_inout = LLVMBuildSelect(builder, clamp_max, perquadf_bld->zero, *lod_fpart_inout, ""); - lp_build_name(*level0_out, "sampler%u_miplevel0", unit); - lp_build_name(*level1_out, "sampler%u_miplevel1", unit); - lp_build_name(*lod_fpart_inout, "sampler%u_mipweight", unit); + lp_build_name(*level0_out, "texture%u_miplevel0", texture_unit); + lp_build_name(*level1_out, "texture%u_miplevel1", texture_unit); + lp_build_name(*lod_fpart_inout, "texture%u_mipweight", texture_unit); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index d0207aa471e..77ce00869be 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -131,77 +131,77 @@ struct lp_sampler_dynamic_state LLVMValueRef (*width)( const struct lp_sampler_dynamic_state *state, struct gallivm_state *gallivm, - unsigned unit); + unsigned texture_unit); /** Obtain the base texture height (returns int32) */ LLVMValueRef (*height)( const struct lp_sampler_dynamic_state *state, struct gallivm_state *gallivm, - unsigned unit); + unsigned texture_unit); /** Obtain the base texture depth (returns int32) */ LLVMValueRef (*depth)( const struct lp_sampler_dynamic_state *state, struct gallivm_state *gallivm, - unsigned unit); + unsigned texture_unit); /** Obtain the first mipmap level (base level) (returns int32) */ LLVMValueRef (*first_level)( const struct lp_sampler_dynamic_state *state, struct gallivm_state *gallivm, - unsigned unit); + unsigned texture_unit); /** Obtain the number of mipmap levels minus one (returns int32) */ LLVMValueRef (*last_level)( const struct lp_sampler_dynamic_state *state, struct gallivm_state *gallivm, - unsigned unit); + unsigned texture_unit); /** Obtain stride in bytes between image rows/blocks (returns int32) */ LLVMValueRef (*row_stride)( const struct lp_sampler_dynamic_state *state, struct gallivm_state *gallivm, - unsigned unit); + unsigned texture_unit); /** Obtain stride in bytes between image slices (returns int32) */ LLVMValueRef (*img_stride)( const struct lp_sampler_dynamic_state *state, struct gallivm_state *gallivm, - unsigned unit); + unsigned texture_unit); /** Obtain pointer to base of texture */ LLVMValueRef (*base_ptr)( const struct lp_sampler_dynamic_state *state, struct gallivm_state *gallivm, - unsigned unit); + unsigned texture_unit); /** Obtain pointer to array of mipmap offsets */ LLVMValueRef (*mip_offsets)( const struct lp_sampler_dynamic_state *state, struct gallivm_state *gallivm, - unsigned unit); + unsigned texture_unit); /* These are callbacks for sampler state */ /** Obtain texture min lod (returns float) */ LLVMValueRef (*min_lod)(const struct lp_sampler_dynamic_state *state, - struct gallivm_state *gallivm, unsigned unit); + struct gallivm_state *gallivm, unsigned sampler_unit); /** Obtain texture max lod (returns float) */ LLVMValueRef (*max_lod)(const struct lp_sampler_dynamic_state *state, - struct gallivm_state *gallivm, unsigned unit); + struct gallivm_state *gallivm, unsigned sampler_unit); /** Obtain texture lod bias (returns float) */ LLVMValueRef (*lod_bias)(const struct lp_sampler_dynamic_state *state, - struct gallivm_state *gallivm, unsigned unit); + struct gallivm_state *gallivm, unsigned sampler_unit); /** Obtain texture border color (returns ptr to float[4]) */ LLVMValueRef (*border_color)(const struct lp_sampler_dynamic_state *state, - struct gallivm_state *gallivm, unsigned unit); + struct gallivm_state *gallivm, unsigned sampler_unit); }; @@ -375,13 +375,13 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, void lp_build_nearest_mip_level(struct lp_build_sample_context *bld, - unsigned unit, + unsigned texture_unit, LLVMValueRef lod, LLVMValueRef *level_out); void lp_build_linear_mip_levels(struct lp_build_sample_context *bld, - unsigned unit, + unsigned texture_unit, LLVMValueRef lod_ipart, LLVMValueRef *lod_fpart_inout, LLVMValueRef *level0_out, @@ -486,7 +486,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, const struct lp_static_texture_state *static_state, struct lp_sampler_dynamic_state *dynamic_state, struct lp_type int_type, - unsigned unit, + unsigned texture_unit, LLVMValueRef explicit_lod, LLVMValueRef *sizes_out); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index b9c8446032e..bddff2c4a13 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -1570,7 +1570,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, */ void lp_build_sample_aos(struct lp_build_sample_context *bld, - unsigned unit, + unsigned sampler_unit, LLVMValueRef s, LLVMValueRef t, LLVMValueRef r, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.h b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.h index 55b3bc1c09a..6590e8ce090 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.h @@ -42,7 +42,7 @@ void lp_build_sample_aos(struct lp_build_sample_context *bld, - unsigned unit, + unsigned sampler_unit, LLVMValueRef s, LLVMValueRef t, LLVMValueRef r, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 0e901948aa2..778400af5f0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -72,7 +72,7 @@ */ static void lp_build_sample_texel_soa(struct lp_build_sample_context *bld, - unsigned unit, + unsigned sampler_unit, LLVMValueRef width, LLVMValueRef height, LLVMValueRef depth, @@ -182,7 +182,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, /* select texel color or border color depending on use_border */ LLVMValueRef border_color_ptr = bld->dynamic_state->border_color(bld->dynamic_state, - bld->gallivm, unit); + bld->gallivm, sampler_unit); int chan; for (chan = 0; chan < 4; chan++) { LLVMValueRef border_chan = @@ -581,7 +581,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld, */ static void lp_build_sample_image_nearest(struct lp_build_sample_context *bld, - unsigned unit, + unsigned sampler_unit, LLVMValueRef size, LLVMValueRef row_stride_vec, LLVMValueRef img_stride_vec, @@ -647,7 +647,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, /* * Get texture colors. */ - lp_build_sample_texel_soa(bld, unit, + lp_build_sample_texel_soa(bld, sampler_unit, width_vec, height_vec, depth_vec, x, y, z, row_stride_vec, img_stride_vec, @@ -661,7 +661,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, */ static void lp_build_sample_image_linear(struct lp_build_sample_context *bld, - unsigned unit, + unsigned sampler_unit, LLVMValueRef size, LLVMValueRef row_stride_vec, LLVMValueRef img_stride_vec, @@ -739,12 +739,12 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, * Get texture colors. */ /* get x0/x1 texels */ - lp_build_sample_texel_soa(bld, unit, + lp_build_sample_texel_soa(bld, sampler_unit, width_vec, height_vec, depth_vec, x0, y0, z0, row_stride_vec, img_stride_vec, data_ptr, mipoffsets, neighbors[0][0]); - lp_build_sample_texel_soa(bld, unit, + lp_build_sample_texel_soa(bld, sampler_unit, width_vec, height_vec, depth_vec, x1, y0, z0, row_stride_vec, img_stride_vec, @@ -763,12 +763,12 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, LLVMValueRef colors0[4]; /* get x0/x1 texels at y1 */ - lp_build_sample_texel_soa(bld, unit, + lp_build_sample_texel_soa(bld, sampler_unit, width_vec, height_vec, depth_vec, x0, y1, z0, row_stride_vec, img_stride_vec, data_ptr, mipoffsets, neighbors[1][0]); - lp_build_sample_texel_soa(bld, unit, + lp_build_sample_texel_soa(bld, sampler_unit, width_vec, height_vec, depth_vec, x1, y1, z0, row_stride_vec, img_stride_vec, @@ -789,22 +789,22 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, LLVMValueRef colors1[4]; /* get x0/x1/y0/y1 texels at z1 */ - lp_build_sample_texel_soa(bld, unit, + lp_build_sample_texel_soa(bld, sampler_unit, width_vec, height_vec, depth_vec, x0, y0, z1, row_stride_vec, img_stride_vec, data_ptr, mipoffsets, neighbors1[0][0]); - lp_build_sample_texel_soa(bld, unit, + lp_build_sample_texel_soa(bld, sampler_unit, width_vec, height_vec, depth_vec, x1, y0, z1, row_stride_vec, img_stride_vec, data_ptr, mipoffsets, neighbors1[0][1]); - lp_build_sample_texel_soa(bld, unit, + lp_build_sample_texel_soa(bld, sampler_unit, width_vec, height_vec, depth_vec, x0, y1, z1, row_stride_vec, img_stride_vec, data_ptr, mipoffsets, neighbors1[1][0]); - lp_build_sample_texel_soa(bld, unit, + lp_build_sample_texel_soa(bld, sampler_unit, width_vec, height_vec, depth_vec, x1, y1, z1, row_stride_vec, img_stride_vec, @@ -845,7 +845,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, */ static void lp_build_sample_mipmap(struct lp_build_sample_context *bld, - unsigned unit, + unsigned sampler_unit, unsigned img_filter, unsigned mip_filter, LLVMValueRef s, @@ -883,7 +883,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, mipoff0 = lp_build_get_mip_offsets(bld, ilevel0); } if (img_filter == PIPE_TEX_FILTER_NEAREST) { - lp_build_sample_image_nearest(bld, unit, + lp_build_sample_image_nearest(bld, sampler_unit, size0, row_stride0_vec, img_stride0_vec, data_ptr0, mipoff0, s, t, r, @@ -891,7 +891,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, } else { assert(img_filter == PIPE_TEX_FILTER_LINEAR); - lp_build_sample_image_linear(bld, unit, + lp_build_sample_image_linear(bld, sampler_unit, size0, row_stride0_vec, img_stride0_vec, data_ptr0, mipoff0, s, t, r, @@ -947,14 +947,14 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, mipoff1 = lp_build_get_mip_offsets(bld, ilevel1); } if (img_filter == PIPE_TEX_FILTER_NEAREST) { - lp_build_sample_image_nearest(bld, unit, + lp_build_sample_image_nearest(bld, sampler_unit, size1, row_stride1_vec, img_stride1_vec, data_ptr1, mipoff1, s, t, r, colors1); } else { - lp_build_sample_image_linear(bld, unit, + lp_build_sample_image_linear(bld, sampler_unit, size1, row_stride1_vec, img_stride1_vec, data_ptr1, mipoff1, s, t, r, @@ -984,13 +984,13 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, */ static LLVMValueRef lp_build_layer_coord(struct lp_build_sample_context *bld, - unsigned unit, + unsigned texture_unit, LLVMValueRef layer) { LLVMValueRef maxlayer; maxlayer = bld->dynamic_state->depth(bld->dynamic_state, - bld->gallivm, unit); + bld->gallivm, texture_unit); maxlayer = lp_build_sub(&bld->int_bld, maxlayer, bld->int_bld.one); maxlayer = lp_build_broadcast_scalar(&bld->int_coord_bld, maxlayer); return lp_build_clamp(&bld->int_coord_bld, layer, @@ -1116,7 +1116,7 @@ lp_build_sample_common(struct lp_build_sample_context *bld, */ static void lp_build_sample_general(struct lp_build_sample_context *bld, - unsigned unit, + unsigned sampler_unit, LLVMValueRef s, LLVMValueRef t, LLVMValueRef r, @@ -1140,12 +1140,12 @@ lp_build_sample_general(struct lp_build_sample_context *bld, for (chan = 0; chan < 4; ++chan) { texels[chan] = lp_build_alloca(bld->gallivm, bld->texel_bld.vec_type, ""); - lp_build_name(texels[chan], "sampler%u_texel_%c_var", unit, "xyzw"[chan]); + lp_build_name(texels[chan], "sampler%u_texel_%c_var", sampler_unit, "xyzw"[chan]); } if (min_filter == mag_filter) { /* no need to distinguish between minification and magnification */ - lp_build_sample_mipmap(bld, unit, + lp_build_sample_mipmap(bld, sampler_unit, min_filter, mip_filter, s, t, r, ilevel0, ilevel1, lod_fpart, @@ -1178,7 +1178,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld, lp_build_if(&if_ctx, bld->gallivm, minify); { /* Use the minification filter */ - lp_build_sample_mipmap(bld, unit, + lp_build_sample_mipmap(bld, sampler_unit, min_filter, mip_filter, s, t, r, ilevel0, ilevel1, lod_fpart, @@ -1187,7 +1187,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld, lp_build_else(&if_ctx); { /* Use the magnification filter */ - lp_build_sample_mipmap(bld, unit, + lp_build_sample_mipmap(bld, sampler_unit, mag_filter, PIPE_TEX_MIPFILTER_NONE, s, t, r, ilevel0, NULL, NULL, @@ -1198,7 +1198,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld, for (chan = 0; chan < 4; ++chan) { colors_out[chan] = LLVMBuildLoad(builder, texels[chan], ""); - lp_build_name(colors_out[chan], "sampler%u_texel_%c", unit, "xyzw"[chan]); + lp_build_name(colors_out[chan], "sampler%u_texel_%c", sampler_unit, "xyzw"[chan]); } } @@ -1213,7 +1213,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld, */ static void lp_build_fetch_texel(struct lp_build_sample_context *bld, - unsigned unit, + unsigned texture_unit, const LLVMValueRef *coords, LLVMValueRef explicit_lod, const LLVMValueRef *offsets, @@ -1233,7 +1233,7 @@ lp_build_fetch_texel(struct lp_build_sample_context *bld, if (explicit_lod && bld->static_texture_state->target != PIPE_BUFFER) { ilevel = lp_build_pack_aos_scalars(bld->gallivm, int_coord_bld->type, perquadi_bld->type, explicit_lod, 0); - lp_build_nearest_mip_level(bld, unit, ilevel, &ilevel); + lp_build_nearest_mip_level(bld, texture_unit, ilevel, &ilevel); } else { bld->num_lods = 1; @@ -1248,10 +1248,10 @@ lp_build_fetch_texel(struct lp_build_sample_context *bld, if (target == PIPE_TEXTURE_1D_ARRAY || target == PIPE_TEXTURE_2D_ARRAY) { if (target == PIPE_TEXTURE_1D_ARRAY) { - z = lp_build_layer_coord(bld, unit, y); + z = lp_build_layer_coord(bld, texture_unit, y); } else { - z = lp_build_layer_coord(bld, unit, z); + z = lp_build_layer_coord(bld, texture_unit, z); } } @@ -1741,7 +1741,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, const struct lp_static_texture_state *static_state, struct lp_sampler_dynamic_state *dynamic_state, struct lp_type int_type, - unsigned unit, + unsigned texture_unit, LLVMValueRef explicit_lod, LLVMValueRef *sizes_out) { @@ -1784,7 +1784,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, if (explicit_lod) { LLVMValueRef first_level; lod = LLVMBuildExtractElement(gallivm->builder, explicit_lod, lp_build_const_int32(gallivm, 0), ""); - first_level = dynamic_state->first_level(dynamic_state, gallivm, unit); + first_level = dynamic_state->first_level(dynamic_state, gallivm, texture_unit); lod = lp_build_broadcast_scalar(&bld_int_vec, LLVMBuildAdd(gallivm->builder, lod, first_level, "lod")); @@ -1795,18 +1795,18 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, size = bld_int_vec.undef; size = LLVMBuildInsertElement(gallivm->builder, size, - dynamic_state->width(dynamic_state, gallivm, unit), + dynamic_state->width(dynamic_state, gallivm, texture_unit), lp_build_const_int32(gallivm, 0), ""); if (dims >= 2) { size = LLVMBuildInsertElement(gallivm->builder, size, - dynamic_state->height(dynamic_state, gallivm, unit), + dynamic_state->height(dynamic_state, gallivm, texture_unit), lp_build_const_int32(gallivm, 1), ""); } if (dims >= 3) { size = LLVMBuildInsertElement(gallivm->builder, size, - dynamic_state->depth(dynamic_state, gallivm, unit), + dynamic_state->depth(dynamic_state, gallivm, texture_unit), lp_build_const_int32(gallivm, 2), ""); } @@ -1814,7 +1814,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, if (has_array) size = LLVMBuildInsertElement(gallivm->builder, size, - dynamic_state->depth(dynamic_state, gallivm, unit), + dynamic_state->depth(dynamic_state, gallivm, texture_unit), lp_build_const_int32(gallivm, dims), ""); for (i = 0; i < dims + (has_array ? 1 : 0); i++) { diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c index 25125a0768b..69ac8886547 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c @@ -92,7 +92,7 @@ struct lp_llvm_sampler_soa static LLVMValueRef lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base, struct gallivm_state *gallivm, - unsigned unit, + unsigned texture_unit, unsigned member_index, const char *member_name, boolean emit_load) @@ -104,14 +104,14 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base, LLVMValueRef ptr; LLVMValueRef res; - assert(unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); + assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); /* context[0] */ indices[0] = lp_build_const_int32(gallivm, 0); /* context[0].textures */ indices[1] = lp_build_const_int32(gallivm, LP_JIT_CTX_TEXTURES); /* context[0].textures[unit] */ - indices[2] = lp_build_const_int32(gallivm, unit); + indices[2] = lp_build_const_int32(gallivm, texture_unit); /* context[0].textures[unit].member */ indices[3] = lp_build_const_int32(gallivm, member_index); @@ -122,7 +122,7 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base, else res = ptr; - lp_build_name(res, "context.texture%u.%s", unit, member_name); + lp_build_name(res, "context.texture%u.%s", texture_unit, member_name); return res; } @@ -141,9 +141,9 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base, static LLVMValueRef \ lp_llvm_texture_##_name( const struct lp_sampler_dynamic_state *base, \ struct gallivm_state *gallivm, \ - unsigned unit) \ + unsigned texture_unit) \ { \ - return lp_llvm_texture_member(base, gallivm, unit, _index, #_name, _emit_load ); \ + return lp_llvm_texture_member(base, gallivm, texture_unit, _index, #_name, _emit_load ); \ } @@ -169,7 +169,7 @@ LP_LLVM_TEXTURE_MEMBER(mip_offsets, LP_JIT_TEXTURE_MIP_OFFSETS, FALSE) static LLVMValueRef lp_llvm_sampler_member(const struct lp_sampler_dynamic_state *base, struct gallivm_state *gallivm, - unsigned unit, + unsigned sampler_unit, unsigned member_index, const char *member_name, boolean emit_load) @@ -181,14 +181,14 @@ lp_llvm_sampler_member(const struct lp_sampler_dynamic_state *base, LLVMValueRef ptr; LLVMValueRef res; - assert(unit < PIPE_MAX_SAMPLERS); + assert(sampler_unit < PIPE_MAX_SAMPLERS); /* context[0] */ indices[0] = lp_build_const_int32(gallivm, 0); /* context[0].samplers */ indices[1] = lp_build_const_int32(gallivm, LP_JIT_CTX_SAMPLERS); /* context[0].samplers[unit] */ - indices[2] = lp_build_const_int32(gallivm, unit); + indices[2] = lp_build_const_int32(gallivm, sampler_unit); /* context[0].samplers[unit].member */ indices[3] = lp_build_const_int32(gallivm, member_index); @@ -199,7 +199,7 @@ lp_llvm_sampler_member(const struct lp_sampler_dynamic_state *base, else res = ptr; - lp_build_name(res, "context.sampler%u.%s", unit, member_name); + lp_build_name(res, "context.sampler%u.%s", sampler_unit, member_name); return res; } @@ -209,9 +209,9 @@ lp_llvm_sampler_member(const struct lp_sampler_dynamic_state *base, static LLVMValueRef \ lp_llvm_sampler_##_name( const struct lp_sampler_dynamic_state *base, \ struct gallivm_state *gallivm, \ - unsigned unit) \ + unsigned sampler_unit) \ { \ - return lp_llvm_sampler_member(base, gallivm, unit, _index, #_name, _emit_load ); \ + return lp_llvm_sampler_member(base, gallivm, sampler_unit, _index, #_name, _emit_load ); \ } @@ -278,19 +278,19 @@ static void lp_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, struct gallivm_state *gallivm, struct lp_type type, - unsigned unit, + unsigned texture_unit, LLVMValueRef explicit_lod, /* optional */ LLVMValueRef *sizes_out) { struct lp_llvm_sampler_soa *sampler = (struct lp_llvm_sampler_soa *)base; - assert(unit < PIPE_MAX_SAMPLERS); + assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); lp_build_size_query_soa(gallivm, - &sampler->dynamic_state.static_state[unit].texture_state, + &sampler->dynamic_state.static_state[texture_unit].texture_state, &sampler->dynamic_state.base, type, - unit, + texture_unit, explicit_lod, sizes_out); } |