summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2012-11-27 03:26:49 +0100
committerRoland Scheidegger <[email protected]>2012-11-27 03:26:49 +0100
commit0b6554ba6f2aa8a771852566340c24205e406d02 (patch)
tree4860b057589b29b85a70fb8666537dfa51f10afa /src/gallium/drivers
parent93c689a2dfa29cf3a4647432f0690bf76514b5bd (diff)
gallivm,llvmpipe: handle TXF (texelFetch) instruction, including offsets
This also adds some code to handle per-quad lods for more than 4-wide fetches, because otherwise I'd have to integrate the texelFetch function into the splitting stuff... (but it is not used yet outside texelFetch). passes piglit fs-texelFetch-2D, fails fs-texelFetchOffset-2D due to I believe a test error (results are undefined for out-of-bounds fetches, we return whatever is at offset 0, whereas the test expects [0,0,0,1]). Texel offsets are only handled by texelFetch for now, though the interface can handle it for everything. Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tex_sample.c9
2 files changed, 9 insertions, 4 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index e81c44151bb..5ff8024a223 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -175,9 +175,11 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 0;
case PIPE_CAP_SCALED_RESOLVE:
return 0;
+ /* this is a lie could support arbitrary large offsets */
case PIPE_CAP_MIN_TEXEL_OFFSET:
+ return -8;
case PIPE_CAP_MAX_TEXEL_OFFSET:
- return 0;
+ return 7;
case PIPE_CAP_CONDITIONAL_RENDER:
return 1;
case PIPE_CAP_TEXTURE_BARRIER:
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c
index 1c5c009b556..0bd5c4aa050 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c
@@ -176,9 +176,10 @@ static void
lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
struct gallivm_state *gallivm,
struct lp_type type,
+ boolean is_fetch,
unsigned unit,
- unsigned num_coords,
const LLVMValueRef *coords,
+ const LLVMValueRef *offsets,
const struct lp_derivatives *derivs,
LLVMValueRef lod_bias, /* optional */
LLVMValueRef explicit_lod, /* optional */
@@ -189,7 +190,7 @@ lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
assert(unit < PIPE_MAX_SAMPLERS);
if (LP_PERF & PERF_NO_TEX) {
- lp_build_sample_nop(gallivm, type, num_coords, coords, texel);
+ lp_build_sample_nop(gallivm, type, coords, texel);
return;
}
@@ -197,8 +198,10 @@ lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
&sampler->dynamic_state.static_state[unit],
&sampler->dynamic_state.base,
type,
+ is_fetch,
unit,
- num_coords, coords,
+ coords,
+ offsets,
derivs,
lod_bias, explicit_lod,
texel);