From: Dave Airlie <airl...@redhat.com> This just adds the texstorage and format handling for ARB_texture_rgb10_a2ui
Signed-off-by: Dave Airlie <airl...@redhat.com> --- src/mesa/main/image.c | 2 + src/mesa/main/texformat.c | 9 +++++++ src/mesa/main/teximage.c | 1 + src/mesa/main/texstore.c | 58 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 72e944e..f32ca92 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -816,6 +816,7 @@ _mesa_is_color_format(GLenum format) case GL_INTENSITY16_SNORM: case GL_RGB9_E5: case GL_R11F_G11F_B10F: + case GL_RGB10_A2UI: return GL_TRUE; case GL_YCBCR_MESA: /* not considered to be RGB */ /* fall-through */ @@ -1002,6 +1003,7 @@ _mesa_is_integer_format(GLenum format) case GL_INTENSITY8I_EXT: case GL_LUMINANCE8I_EXT: case GL_LUMINANCE_ALPHA8I_EXT: + case GL_RGB10_A2UI: return GL_TRUE; default: return GL_FALSE; diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index ee9552b..1c6e9e2 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -849,6 +849,15 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, } } + if (ctx->Extensions.ARB_texture_rgb10_a2ui) { + switch (internalFormat) { + case GL_RGB10_A2UI: + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010_UINT); + break; + default: + break; + } + } /* GL_BGRA can be an internal format *only* in OpenGL ES (1.x or 2.0). */ if (ctx->API != API_OPENGL) { diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 56335ad..2bc7abd 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -331,6 +331,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) case GL_RGBA8I_EXT: case GL_RGBA16I_EXT: case GL_RGBA32I_EXT: + case GL_RGB10_A2UI: return GL_RGBA; case GL_RGB8UI_EXT: case GL_RGB16UI_EXT: diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 6deeb64..4c47976 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -4254,6 +4254,63 @@ _mesa_texstore_z32f_x24s8(TEXSTORE_PARAMS) } static GLboolean +_mesa_texstore_argb2101010_uint(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + + ASSERT(dstFormat == MESA_FORMAT_ARGB2101010_UINT); + ASSERT(texelBytes == 4); + + if (!srcPacking->SwapBytes && + dstFormat == MESA_FORMAT_ARGB2101010_UINT && + srcFormat == GL_BGRA_INTEGER_EXT && + srcType == GL_UNSIGNED_INT_2_10_10_10_REV && + baseInternalFormat == GL_RGBA) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLuint *tempImage = make_temp_uint_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLuint *src = tempImage; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstSlices[dstZoffset + img] + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + + for (row = 0; row < srcHeight; row++) { + GLuint *dstUI = (GLuint *) dstRow; + for (col = 0; col < srcWidth; col++) { + GLushort a,r,g,b; + r = src[RCOMP]; + g = src[GCOMP]; + b = src[BCOMP]; + a = src[ACOMP]; + dstUI[col] = (a << 30) | (r << 20) | (g << 10) | (b); + src += 4; + } + dstRow += dstRowStride; + } + } + free((void *) tempImage); + } + return GL_TRUE; +} + +static GLboolean _mesa_texstore_null(TEXSTORE_PARAMS) { (void) ctx; (void) dims; @@ -4446,6 +4503,7 @@ _mesa_get_texstore_func(gl_format format) table[MESA_FORMAT_RGB_UINT32] = _mesa_texstore_rgba_uint32; table[MESA_FORMAT_RGBA_UINT32] = _mesa_texstore_rgba_uint32; + table[MESA_FORMAT_ARGB2101010_UINT] = _mesa_texstore_argb2101010_uint; initialized = GL_TRUE; } -- 1.7.7.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev