summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/fbobject.c3
-rw-r--r--src/mesa/main/format_unpack.c17
-rw-r--r--src/mesa/main/formats.c17
-rw-r--r--src/mesa/main/formats.h2
-rw-r--r--src/mesa/main/image.c2
-rw-r--r--src/mesa/main/texformat.c9
-rw-r--r--src/mesa/main/teximage.c1
-rw-r--r--src/mesa/main/texstore.c59
8 files changed, 110 insertions, 0 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 5b329f5c3e5..f63a8e7bec3 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1299,6 +1299,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_LUMINANCE_ALPHA32UI_EXT:
return ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
+
+ case GL_RGB10_A2UI:
+ return ctx->Extensions.ARB_texture_rgb10_a2ui ? GL_RGBA : 0;
default:
return 0;
}
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index 2f051dfa4bc..2d2e6a86819 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -1642,6 +1642,20 @@ unpack_int_rgba_INTENSITY_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
}
}
+static void
+unpack_int_rgba_ARGB2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ GLuint tmp = src[i];
+ dst[i][0] = (tmp >> 20) & 0x3ff;
+ dst[i][1] = (tmp >> 10) & 0x3ff;
+ dst[i][2] = (tmp >> 0) & 0x3ff;
+ dst[i][3] = (tmp >> 30) & 0x3;
+ }
+}
+
void
_mesa_unpack_int_rgba_row(gl_format format, GLuint n,
const void *src, GLuint dst[][4])
@@ -1680,6 +1694,9 @@ _mesa_unpack_int_rgba_row(gl_format format, GLuint n,
unpack_int_rgba_INTENSITY_UINT32(src, dst, n);
break;
+ case MESA_FORMAT_ARGB2101010_UINT:
+ unpack_int_rgba_ARGB2101010_UINT(src, dst, n);
+ break;
default:
_mesa_problem(NULL, "%s: bad format %s", __FUNCTION__,
_mesa_get_format_name(format));
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index b9871aec883..c88464641a9 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -1496,6 +1496,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
0, 0, 0, 32, 8, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 8 /* BlockWidth/Height,Bytes */
},
+ {
+ MESA_FORMAT_ARGB2101010_UINT,
+ "MESA_FORMAT_ARGB2101010_UINT",
+ GL_RGBA,
+ GL_UNSIGNED_INT,
+ 10, 10, 10, 2,
+ 0, 0, 0, 0, 0,
+ 1, 1, 4
+ },
};
@@ -2449,6 +2458,11 @@ _mesa_format_to_type_and_comps(gl_format format,
*comps = 3;
return;
+ case MESA_FORMAT_ARGB2101010_UINT:
+ *datatype = GL_UNSIGNED_INT_2_10_10_10_REV;
+ *comps = 4;
+ return;
+
case MESA_FORMAT_COUNT:
assert(0);
return;
@@ -2772,6 +2786,9 @@ _mesa_format_matches_format_and_type(gl_format gl_format,
/* FINISHME: SNORM */
return GL_FALSE;
+ case MESA_FORMAT_ARGB2101010_UINT:
+ return GL_FALSE;
+
case MESA_FORMAT_RGB9_E5_FLOAT:
return format == GL_RGB && type == GL_UNSIGNED_INT_5_9_9_9_REV;
case MESA_FORMAT_R11_G11_B10_FLOAT:
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 5f601862b32..86990929623 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -265,6 +265,8 @@ typedef enum
MESA_FORMAT_Z32_FLOAT,
MESA_FORMAT_Z32_FLOAT_X24S8,
+ MESA_FORMAT_ARGB2101010_UINT,
+
MESA_FORMAT_COUNT
} gl_format;
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 72e944e11ac..f32ca921a8d 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 ee9552bc0d9..6d8e272ba08 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 56335ad100b..2bc7abdc247 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 6deeb642ede..892f07da8bd 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -4254,6 +4254,64 @@ _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 +4504,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;
}