[Mesa-dev] [PATCH 4/5] texstore: Add a generic implementation of GL_ARB_clear_texture

Ilia Mirkin imirkin at alum.mit.edu
Tue Jul 1 18:00:41 PDT 2014


On Tue, Jul 1, 2014 at 2:06 PM, Neil Roberts <neil at linux.intel.com> wrote:
> Jason Ekstrand <jason at jlekstrand.net> writes:
>
>>> +static void
>>> +clear_image_to_zero(GLubyte *dstMap, GLint dstRowStride,
>>> +                    GLsizei width, GLsizei height,
>>> +                    GLsizei clearValueSize)
>>> +{
>>> +   while (height-- > 0) {
>>> +      memset(dstMap, 0, clearValueSize * width);
>>> +      dstMap += dstRowStride;
>>> +   }
>>> +}
>>>
>>
>> Technically, this should always work, but you might want to throw in a
>> comment about floating-point textures.
>
> I'm not sure what you mean here. Are you saying that hypothetically
> floating-point textures might not represent 0 as zero bytes?

Not entirely sure how to interpret what the spec says, but something
to potentially consider is MESA_ycbcr_texture (supported by swrast).
RGBA 0 (black) != 0 in ycbcr... all 0's there are a green color.

Also probably not _too_ important to worry too much about, just wanted
to point it out.

  -ilia


More information about the mesa-dev mailing list