diff options
author | marha <marha@users.sourceforge.net> | 2011-02-22 13:55:31 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-02-22 13:55:31 +0000 |
commit | 9273afeeb4499a0493f120b7525e17b6ae51113e (patch) | |
tree | 404ae2c5f693be6ea2c0d6eb55e2c68b9d177e00 /mesalib/src/mesa/state_tracker/st_format.c | |
parent | 248adea786d4a5a9d2c71679722eda734d4e7be7 (diff) | |
download | vcxsrv-9273afeeb4499a0493f120b7525e17b6ae51113e.tar.gz vcxsrv-9273afeeb4499a0493f120b7525e17b6ae51113e.tar.bz2 vcxsrv-9273afeeb4499a0493f120b7525e17b6ae51113e.zip |
xserver libX11 pixman mesa git update 22 Feb 2011
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_format.c')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_format.c | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index a532e089c..577ee6189 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -113,12 +113,9 @@ st_format_datatype(enum pipe_format format) return GL_UNSIGNED_SHORT; } else { - /* compressed format? */ - assert(0); + /* probably a compressed format, unsupported anyway */ + return GL_NONE; } - - assert(0); - return GL_NONE; } @@ -1098,3 +1095,55 @@ st_sampler_compat_formats(enum pipe_format format1, enum pipe_format format2) return GL_FALSE; } + + + +/** + * This is used for translating texture border color and the clear + * color. For example, the clear color is interpreted according to + * the renderbuffer's base format. For example, if clearing a + * GL_LUMINANCE buffer, ClearColor[0] = luminance and ClearColor[1] = + * alpha. Similarly for texture border colors. + */ +void +st_translate_color(const GLfloat colorIn[4], GLenum baseFormat, + GLfloat colorOut[4]) +{ + switch (baseFormat) { + case GL_RED: + colorOut[0] = colorIn[0]; + colorOut[1] = 0.0F; + colorOut[2] = 0.0F; + colorOut[3] = 1.0F; + break; + case GL_RG: + colorOut[0] = colorIn[0]; + colorOut[1] = colorIn[1]; + colorOut[2] = 0.0F; + colorOut[3] = 1.0F; + break; + case GL_RGB: + colorOut[0] = colorIn[0]; + colorOut[1] = colorIn[1]; + colorOut[2] = colorIn[2]; + colorOut[3] = 1.0F; + break; + case GL_ALPHA: + colorOut[0] = colorOut[1] = colorOut[2] = 0.0; + colorOut[3] = colorIn[3]; + break; + case GL_LUMINANCE: + colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0]; + colorOut[3] = 1.0; + break; + case GL_LUMINANCE_ALPHA: + colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0]; + colorOut[3] = colorIn[3]; + break; + case GL_INTENSITY: + colorOut[0] = colorOut[1] = colorOut[2] = colorOut[3] = colorIn[0]; + break; + default: + COPY_4V(colorOut, colorIn); + } +} |