diff options
author | Brian Paul <[email protected]> | 2012-02-03 08:17:24 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-02-12 11:22:31 -0700 |
commit | bd1ae51b13535bc4438c663ffe91ded49db4890a (patch) | |
tree | be0bb5f3d6060b44823e009fdf829827dea923d3 /src/mesa/swrast/s_span.c | |
parent | b72d5767e3092016e0c2cfacaf38bb09d570955d (diff) |
swrast: fix span color type selection
Fixes a regression from commit 660ed923ded3552e023ef8c3dd9f92e6792f1bd2.
The basic idea is to look at the format of the dest renderbuffer and
choose either GLubyte or GLfloat for colors. The previous code used
_mesa_format_to_type_and_comps() which could return a bunch types other
than ubyte/float.
Determine the datatype at renderbuffer mapping time to avoid frequent
calls to the format query functions.
NOTE: This is a candidate for the 8.0 branch.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45578
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45577
Diffstat (limited to 'src/mesa/swrast/s_span.c')
-rw-r--r-- | src/mesa/swrast/s_span.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 422d86c00a7..025e7b2076d 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1320,15 +1320,15 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span) if (rb) { GLchan rgbaSave[MAX_WIDTH][4]; + struct swrast_renderbuffer *srb = swrast_renderbuffer(rb); + GLenum colorType = srb->ColorType; - GLenum datatype; - GLuint comps; + assert(colorType == GL_UNSIGNED_BYTE || + colorType == GL_FLOAT); - _mesa_format_to_type_and_comps(rb->Format, &datatype, &comps); - - /* set span->array->rgba to colors for render buffer's datatype */ - if (datatype != span->array->ChanType) { - convert_color_type(span, datatype, 0); + /* set span->array->rgba to colors for renderbuffer's datatype */ + if (span->array->ChanType != colorType) { + convert_color_type(span, colorType, 0); } else { if (span->array->ChanType == GL_UNSIGNED_BYTE) { |