0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 1 /* BlockWidth/Height,Bytes */
},
+ {
+ MESA_FORMAT_A16, /* Name */
+ "MESA_FORMAT_A16", /* StrName */
+ GL_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED, /* DataType */
+ 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */
+ 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
+ 1, 1, 2 /* BlockWidth/Height,Bytes */
+ },
{
MESA_FORMAT_L8, /* Name */
"MESA_FORMAT_L8", /* StrName */
return;
case MESA_FORMAT_R16:
+ case MESA_FORMAT_A16:
*datatype = GL_UNSIGNED_SHORT;
*comps = 1;
return;
MESA_FORMAT_AL1616_REV, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
MESA_FORMAT_RGB332, /* RRRG GGBB */
MESA_FORMAT_A8, /* AAAA AAAA */
+ MESA_FORMAT_A16, /* AAAA AAAA AAAA AAAA */
MESA_FORMAT_L8, /* LLLL LLLL */
MESA_FORMAT_I8, /* IIII IIII */
MESA_FORMAT_CI8, /* CCCC CCCC */
fetch_texel_3d_f_a8,
store_texel_a8
},
+ {
+ MESA_FORMAT_A16,
+ fetch_texel_1d_f_a16,
+ fetch_texel_2d_f_a16,
+ fetch_texel_3d_f_a16,
+ store_texel_a16
+ },
{
MESA_FORMAT_L8,
fetch_texel_1d_f_l8,
#endif
+/* MESA_FORMAT_A16 ************************************************************/
+
+/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
+static void FETCH(f_a16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0.0F;
+ texel[ACOMP] = USHORT_TO_FLOAT( src[0] );
+}
+
+#if DIM == 3
+static void store_texel_a16(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLushort *rgba = (const GLushort *) texel;
+ GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ *dst = rgba[ACOMP];
+}
+#endif
+
+
/* MESA_FORMAT_L8 ************************************************************/
/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
/* Alpha formats */
case GL_ALPHA:
case GL_ALPHA4:
- case GL_ALPHA12:
- case GL_ALPHA16:
case GL_ALPHA8:
return MESA_FORMAT_A8;
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ return MESA_FORMAT_A16;
+
/* Luminance formats */
case 1:
case GL_LUMINANCE:
type == GL_UNSIGNED_BYTE) {
memCopy = GL_TRUE;
}
+ else if (texImage->TexFormat == MESA_FORMAT_A16 &&
+ format == GL_ALPHA &&
+ type == GL_UNSIGNED_SHORT) {
+ memCopy = GL_TRUE;
+ }
}
if (memCopy) {
}
+/* Texstore for R16, A16. */
static GLboolean
-_mesa_texstore_r16(TEXSTORE_PARAMS)
+_mesa_texstore_unorm16(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == MESA_FORMAT_R16);
+ ASSERT(dstFormat == MESA_FORMAT_R16 ||
+ dstFormat == MESA_FORMAT_A16);
ASSERT(texelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_R16 &&
- baseInternalFormat == GL_RED &&
- srcFormat == GL_RED &&
+ baseInternalFormat == srcFormat &&
srcType == GL_UNSIGNED_SHORT &&
littleEndian) {
/* simple memcpy path */
{ MESA_FORMAT_AL1616_REV, _mesa_texstore_unorm1616 },
{ MESA_FORMAT_RGB332, _mesa_texstore_rgb332 },
{ MESA_FORMAT_A8, _mesa_texstore_a8 },
+ { MESA_FORMAT_A16, _mesa_texstore_unorm16 },
{ MESA_FORMAT_L8, _mesa_texstore_a8 },
{ MESA_FORMAT_I8, _mesa_texstore_a8 },
{ MESA_FORMAT_CI8, _mesa_texstore_ci8 },
{ MESA_FORMAT_R8, _mesa_texstore_a8 },
{ MESA_FORMAT_RG88, _mesa_texstore_unorm88 },
{ MESA_FORMAT_RG88_REV, _mesa_texstore_unorm88 },
- { MESA_FORMAT_R16, _mesa_texstore_r16 },
+ { MESA_FORMAT_R16, _mesa_texstore_unorm16 },
{ MESA_FORMAT_RG1616, _mesa_texstore_unorm1616 },
{ MESA_FORMAT_RG1616_REV, _mesa_texstore_unorm1616 },
{ MESA_FORMAT_ARGB2101010, _mesa_texstore_argb2101010 },