From b74af51a4602389698768d542d79c5ce2ec917fe Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 8 May 2013 11:07:27 +0800 Subject: ilo: use tgsi_util_get_texture_coord_dim() And remove toy_tgsi_get_texture_coord_dim(). --- src/gallium/drivers/ilo/shader/ilo_shader_fs.c | 3 +- src/gallium/drivers/ilo/shader/ilo_shader_vs.c | 3 +- src/gallium/drivers/ilo/shader/toy_tgsi.h | 90 -------------------------- 3 files changed, 4 insertions(+), 92 deletions(-) diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c index 68a4fffa096..0a7921b25ff 100644 --- a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c +++ b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c @@ -26,6 +26,7 @@ */ #include "tgsi/tgsi_dump.h" +#include "tgsi/tgsi_util.h" #include "toy_compiler.h" #include "toy_tgsi.h" #include "toy_legalize.h" @@ -605,7 +606,7 @@ fs_prepare_tgsi_sampling(struct toy_compiler *tc, const struct toy_inst *inst, break; } - num_coords = toy_tgsi_get_texture_coord_dim(inst->tex.target, &ref_pos); + num_coords = tgsi_util_get_texture_coord_dim(inst->tex.target, &ref_pos); 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 f8c8d6e34fe..45bc26e0a5d 100644 --- a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c +++ b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c @@ -26,6 +26,7 @@ */ #include "tgsi/tgsi_dump.h" +#include "tgsi/tgsi_util.h" #include "toy_compiler.h" #include "toy_tgsi.h" #include "toy_legalize.h" @@ -377,7 +378,7 @@ vs_prepare_tgsi_sampling(struct toy_compiler *tc, const struct toy_inst *inst, num_derivs = 0; sampler_src = 1; - num_coords = toy_tgsi_get_texture_coord_dim(inst->tex.target, &ref_pos); + num_coords = tgsi_util_get_texture_coord_dim(inst->tex.target, &ref_pos); /* extract the parameters */ switch (inst->opcode) { diff --git a/src/gallium/drivers/ilo/shader/toy_tgsi.h b/src/gallium/drivers/ilo/shader/toy_tgsi.h index 1bfb57f6c7f..95fc897b7e0 100644 --- a/src/gallium/drivers/ilo/shader/toy_tgsi.h +++ b/src/gallium/drivers/ilo/shader/toy_tgsi.h @@ -145,96 +145,6 @@ toy_tgsi_get_imm(const struct toy_tgsi *tgsi, unsigned index, return imm; } -/** - * Return the dimension of the texture coordinates, as well as the location of - * the shadow reference value or the sample index. - */ -static inline int -toy_tgsi_get_texture_coord_dim(int tgsi_tex, int *shadow_or_sample) -{ - int dim; - - /* - * Depending on the texture target, (src0, src1.x) is interpreted - * differently: - * - * (s, *, *, *, *), for 1D - * (s, t, *, *, *), for 2D, RECT - * (s, t, r, *, *), for 3D, CUBE - * - * (s, layer, *, *, *), for 1D_ARRAY - * (s, t, layer, *, *), for 2D_ARRAY - * (s, t, r, layer, *), for CUBE_ARRAY - * - * (s, *, shadow, *, *), for SHADOW1D - * (s, t, shadow, *, *), for SHADOW2D, SHADOWRECT - * (s, t, r, shadow, *), for SHADOWCUBE - * - * (s, layer, shadow, *, *), for SHADOW1D_ARRAY - * (s, t, layer, shadow, *), for SHADOW2D_ARRAY - * (s, t, r, layer, shadow), for SHADOWCUBE_ARRAY - * - * (s, t, sample, *, *), for 2D_MSAA - * (s, t, layer, sample, *), for 2D_ARRAY_MSAA - */ - switch (tgsi_tex) { - case TGSI_TEXTURE_1D: - case TGSI_TEXTURE_SHADOW1D: - dim = 1; - break; - case TGSI_TEXTURE_2D: - case TGSI_TEXTURE_RECT: - case TGSI_TEXTURE_1D_ARRAY: - case TGSI_TEXTURE_SHADOW2D: - case TGSI_TEXTURE_SHADOWRECT: - case TGSI_TEXTURE_SHADOW1D_ARRAY: - case TGSI_TEXTURE_2D_MSAA: - dim = 2; - break; - case TGSI_TEXTURE_3D: - case TGSI_TEXTURE_CUBE: - case TGSI_TEXTURE_2D_ARRAY: - case TGSI_TEXTURE_SHADOWCUBE: - case TGSI_TEXTURE_SHADOW2D_ARRAY: - case TGSI_TEXTURE_2D_ARRAY_MSAA: - dim = 3; - break; - case TGSI_TEXTURE_CUBE_ARRAY: - case TGSI_TEXTURE_SHADOWCUBE_ARRAY: - dim = 4; - break; - default: - assert(!"unknown texture target"); - dim = 0; - break; - } - - if (shadow_or_sample) { - switch (tgsi_tex) { - case TGSI_TEXTURE_SHADOW1D: - /* there is a gap */ - *shadow_or_sample = 2; - break; - case TGSI_TEXTURE_SHADOW2D: - case TGSI_TEXTURE_SHADOWRECT: - case TGSI_TEXTURE_SHADOWCUBE: - case TGSI_TEXTURE_SHADOW1D_ARRAY: - case TGSI_TEXTURE_SHADOW2D_ARRAY: - case TGSI_TEXTURE_SHADOWCUBE_ARRAY: - case TGSI_TEXTURE_2D_MSAA: - case TGSI_TEXTURE_2D_ARRAY_MSAA: - *shadow_or_sample = dim; - break; - default: - /* no shadow nor sample */ - *shadow_or_sample = -1; - break; - } - } - - return dim; -} - void toy_compiler_translate_tgsi(struct toy_compiler *tc, const struct tgsi_token *tokens, bool aos, -- cgit v1.2.3