summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2016-03-30 16:54:08 -0600
committerBrian Paul <[email protected]>2016-03-31 09:48:00 -0600
commit9076e049340db0c55f57abb4ee9bbaffba61d45d (patch)
treef2da10d70e478471028cf0c53d1399e27f2c47ba /src/gallium/drivers
parent9d7cd439880d9334d21ed099efa15ccf8b709748 (diff)
tgsi: split tgsi_util_get_texture_coord_dim() function into two
It was kind of overloaded, returning two different things. Now get the index of the shadow reference src register with a new tgsi_util_get_shadow_ref_src_index() function. To verify the new code, I added some temp/debug code which looped over all TGSI_TEXTURE_x values, calling the old function and new and checking that the returned indexes matched. Also tested piglit "shadow" tests with softpipe/llvmpipe. No testing of ilo and radeonsi changes. Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/ilo/shader/ilo_shader_fs.c4
-rw-r--r--src/gallium/drivers/ilo/shader/ilo_shader_vs.c3
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c7
3 files changed, 8 insertions, 6 deletions
diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
index f46126e8427..6c8f1b5222e 100644
--- a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
+++ b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
@@ -740,7 +740,9 @@ fs_prepare_tgsi_sampling(struct fs_compile_context *fcc,
break;
}
- num_coords = tgsi_util_get_texture_coord_dim(inst->tex.target, &ref_pos);
+ num_coords = tgsi_util_get_texture_coord_dim(inst->tex.target);
+ ref_pos = tgsi_util_get_shadow_ref_src_index(inst->tex.target);
+
tsrc_transpose(inst->src[0], coords);
bias_or_lod = tsrc_null();
ref_or_si = tsrc_null();
diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
index 0df0afc706b..2b46d44f5be 100644
--- a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
+++ b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
@@ -407,7 +407,8 @@ vs_prepare_tgsi_sampling(struct vs_compile_context *vcc,
num_derivs = 0;
sampler_src = 1;
- num_coords = tgsi_util_get_texture_coord_dim(inst->tex.target, &ref_pos);
+ num_coords = tgsi_util_get_texture_coord_dim(inst->tex.target);
+ ref_pos = tgsi_util_get_shadow_ref_src_index(inst->tex.target);
/* extract the parameters */
switch (inst->opcode) {
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 9eb531f8d80..4176e9f1ce5 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2874,8 +2874,7 @@ static LLVMValueRef image_fetch_coords(
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
unsigned target = inst->Memory.Texture;
- int sample;
- unsigned num_coords = tgsi_util_get_texture_coord_dim(target, &sample);
+ unsigned num_coords = tgsi_util_get_texture_coord_dim(target);
LLVMValueRef coords[4];
LLVMValueRef tmp;
int chan;
@@ -3387,8 +3386,8 @@ static void tex_fetch_args(
unsigned target = inst->Texture.Texture;
LLVMValueRef coords[5], derivs[6];
LLVMValueRef address[16];
- int ref_pos;
- unsigned num_coords = tgsi_util_get_texture_coord_dim(target, &ref_pos);
+ unsigned num_coords = tgsi_util_get_texture_coord_dim(target);
+ int ref_pos = tgsi_util_get_shadow_ref_src_index(target);
unsigned count = 0;
unsigned chan;
unsigned num_deriv_channels = 0;