[Mesa-dev] [PATCH] mesa: Use GL_RED for DEPTH_TEXTURE_MODE for everything but legacy GL.
Kenneth Graunke
kenneth at whitecape.org
Mon Nov 19 11:06:46 PST 2012
On 11/18/2012 05:43 PM, Ian Romanick wrote:
> On Nov 17, 2012, at 11:26 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
>
>> According to page 163 of the ES 3.0 spec:
>>
>> "Texture lookups involving textures with depth component data generate
>> a texture base color C_b either using depth data directly or by
>> performing a comparison with the D_ref value used to perform the
>> lookup, as described in section 3.8.15. The resulting value R_t is
>> then expanded to a color C_b = (R_t,0,0,1), ..."
>>
>> In other words, depth textures are supposed to be treated as GL_RED.
>>
>> A discussion about this text can be found in Khronos bugzilla:
>> https://cvs.khronos.org/bugzilla/show_bug.cgi?id=7962
>>
>> It's unclear what the behavior of desktop GL should be. The GL 3.x
>> specifications indicate that it should be (r, r, r, 1), which is
>> GL_LUMINANCE (the old default). However, page 112 of the 4.2 core
>> specification contains the text quoted above, explicitly declaring it
>> to be (R_t, 0, 0, 1), which is GL_RED.
>>
>> So it hinges on whether the 4.2 text is a change or a clarification.
>> Personally I think that using GL_RED in core contexts and GL_INTENSITY
>> in legacy contexts seems reasonable.
>
> I believe it was an intentional change somewhere in 4.x. We may want to select behavior based on API / version.
Ugh. On further investigation, it turns out that OES_depth_texture
(which is ES2 only) does not provide DEPTH_TEXTURE_MODE, but explicitly
states that it should act as GL_LUMINANCE. There's also a conformance
test for that.
So, for ES 2, it *must* be GL_LUMINANCE. For ES 3, it *must* be RED.
Time to file spec bugs...
More information about the mesa-dev
mailing list