{ "GL_EXT_texture", o(EXT_texture), GL, 1996 },
{ "GL_EXT_texture_rectangle", o(NV_texture_rectangle), GL, 2004 },
{ "GL_EXT_texture_shared_exponent", o(EXT_texture_shared_exponent), GL, 2004 },
+ { "GL_EXT_texture_snorm", o(EXT_texture_snorm), GL, 2009 },
{ "GL_EXT_texture_sRGB", o(EXT_texture_sRGB), GL, 2004 },
{ "GL_EXT_texture_sRGB_decode", o(EXT_texture_sRGB_decode), GL, 2006 },
{ "GL_EXT_texture_swizzle", o(EXT_texture_swizzle), GL, 2008 },
{ "GL_MESA_pack_invert", o(MESA_pack_invert), GL, 2002 },
{ "GL_MESA_resize_buffers", o(MESA_resize_buffers), GL, 1999 },
{ "GL_MESA_texture_array", o(MESA_texture_array), GL, 2007 },
- { "GL_MESA_texture_signed_rgba", o(MESA_texture_signed_rgba), GL, 2009 },
+ { "GL_MESA_texture_signed_rgba", o(EXT_texture_snorm), GL, 2009 },
{ "GL_MESA_window_pos", o(ARB_window_pos), GL, 2000 },
{ "GL_MESAX_texture_float", o(ARB_texture_float), GL, 2009 },
{ "GL_MESA_ycbcr_texture", o(MESA_ycbcr_texture), GL, 2002 },
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
- case GL_RGBA16_SNORM:
case GL_SRGB8_ALPHA8_EXT:
return GL_RGBA;
case GL_STENCIL_INDEX:
case GL_RG8:
case GL_RG16:
return ctx->Extensions.ARB_texture_rg ? GL_RG : 0;
+ /* signed normalized texture formats */
+ case GL_RED_SNORM:
+ case GL_R8_SNORM:
+ case GL_R16_SNORM:
+ return ctx->Extensions.EXT_texture_snorm ? GL_RED : 0;
+ case GL_RG_SNORM:
+ case GL_RG8_SNORM:
+ case GL_RG16_SNORM:
+ return ctx->Extensions.EXT_texture_snorm ? GL_RG : 0;
+ case GL_RGB_SNORM:
+ case GL_RGB8_SNORM:
+ case GL_RGB16_SNORM:
+ return ctx->Extensions.EXT_texture_snorm ? GL_RGB : 0;
+ case GL_RGBA_SNORM:
+ case GL_RGBA8_SNORM:
+ case GL_RGBA16_SNORM:
+ return ctx->Extensions.EXT_texture_snorm ? GL_RGBA : 0;
+ case GL_ALPHA_SNORM:
+ case GL_ALPHA8_SNORM:
+ case GL_ALPHA16_SNORM:
+ return ctx->Extensions.EXT_texture_snorm &&
+ ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
+ case GL_LUMINANCE_SNORM:
+ case GL_LUMINANCE8_SNORM:
+ case GL_LUMINANCE16_SNORM:
+ return ctx->Extensions.EXT_texture_snorm &&
+ ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
+ case GL_LUMINANCE_ALPHA_SNORM:
+ case GL_LUMINANCE8_ALPHA8_SNORM:
+ case GL_LUMINANCE16_ALPHA16_SNORM:
+ return ctx->Extensions.EXT_texture_snorm &&
+ ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
+ case GL_INTENSITY_SNORM:
+ case GL_INTENSITY8_SNORM:
+ case GL_INTENSITY16_SNORM:
+ return ctx->Extensions.EXT_texture_snorm &&
+ ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
/* XXX add floating point and integer formats eventually */
default:
return 0;
1, 1, 1 /* BlockWidth/Height,Bytes */
},
{
- MESA_FORMAT_SIGNED_RG88,
- "MESA_FORMAT_SIGNED_RG88",
+ MESA_FORMAT_SIGNED_RG88_REV,
+ "MESA_FORMAT_SIGNED_RG88_REV",
GL_RG,
GL_SIGNED_NORMALIZED,
8, 8, 0, 0,
/* Signed 16 bits / channel */
{
- MESA_FORMAT_SIGNED_R_16,
- "MESA_FORMAT_SIGNED_R_16",
+ MESA_FORMAT_SIGNED_R16,
+ "MESA_FORMAT_SIGNED_R16",
GL_RED,
GL_SIGNED_NORMALIZED,
16, 0, 0, 0,
1, 1, 2
},
{
- MESA_FORMAT_SIGNED_RG_16,
- "MESA_FORMAT_SIGNED_RG_16",
+ MESA_FORMAT_SIGNED_GR1616,
+ "MESA_FORMAT_SIGNED_GR1616",
GL_RG,
GL_SIGNED_NORMALIZED,
16, 16, 0, 0,
4, 0, 0, 0, 0,
4, 4, 16 /* 16 bytes per 4x4 block */
},
+
+ /* Signed formats from EXT_texture_snorm that are not in GL3.1 */
+ {
+ MESA_FORMAT_SIGNED_A8,
+ "MESA_FORMAT_SIGNED_A8",
+ GL_ALPHA,
+ GL_SIGNED_NORMALIZED,
+ 0, 0, 0, 8,
+ 0, 0, 0, 0, 0,
+ 1, 1, 1
+ },
+ {
+ MESA_FORMAT_SIGNED_L8,
+ "MESA_FORMAT_SIGNED_L8",
+ GL_LUMINANCE,
+ GL_SIGNED_NORMALIZED,
+ 0, 0, 0, 0,
+ 8, 0, 0, 0, 0,
+ 1, 1, 1
+ },
+ {
+ MESA_FORMAT_SIGNED_AL88,
+ "MESA_FORMAT_SIGNED_AL88",
+ GL_LUMINANCE_ALPHA,
+ GL_SIGNED_NORMALIZED,
+ 0, 0, 0, 8,
+ 8, 0, 0, 0, 0,
+ 1, 1, 2
+ },
+ {
+ MESA_FORMAT_SIGNED_I8,
+ "MESA_FORMAT_SIGNED_I8",
+ GL_INTENSITY,
+ GL_SIGNED_NORMALIZED,
+ 0, 0, 0, 0,
+ 0, 8, 0, 0, 0,
+ 1, 1, 1
+ },
+ {
+ MESA_FORMAT_SIGNED_A16,
+ "MESA_FORMAT_SIGNED_A16",
+ GL_ALPHA,
+ GL_SIGNED_NORMALIZED,
+ 0, 0, 0, 16,
+ 0, 0, 0, 0, 0,
+ 1, 1, 2
+ },
+ {
+ MESA_FORMAT_SIGNED_L16,
+ "MESA_FORMAT_SIGNED_L16",
+ GL_LUMINANCE,
+ GL_SIGNED_NORMALIZED,
+ 0, 0, 0, 0,
+ 16, 0, 0, 0, 0,
+ 1, 1, 2
+ },
+ {
+ MESA_FORMAT_SIGNED_AL1616,
+ "MESA_FORMAT_SIGNED_AL1616",
+ GL_LUMINANCE_ALPHA,
+ GL_SIGNED_NORMALIZED,
+ 0, 0, 0, 16,
+ 16, 0, 0, 0, 0,
+ 1, 1, 4
+ },
+ {
+ MESA_FORMAT_SIGNED_I16,
+ "MESA_FORMAT_SIGNED_I16",
+ GL_INTENSITY,
+ GL_SIGNED_NORMALIZED,
+ 0, 0, 0, 0,
+ 0, 16, 0, 0, 0,
+ 1, 1, 2
+ }
};
return;
case MESA_FORMAT_SIGNED_R8:
+ case MESA_FORMAT_SIGNED_A8:
+ case MESA_FORMAT_SIGNED_L8:
+ case MESA_FORMAT_SIGNED_I8:
*datatype = GL_BYTE;
*comps = 1;
return;
- case MESA_FORMAT_SIGNED_RG88:
+ case MESA_FORMAT_SIGNED_RG88_REV:
+ case MESA_FORMAT_SIGNED_AL88:
*datatype = GL_BYTE;
*comps = 2;
return;
*comps = 4;
return;
- case MESA_FORMAT_SIGNED_R_16:
+ case MESA_FORMAT_SIGNED_R16:
+ case MESA_FORMAT_SIGNED_A16:
+ case MESA_FORMAT_SIGNED_L16:
+ case MESA_FORMAT_SIGNED_I16:
*datatype = GL_SHORT;
*comps = 1;
return;
- case MESA_FORMAT_SIGNED_RG_16:
+ case MESA_FORMAT_SIGNED_GR1616:
+ case MESA_FORMAT_SIGNED_AL1616:
*datatype = GL_SHORT;
*comps = 2;
return;
/*@{*/
MESA_FORMAT_DUDV8, /* DUDU DUDU DVDV DVDV */
MESA_FORMAT_SIGNED_R8, /* RRRR RRRR */
- MESA_FORMAT_SIGNED_RG88, /* RRRR RRRR GGGG GGGG */
+ MESA_FORMAT_SIGNED_RG88_REV, /* GGGG GGGG RRRR RRRR */
MESA_FORMAT_SIGNED_RGBX8888, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
MESA_FORMAT_SIGNED_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
MESA_FORMAT_SIGNED_RGBA8888_REV,/*AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
- MESA_FORMAT_SIGNED_R_16, /* ushort[0]=R */
- MESA_FORMAT_SIGNED_RG_16, /* ushort[0]=R, ushort[1]=G */
+ MESA_FORMAT_SIGNED_R16, /* RRRR RRRR RRRR RRRR */
+ MESA_FORMAT_SIGNED_GR1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
MESA_FORMAT_SIGNED_RGB_16, /* ushort[0]=R, ushort[1]=G, ushort[2]=B */
MESA_FORMAT_SIGNED_RGBA_16, /* ... */
MESA_FORMAT_RGBA_16, /* ... */
MESA_FORMAT_SIGNED_LA_LATC2,
/*@}*/
+ MESA_FORMAT_SIGNED_A8, /* AAAA AAAA */
+ MESA_FORMAT_SIGNED_L8, /* LLLL LLLL */
+ MESA_FORMAT_SIGNED_AL88, /* AAAA AAAA LLLL LLLL */
+ MESA_FORMAT_SIGNED_I8, /* IIII IIII */
+ MESA_FORMAT_SIGNED_A16, /* AAAA AAAA AAAA AAAA */
+ MESA_FORMAT_SIGNED_L16, /* LLLL LLLL LLLL LLLL */
+ MESA_FORMAT_SIGNED_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
+ MESA_FORMAT_SIGNED_I16, /* IIII IIII IIII IIII */
+
MESA_FORMAT_COUNT
} gl_format;
case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
- /* signed, normalized texture formats */
- case GL_RGBA_SNORM:
- case GL_RGBA8_SNORM:
/* generic integer formats */
case GL_RED_INTEGER_EXT:
case GL_GREEN_INTEGER_EXT:
case GL_INTENSITY8I_EXT:
case GL_LUMINANCE8I_EXT:
case GL_LUMINANCE_ALPHA8I_EXT:
+ /* signed, normalized texture formats */
+ case GL_RED_SNORM:
+ case GL_R8_SNORM:
+ case GL_R16_SNORM:
+ case GL_RG_SNORM:
+ case GL_RG8_SNORM:
+ case GL_RG16_SNORM:
+ case GL_RGB_SNORM:
+ case GL_RGB8_SNORM:
+ case GL_RGB16_SNORM:
+ case GL_RGBA_SNORM:
+ case GL_RGBA8_SNORM:
+ case GL_RGBA16_SNORM:
+ case GL_ALPHA_SNORM:
+ case GL_ALPHA8_SNORM:
+ case GL_ALPHA16_SNORM:
+ case GL_LUMINANCE_SNORM:
+ case GL_LUMINANCE8_SNORM:
+ case GL_LUMINANCE16_SNORM:
+ case GL_LUMINANCE_ALPHA_SNORM:
+ case GL_LUMINANCE8_ALPHA8_SNORM:
+ case GL_LUMINANCE16_ALPHA16_SNORM:
+ case GL_INTENSITY_SNORM:
+ case GL_INTENSITY8_SNORM:
+ case GL_INTENSITY16_SNORM:
return GL_TRUE;
case GL_YCBCR_MESA: /* not considered to be RGB */
/* fall-through */
#define BYTE_TO_FLOAT_TEX(B) ((B) == -128 ? -1.0F : (B) * (1.0F/127.0F))
/** Convert GLfloat in [-1.0,1.0] to GLbyte in [-128,127], texture/fb data */
-#define FLOAT_TO_BYTE_TEX(X) ( (GLint) (127.0F * (X)) )
-
+#define FLOAT_TO_BYTE_TEX(X) CLAMP( (GLint) (127.0F * (X)), -128, 127 )
/** Convert GLushort in [0,65535] to GLfloat in [0.0,1.0] */
#define USHORT_TO_FLOAT(S) ((GLfloat) (S) * (1.0F / 65535.0F))
GLboolean EXT_texture_lod_bias;
GLboolean EXT_texture_mirror_clamp;
GLboolean EXT_texture_shared_exponent;
+ GLboolean EXT_texture_snorm;
GLboolean EXT_texture_sRGB;
GLboolean EXT_texture_sRGB_decode;
GLboolean EXT_texture_swizzle;
GLboolean MESA_resize_buffers;
GLboolean MESA_ycbcr_texture;
GLboolean MESA_texture_array;
- GLboolean MESA_texture_signed_rgba;
GLboolean NV_blend_square;
GLboolean NV_conditional_render;
GLboolean NV_fragment_program;
}
}
- if (ctx->Extensions.MESA_texture_signed_rgba) {
- switch (internalFormat) {
- case GL_RGBA_SNORM:
- case GL_RGBA8_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
- break;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->VersionMajor * 10 + ctx->VersionMinor >= 31) {
+ if (ctx->Extensions.EXT_texture_snorm) {
switch (internalFormat) {
case GL_RED_SNORM:
case GL_R8_SNORM:
break;
case GL_RG_SNORM:
case GL_RG8_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG88);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG88_REV);
break;
case GL_RGB_SNORM:
case GL_RGB8_SNORM:
case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
break;
+ case GL_ALPHA_SNORM:
+ case GL_ALPHA8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A8);
+ break;
+ case GL_LUMINANCE_SNORM:
+ case GL_LUMINANCE8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L8);
+ break;
+ case GL_LUMINANCE_ALPHA_SNORM:
+ case GL_LUMINANCE8_ALPHA8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL88);
+ break;
+ case GL_INTENSITY_SNORM:
+ case GL_INTENSITY8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I8);
+ break;
case GL_R16_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R16);
break;
case GL_RG16_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_GR1616);
break;
case GL_RGB16_SNORM:
RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGB_16);
case GL_RGBA16_SNORM:
RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16);
break;
+ case GL_ALPHA16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A16);
+ break;
+ case GL_LUMINANCE16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L16);
+ break;
+ case GL_LUMINANCE16_ALPHA16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL1616);
+ break;
+ case GL_INTENSITY16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I16);
+ break;
default:
; /* fall-through */
}
}
}
- if (ctx->Extensions.MESA_texture_signed_rgba) {
+ if (ctx->Extensions.EXT_texture_snorm) {
switch (internalFormat) {
+ case GL_RED_SNORM:
+ case GL_R8_SNORM:
+ case GL_R16_SNORM:
+ return GL_RED;
+ case GL_RG_SNORM:
+ case GL_RG8_SNORM:
+ case GL_RG16_SNORM:
+ return GL_RG;
+ case GL_RGB_SNORM:
+ case GL_RGB8_SNORM:
+ case GL_RGB16_SNORM:
+ return GL_RGB;
case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
+ case GL_RGBA16_SNORM:
return GL_RGBA;
+ case GL_ALPHA_SNORM:
+ case GL_ALPHA8_SNORM:
+ case GL_ALPHA16_SNORM:
+ return GL_ALPHA;
+ case GL_LUMINANCE_SNORM:
+ case GL_LUMINANCE8_SNORM:
+ case GL_LUMINANCE16_SNORM:
+ return GL_LUMINANCE;
+ case GL_LUMINANCE_ALPHA_SNORM:
+ case GL_LUMINANCE8_ALPHA8_SNORM:
+ case GL_LUMINANCE16_ALPHA16_SNORM:
+ return GL_LUMINANCE_ALPHA;
+ case GL_INTENSITY_SNORM:
+ case GL_INTENSITY8_SNORM:
+ case GL_INTENSITY16_SNORM:
+ return GL_INTENSITY;
default:
; /* fallthrough */
}
ctx->Extensions.ARB_draw_instanced &&
ctx->Extensions.ARB_texture_buffer_object &&
ctx->Extensions.ARB_uniform_buffer_object &&
+ ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.NV_primitive_restart &&
ctx->Extensions.NV_texture_rectangle &&
ctx->Const.MaxVertexTextureImageUnits >= 16);