Re: [PATCH] mesa: Convert colors if span ChanType and renderbuffer data type don't match
Brian Paul <brian.e.paul <at> gmail.com>
2012-02-01 02:05:30 GMT
On Tue, Jan 31, 2012 at 7:05 PM, Brian Paul <brian.e.paul <at> gmail.com> wrote:
> On Tue, Jan 31, 2012 at 4:47 PM, Ian Romanick <idr <at> freedesktop.org> wrote:
>> From: Ian Romanick <ian.d.romanick <at> intel.com>
>>
>> This is a partial revert of f9874fe. It turns out that the types
>> don't always match. Specifically, this can happen when doing
>> glCopyPixels from a float FBO to a RGBA8 FBO.
>>
>> Signed-off-by: Ian Romanick <ian.d.romanick <at> intel.com>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45429
>> ---
>> src/mesa/swrast/s_span.c | 19 +++++++++++++++----
>> 1 files changed, 15 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
>> index 28f2f3d..422d86c 100644
>> --- a/src/mesa/swrast/s_span.c
>> +++ b/src/mesa/swrast/s_span.c
>> <at> <at> -1321,12 +1321,23 <at> <at> _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
>> if (rb) {
>> GLchan rgbaSave[MAX_WIDTH][4];
>>
>> - if (span->array->ChanType == GL_UNSIGNED_BYTE) {
>> - span->array->rgba = span->array->rgba8;
>> + GLenum datatype;
>> + GLuint comps;
>> +
>> + _mesa_format_to_type_and_comps(rb->Format, &datatype, &comps);
>> +
>> + /* set span->array->rgba to colors for render buffer's datatype */
(Continue reading)