diff options
author | marha <marha@users.sourceforge.net> | 2012-02-13 08:50:32 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-02-13 08:50:32 +0100 |
commit | 179ebdfaf7fe0a0017054c052b76210eeff084a9 (patch) | |
tree | 5daa6e5583ced6a6b12b03e12c16ef2acedb5b5c /mesalib/src/mesa/swrast/s_renderbuffer.c | |
parent | 535951cba015f2a2b63292e0ca983d0d6e736b71 (diff) | |
parent | eaa70945cb3f1a432b8c505ecede9ebc7769f36d (diff) | |
download | vcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.tar.gz vcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.tar.bz2 vcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/swrast/s_renderbuffer.c')
-rw-r--r-- | mesalib/src/mesa/swrast/s_renderbuffer.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/mesalib/src/mesa/swrast/s_renderbuffer.c b/mesalib/src/mesa/swrast/s_renderbuffer.c index 637a7b6dc..d8a7467b0 100644 --- a/mesalib/src/mesa/swrast/s_renderbuffer.c +++ b/mesalib/src/mesa/swrast/s_renderbuffer.c @@ -615,8 +615,31 @@ unmap_attachment(struct gl_context *ctx, srb->Map = NULL; } - - + + +/** + * Determine what type to use (ubyte vs. float) for span colors for the + * given renderbuffer. + * See also _swrast_write_rgba_span(). + */ +static void +find_renderbuffer_colortype(struct gl_renderbuffer *rb) +{ + struct swrast_renderbuffer *srb = swrast_renderbuffer(rb); + GLuint rbMaxBits = _mesa_get_format_max_bits(rb->Format); + GLenum rbDatatype = _mesa_get_format_datatype(rb->Format); + + if (rbDatatype == GL_UNSIGNED_NORMALIZED && rbMaxBits <= 8) { + /* the buffer's values fit in GLubyte values */ + srb->ColorType = GL_UNSIGNED_BYTE; + } + else { + /* use floats otherwise */ + srb->ColorType = GL_FLOAT; + } +} + + /** * Map the renderbuffers we'll use for tri/line/point rendering. */ @@ -641,6 +664,7 @@ _swrast_map_renderbuffers(struct gl_context *ctx) for (buf = 0; buf < fb->_NumColorDrawBuffers; buf++) { map_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]); + find_renderbuffer_colortype(fb->_ColorDrawBuffers[buf]); } } |