From 0b6554ba6f2aa8a771852566340c24205e406d02 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 27 Nov 2012 03:26:49 +0100 Subject: gallivm,llvmpipe: handle TXF (texelFetch) instruction, including offsets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/gallium/drivers/llvmpipe/lp_screen.c | 4 +++- src/gallium/drivers/llvmpipe/lp_tex_sample.c | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/gallium/drivers/llvmpipe') 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); -- cgit v1.2.3