[Mesa-dev] [PATCH 2/7] glsl: Add glsl_type::get_sampler_instance method.
Olivier Galibert
galibert at pobox.com
Fri Jul 27 11:18:06 PDT 2012
On Fri, Jul 27, 2012 at 10:49:20AM -0700, Kenneth Graunke wrote:
> +/**
> + * Convert sampler type attributes into an index in the sampler_types array
> + */
> +#define SAMPLER_TYPE_INDEX(dim, sample_type, array, shadow) \
> + ((unsigned(dim) * 12) + (sample_type * 4) + (unsigned(array) * 2) \
> + + unsigned(shadow))
> +
> +/**
> + * \note
> + * Arrays like this are \b the argument for C99-style designated initializers.
> + * Too bad C++ and VisualStudio are too cool for that sort of useful
> + * functionality.
> + */
> +const glsl_type *const glsl_type::sampler_types[] = {
Did you think about using a 4-dimensions array and let the compiler
take care of the multiplies? It may not be that much more readable though.
> + /* GLSL_SAMPLER_DIM_1D */
> + &builtin_130_types[10], /* uint */
> + NULL, /* uint, shadow */
What does NULL mean?
OG.
More information about the mesa-dev
mailing list