[Piglit] [PATCH 1/4] Add a new comprehensive test for textureSize().

Kenneth Graunke kenneth at whitecape.org
Tue Dec 6 15:22:14 PST 2011


On 12/06/2011 02:24 PM, Eric Anholt wrote:
> On Tue,  6 Dec 2011 13:23:55 -0800, Kenneth Graunke <kenneth at whitecape.org> wrote:
>> +bool
>> +select_sampler(const char *name)
>> +{
>> +	int i;
>> +	bool found = false;
>> +	struct {
>> +		const char *name;
>> +		GLenum type;
>> +		GLenum target;
>> +	} samplers[] = {
> 
>> +		{ "sampler1DShadow",        GL_SAMPLER_1D_SHADOW,                   GL_TEXTURE_1D             },
>> +		{ "sampler2DShadow",        GL_SAMPLER_2D_SHADOW,                   GL_TEXTURE_2D             },
>> +		{ "samplerCubeShadow",      GL_SAMPLER_CUBE_SHADOW,                 GL_TEXTURE_CUBE_MAP       },
>> +		{ "sampler2DRectShadow",    GL_SAMPLER_2D_RECT_SHADOW,              GL_TEXTURE_RECTANGLE      },
>> +		{ "sampler1DArrayShadow",   GL_SAMPLER_1D_ARRAY_SHADOW,             GL_TEXTURE_1D_ARRAY       },
>> +		{ "sampler2DArrayShadow",   GL_SAMPLER_1D_ARRAY_SHADOW,             GL_TEXTURE_2D_ARRAY       },
> 
> GL_SAMPLER_2D_ARRAY_SHADOW?

Goodness. :( Thanks for catching that.

> (looks like type isn't used yet, though I assume it's about to be)

I haven't actually used it yet.  It seemed like being able to identify
the exact sampler without strcmp would be useful at some point, so I'm
inclined to keep it...though in practice I find I want to consider
dimensionality and float/int/uint separately most of the time.

>> +void
>> +generate_texture()
>> +{
>> +	int l, i;
>> +	GLuint tex;
>> +	const GLenum target = sampler.target;
>> +
>> +	glActiveTexture(GL_TEXTURE0);
>> +
>> +	glGenTextures(1, &tex);
>> +	glBindTexture(target, tex);
> 
>> +	glEnable(target);
> 
> You shouldn't need this since you aren't using fixed function fragment
> shading.

Ah, right.  I always forget that.

> Other than that,
> 
> Reviewed-by: Eric Anholt <eric at anholt.net>

Thanks for the review!


More information about the Piglit mailing list