[Mesa-dev] [PATCH 3/3] gallivm: handle unbound textures in texture sampling / texture queries
Jose Fonseca
jfonseca at vmware.com
Fri Aug 30 07:48:12 PDT 2013
Series LGTM.
Jose
----- Original Message -----
> From: Roland Scheidegger <sroland at vmware.com>
>
> Turns out we don't need to do much extra work for detecting this case,
> since we are guaranteed to get a empty static texture state in this case,
> hence just rely on format being 0 and return all zero then.
> Previously needed dummy textures (would just have crashed on format being 0
> otherwise) which cannot return the correct result for size queries and when
> sampling textures with wrap modes using border.
> As a bonus should hugely increase performance when sampling unbound textures
> -
> too bad it isn't a useful feature :-).
> ---
> src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 26
> +++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
> b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
> index db5e366..e0d3dd2 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
> @@ -2088,6 +2088,19 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
> debug_printf("Sample from %s\n", util_format_name(fmt));
> }
>
> + if (static_texture_state->format == PIPE_FORMAT_NONE) {
> + /*
> + * If there's nothing bound, format is NONE, and we must return
> + * all zero as mandated by d3d10 in this case.
> + */
> + unsigned chan;
> + LLVMValueRef zero = lp_build_const_vec(gallivm, type, 0.0F);
> + for (chan = 0; chan < 4; chan++) {
> + texel_out[chan] = zero;
> + }
> + return;
> + }
> +
> assert(type.floating);
>
> /* Setup our build context */
> @@ -2517,6 +2530,19 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
> unsigned num_lods = 1;
> struct lp_build_context bld_int_vec4;
>
> + if (static_state->format == PIPE_FORMAT_NONE) {
> + /*
> + * If there's nothing bound, format is NONE, and we must return
> + * all zero as mandated by d3d10 in this case.
> + */
> + unsigned chan;
> + LLVMValueRef zero = lp_build_const_vec(gallivm, int_type, 0.0F);
> + for (chan = 0; chan < 4; chan++) {
> + sizes_out[chan] = zero;
> + }
> + return;
> + }
> +
> /*
> * Do some sanity verification about bound texture and shader dcl target.
> * Not entirely sure what's possible but assume array/non-array
> --
> 1.7.9.5
>
More information about the mesa-dev
mailing list