diff options
author | Roland Scheidegger <[email protected]> | 2013-08-08 03:42:46 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-08-09 20:49:18 +0200 |
commit | b0f74250e1496d4872fd731b45049868b3efc883 (patch) | |
tree | 720be86f5b649d145d91690e37b0f59233bfe550 /src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | |
parent | 38ad404f7633aded98a0d67438e6bec0d684a5c6 (diff) |
gallivm: use texture target from shader instead of static state for size query
d3d10 has no notion of distinct array resources neither at the resource nor
sampler view level. However, shader dcl of resources certainly has, and
d3d10 expects resinfo to return the values according to that - in particular
a resource might have been a 1d texture with some array layers, then the
sampler view might have only used 1 layer so it can be accessed both as 1d
or 1d array texture (I think - the former definitely works). resinfo of a
resource decleared as array needs to return number of array layers but
non-array resource needs to return 0 (and not 1). Hence fix this by passing
the target from the shader decl to emit_size_query and use that (in case of
OpenGL the target will come from the instruction itself).
Could probably do the same for actual sampling, though it may not matter there
(as the bogus components will essentially get clamped away), possibly could
wreak havoc though if it REALLY doesn't match (which is of course an error
but still).
Reviewed-by: Zack Rusin <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 02d804abf52..affe0592a44 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -1564,6 +1564,43 @@ emit_store( } } +static unsigned +tgsi_to_pipe_tex_target(unsigned tgsi_target) +{ + switch (tgsi_target) { + case TGSI_TEXTURE_BUFFER: + return PIPE_BUFFER; + case TGSI_TEXTURE_1D: + case TGSI_TEXTURE_SHADOW1D: + return PIPE_TEXTURE_1D; + case TGSI_TEXTURE_2D: + case TGSI_TEXTURE_SHADOW2D: + case TGSI_TEXTURE_2D_MSAA: + return PIPE_TEXTURE_2D; + case TGSI_TEXTURE_3D: + return PIPE_TEXTURE_3D; + case TGSI_TEXTURE_CUBE: + case TGSI_TEXTURE_SHADOWCUBE: + return PIPE_TEXTURE_CUBE; + case TGSI_TEXTURE_RECT: + case TGSI_TEXTURE_SHADOWRECT: + return PIPE_TEXTURE_RECT; + case TGSI_TEXTURE_1D_ARRAY: + case TGSI_TEXTURE_SHADOW1D_ARRAY: + return PIPE_TEXTURE_1D_ARRAY; + case TGSI_TEXTURE_2D_ARRAY: + case TGSI_TEXTURE_SHADOW2D_ARRAY: + case TGSI_TEXTURE_2D_ARRAY_MSAA: + return PIPE_TEXTURE_2D_ARRAY; + case TGSI_TEXTURE_CUBE_ARRAY: + case TGSI_TEXTURE_SHADOWCUBE_ARRAY: + return PIPE_TEXTURE_CUBE_ARRAY; + default: + assert(0); + return PIPE_BUFFER; + } +} + /** * High-level instruction translators. */ @@ -1994,7 +2031,7 @@ emit_size_query( struct lp_build_tgsi_soa_context *bld, unsigned has_lod; unsigned i; unsigned unit = inst->Src[1].Register.Index; - unsigned target; + unsigned target, pipe_target; if (is_sviewinfo) { target = bld->sv[unit].Resource; @@ -2025,13 +2062,15 @@ emit_size_query( struct lp_build_tgsi_soa_context *bld, else explicit_lod = NULL; + pipe_target = tgsi_to_pipe_tex_target(target); + /* TODO: use scalar lod if explicit_lod is broadcasted scalar */ scalar_lod = bld->bld_base.info->processor == TGSI_PROCESSOR_FRAGMENT; bld->sampler->emit_size_query(bld->sampler, bld->bld_base.base.gallivm, bld->bld_base.int_bld.type, - unit, + unit, pipe_target, is_sviewinfo, scalar_lod, explicit_lod, |