diff options
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/extensions.c | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/main/fbobject.c | 13 | ||||
-rw-r--r-- | mesalib/src/mesa/main/formats.c | 30 | ||||
-rw-r--r-- | mesalib/src/mesa/main/formats.h | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/main/image.c | 22 | ||||
-rw-r--r-- | mesalib/src/mesa/main/mipmap.c | 96 | ||||
-rw-r--r-- | mesalib/src/mesa/main/pack.c | 153 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texfetch.c | 16 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texfetch_tmp.h | 42 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texformat.c | 20 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texparam.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texrender.c | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texstore.c | 110 | ||||
-rw-r--r-- | mesalib/src/mesa/main/transformfeedback.c | 18 | ||||
-rw-r--r-- | mesalib/src/mesa/main/varray.c | 23 |
15 files changed, 524 insertions, 38 deletions
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 109cadd95..d31477731 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -502,6 +502,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE;
ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
+ ctx->Extensions.EXT_texture_shared_exponent = GL_TRUE;
#if FEATURE_EXT_texture_sRGB
ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
ctx->Extensions.EXT_texture_sRGB_decode = GL_TRUE;
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index a961e68cb..68a141d29 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -418,6 +418,15 @@ _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) case GL_RG:
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED;
return;
+ case GL_RGB:
+ switch (rb->Format) {
+ case MESA_FORMAT_RGB9_E5_FLOAT:
+ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED;
+ return;
+ default:;
+ }
+ break;
+
default:
/* render buffer format is supported by software rendering */
;
@@ -1175,6 +1184,10 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_INTENSITY32F_ARB:
return ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
+ case GL_RGB9_E5:
+ return ctx->Extensions.EXT_texture_shared_exponent ? GL_RGB : 0;
+ case GL_R11F_G11F_B10F:
+ return ctx->Extensions.EXT_packed_float ? GL_RGB : 0;
/* XXX add integer formats eventually */
default:
return 0;
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index 5ae8e2e29..f0f30fe0a 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -1072,7 +1072,25 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0,
0, 16, 0, 0, 0,
1, 1, 2
- }
+ },
+ {
+ MESA_FORMAT_RGB9_E5_FLOAT,
+ "MESA_FORMAT_RGB9_E5",
+ GL_RGB,
+ GL_FLOAT,
+ 9, 9, 9, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 4
+ },
+ {
+ MESA_FORMAT_R11_G11_B10_FLOAT,
+ "MESA_FORMAT_R11_G11_B10_FLOAT",
+ GL_RGB,
+ GL_FLOAT,
+ 11, 11, 10, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 4
+ },
};
@@ -1803,6 +1821,16 @@ _mesa_format_to_type_and_comps(gl_format format, *comps = 4;
return;
+ case MESA_FORMAT_RGB9_E5_FLOAT:
+ *datatype = GL_UNSIGNED_INT_5_9_9_9_REV;
+ *comps = 3;
+ return;
+
+ case MESA_FORMAT_R11_G11_B10_FLOAT:
+ *datatype = GL_UNSIGNED_INT_10F_11F_11F_REV;
+ *comps = 3;
+ return;
+
case MESA_FORMAT_COUNT:
assert(0);
return;
diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h index 492eef917..c9fd0baab 100644 --- a/mesalib/src/mesa/main/formats.h +++ b/mesalib/src/mesa/main/formats.h @@ -206,6 +206,9 @@ typedef enum MESA_FORMAT_SIGNED_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
MESA_FORMAT_SIGNED_I16, /* IIII IIII IIII IIII */
+ MESA_FORMAT_RGB9_E5_FLOAT,
+ MESA_FORMAT_R11_G11_B10_FLOAT,
+
MESA_FORMAT_COUNT
} gl_format;
diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c index 4bbbbdb37..a5cd5ac03 100644 --- a/mesalib/src/mesa/main/image.c +++ b/mesalib/src/mesa/main/image.c @@ -82,6 +82,8 @@ _mesa_type_is_packed(GLenum type) case GL_UNSIGNED_SHORT_8_8_MESA:
case GL_UNSIGNED_SHORT_8_8_REV_MESA:
case GL_UNSIGNED_INT_24_8_EXT:
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
return GL_TRUE;
}
@@ -222,6 +224,10 @@ _mesa_sizeof_packed_type( GLenum type ) return sizeof(GLushort);
case GL_UNSIGNED_INT_24_8_EXT:
return sizeof(GLuint);
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ return sizeof(GLuint);
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ return sizeof(GLuint);
default:
return -1;
}
@@ -363,6 +369,16 @@ _mesa_bytes_per_pixel( GLenum format, GLenum type ) return sizeof(GLuint);
else
return -1;
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ if (format == GL_RGB)
+ return sizeof(GLuint);
+ else
+ return -1;
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ if (format == GL_RGB)
+ return sizeof(GLuint);
+ else
+ return -1;
default:
return -1;
}
@@ -458,6 +474,10 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx, return GL_TRUE;
case GL_HALF_FLOAT_ARB:
return ctx->Extensions.ARB_half_float_pixel;
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ return ctx->Extensions.EXT_texture_shared_exponent;
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ return ctx->Extensions.EXT_packed_float;
default:
return GL_FALSE;
}
@@ -821,6 +841,8 @@ _mesa_is_color_format(GLenum format) case GL_INTENSITY_SNORM:
case GL_INTENSITY8_SNORM:
case GL_INTENSITY16_SNORM:
+ case GL_RGB9_E5:
+ case GL_R11F_G11F_B10F:
return GL_TRUE;
case GL_YCBCR_MESA: /* not considered to be RGB */
/* fall-through */
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c index b0b0c0c13..ed93cbc6c 100644 --- a/mesalib/src/mesa/main/mipmap.c +++ b/mesalib/src/mesa/main/mipmap.c @@ -34,6 +34,9 @@ #include "teximage.h"
#include "texstore.h"
#include "image.h"
+#include "macros.h"
+#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
+#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
@@ -665,6 +668,44 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, }
}
+ else if (datatype == GL_UNSIGNED_INT_5_9_9_9_REV && comps == 3) {
+ GLuint i, j, k;
+ const GLuint *rowA = (const GLuint*) srcRowA;
+ const GLuint *rowB = (const GLuint*) srcRowB;
+ GLuint *dst = (GLuint*)dstRow;
+ GLfloat res[3], rowAj[3], rowBj[3], rowAk[3], rowBk[3];
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ rgb9e5_to_float3(rowA[j], rowAj);
+ rgb9e5_to_float3(rowB[j], rowBj);
+ rgb9e5_to_float3(rowA[k], rowAk);
+ rgb9e5_to_float3(rowB[k], rowBk);
+ res[0] = (rowAj[0] + rowAk[0] + rowBj[0] + rowBk[0]) * 0.25F;
+ res[1] = (rowAj[1] + rowAk[1] + rowBj[1] + rowBk[1]) * 0.25F;
+ res[2] = (rowAj[2] + rowAk[2] + rowBj[2] + rowBk[2]) * 0.25F;
+ dst[i] = float3_to_rgb9e5(res);
+ }
+ }
+
+ else if (datatype == GL_UNSIGNED_INT_10F_11F_11F_REV && comps == 3) {
+ GLuint i, j, k;
+ const GLuint *rowA = (const GLuint*) srcRowA;
+ const GLuint *rowB = (const GLuint*) srcRowB;
+ GLuint *dst = (GLuint*)dstRow;
+ GLfloat res[3], rowAj[3], rowBj[3], rowAk[3], rowBk[3];
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ r11g11b10f_to_float3(rowA[j], rowAj);
+ r11g11b10f_to_float3(rowB[j], rowBj);
+ r11g11b10f_to_float3(rowA[k], rowAk);
+ r11g11b10f_to_float3(rowB[k], rowBk);
+ res[0] = (rowAj[0] + rowAk[0] + rowBj[0] + rowBk[0]) * 0.25F;
+ res[1] = (rowAj[1] + rowAk[1] + rowBj[1] + rowBk[1]) * 0.25F;
+ res[2] = (rowAj[2] + rowAk[2] + rowBj[2] + rowBk[2]) * 0.25F;
+ dst[i] = float3_to_r11g11b10f(res);
+ }
+ }
+
else {
_mesa_problem(NULL, "bad format in do_row()");
}
@@ -1245,6 +1286,61 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth, dst[i] = (a << 30) | (b << 20) | (g << 10) | r;
}
}
+
+ else if (datatype == GL_UNSIGNED_INT_5_9_9_9_REV && comps == 3) {
+ DECLARE_ROW_POINTERS0(GLuint);
+
+ GLfloat res[3];
+ GLfloat rowAj[3], rowBj[3], rowCj[3], rowDj[3];
+ GLfloat rowAk[3], rowBk[3], rowCk[3], rowDk[3];
+
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ rgb9e5_to_float3(rowA[j], rowAj);
+ rgb9e5_to_float3(rowB[j], rowBj);
+ rgb9e5_to_float3(rowC[j], rowCj);
+ rgb9e5_to_float3(rowD[j], rowDj);
+ rgb9e5_to_float3(rowA[k], rowAk);
+ rgb9e5_to_float3(rowB[k], rowBk);
+ rgb9e5_to_float3(rowC[k], rowCk);
+ rgb9e5_to_float3(rowD[k], rowDk);
+ res[0] = (rowAj[0] + rowAk[0] + rowBj[0] + rowBk[0] +
+ rowCj[0] + rowCk[0] + rowDj[0] + rowDk[0]) * 0.125F;
+ res[1] = (rowAj[1] + rowAk[1] + rowBj[1] + rowBk[1] +
+ rowCj[1] + rowCk[1] + rowDj[1] + rowDk[1]) * 0.125F;
+ res[2] = (rowAj[2] + rowAk[2] + rowBj[2] + rowBk[2] +
+ rowCj[2] + rowCk[2] + rowDj[2] + rowDk[2]) * 0.125F;
+ dst[i] = float3_to_rgb9e5(res);
+ }
+ }
+
+ else if (datatype == GL_UNSIGNED_INT_10F_11F_11F_REV && comps == 3) {
+ DECLARE_ROW_POINTERS0(GLuint);
+
+ GLfloat res[3];
+ GLfloat rowAj[3], rowBj[3], rowCj[3], rowDj[3];
+ GLfloat rowAk[3], rowBk[3], rowCk[3], rowDk[3];
+
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ r11g11b10f_to_float3(rowA[j], rowAj);
+ r11g11b10f_to_float3(rowB[j], rowBj);
+ r11g11b10f_to_float3(rowC[j], rowCj);
+ r11g11b10f_to_float3(rowD[j], rowDj);
+ r11g11b10f_to_float3(rowA[k], rowAk);
+ r11g11b10f_to_float3(rowB[k], rowBk);
+ r11g11b10f_to_float3(rowC[k], rowCk);
+ r11g11b10f_to_float3(rowD[k], rowDk);
+ res[0] = (rowAj[0] + rowAk[0] + rowBj[0] + rowBk[0] +
+ rowCj[0] + rowCk[0] + rowDj[0] + rowDk[0]) * 0.125F;
+ res[1] = (rowAj[1] + rowAk[1] + rowBj[1] + rowBk[1] +
+ rowCj[1] + rowCk[1] + rowDj[1] + rowDk[1]) * 0.125F;
+ res[2] = (rowAj[2] + rowAk[2] + rowBj[2] + rowBk[2] +
+ rowCj[2] + rowCk[2] + rowDj[2] + rowDk[2]) * 0.125F;
+ dst[i] = float3_to_r11g11b10f(res);
+ }
+ }
+
else {
_mesa_problem(NULL, "bad format in do_row()");
}
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c index 620c8a5cd..e6734bbbc 100644 --- a/mesalib/src/mesa/main/pack.c +++ b/mesalib/src/mesa/main/pack.c @@ -37,6 +37,9 @@ #include "mtypes.h"
#include "pack.h"
#include "pixeltransfer.h"
+#include "imports.h"
+#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
+#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
/**
@@ -1892,6 +1895,22 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4], }
}
break;
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i = 0; i < n; i++) {
+ dst[i] = float3_to_rgb9e5(rgba[i]);
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i = 0; i < n; i++) {
+ dst[i] = float3_to_r11g11b10f(rgba[i]);
+ }
+ }
+ break;
default:
_mesa_problem(ctx, "bad type in _mesa_pack_rgba_span_float");
return;
@@ -2330,7 +2349,9 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], srcType == GL_UNSIGNED_INT_8_8_8_8 ||
srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
srcType == GL_UNSIGNED_INT_10_10_10_2 ||
- srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
+ srcType == GL_UNSIGNED_INT_2_10_10_10_REV ||
+ srcType == GL_UNSIGNED_INT_5_9_9_9_REV ||
+ srcType == GL_UNSIGNED_INT_10F_11F_11F_REV);
get_component_mapping(srcFormat,
&rSrc, &gSrc, &bSrc, &aSrc,
@@ -2800,6 +2821,62 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], }
}
break;
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ if (swapBytes) {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ GLfloat f[3];
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ SWAP4BYTE(p);
+ rgb9e5_to_float3(p, f);
+ rgba[i][rDst] = f[0];
+ rgba[i][gDst] = f[1];
+ rgba[i][bDst] = f[2];
+ rgba[i][aDst] = 1.0F;
+ }
+ }
+ else {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ GLfloat f[3];
+ for (i = 0; i < n; i ++) {
+ rgb9e5_to_float3(uisrc[i], f);
+ rgba[i][rDst] = f[0];
+ rgba[i][gDst] = f[1];
+ rgba[i][bDst] = f[2];
+ rgba[i][aDst] = 1.0F;
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ if (swapBytes) {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ GLfloat f[3];
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ SWAP4BYTE(p);
+ r11g11b10f_to_float3(p, f);
+ rgba[i][rDst] = f[0];
+ rgba[i][gDst] = f[1];
+ rgba[i][bDst] = f[2];
+ rgba[i][aDst] = 1.0F;
+ }
+ }
+ else {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ GLfloat f[3];
+ for (i = 0; i < n; i ++) {
+ r11g11b10f_to_float3(uisrc[i], f);
+ rgba[i][rDst] = f[0];
+ rgba[i][gDst] = f[1];
+ rgba[i][bDst] = f[2];
+ rgba[i][aDst] = 1.0F;
+ }
+ }
+ break;
default:
_mesa_problem(NULL, "bad srcType in extract float data");
break;
@@ -2902,7 +2979,9 @@ extract_uint_rgba(GLuint n, GLuint rgba[][4], srcType == GL_UNSIGNED_INT_8_8_8_8 ||
srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
srcType == GL_UNSIGNED_INT_10_10_10_2 ||
- srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
+ srcType == GL_UNSIGNED_INT_2_10_10_10_REV ||
+ srcType == GL_UNSIGNED_INT_5_9_9_9_REV ||
+ srcType == GL_UNSIGNED_INT_10F_11F_11F_REV);
get_component_mapping(srcFormat,
&rSrc, &gSrc, &bSrc, &aSrc,
@@ -3266,6 +3345,64 @@ extract_uint_rgba(GLuint n, GLuint rgba[][4], }
}
break;
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ if (swapBytes) {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ float f[3];
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ SWAP4BYTE(p);
+ rgb9e5_to_float3(p, f);
+ rgba[i][rDst] = clamp_float_to_uint(f[0]);
+ rgba[i][gDst] = clamp_float_to_uint(f[1]);
+ rgba[i][bDst] = clamp_float_to_uint(f[2]);
+ rgba[i][aDst] = 1;
+ }
+ }
+ else {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ float f[3];
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ rgb9e5_to_float3(p, f);
+ rgba[i][rDst] = clamp_float_to_uint(f[0]);
+ rgba[i][gDst] = clamp_float_to_uint(f[1]);
+ rgba[i][bDst] = clamp_float_to_uint(f[2]);
+ rgba[i][aDst] = 1;
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ if (swapBytes) {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ float f[3];
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ SWAP4BYTE(p);
+ r11g11b10f_to_float3(p, f);
+ rgba[i][rDst] = clamp_float_to_uint(f[0]);
+ rgba[i][gDst] = clamp_float_to_uint(f[1]);
+ rgba[i][bDst] = clamp_float_to_uint(f[2]);
+ rgba[i][aDst] = 1;
+ }
+ }
+ else {
+ const GLuint *uisrc = (const GLuint *) src;
+ GLuint i;
+ float f[3];
+ for (i = 0; i < n; i ++) {
+ GLuint p = uisrc[i];
+ r11g11b10f_to_float3(p, f);
+ rgba[i][rDst] = clamp_float_to_uint(f[0]);
+ rgba[i][gDst] = clamp_float_to_uint(f[1]);
+ rgba[i][bDst] = clamp_float_to_uint(f[2]);
+ rgba[i][aDst] = 1;
+ }
+ }
+ break;
default:
_mesa_problem(NULL, "bad srcType in extract uint data");
break;
@@ -3345,7 +3482,9 @@ _mesa_unpack_color_span_chan( struct gl_context *ctx, srcType == GL_UNSIGNED_INT_8_8_8_8 ||
srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
srcType == GL_UNSIGNED_INT_10_10_10_2 ||
- srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
+ srcType == GL_UNSIGNED_INT_2_10_10_10_REV ||
+ srcType == GL_UNSIGNED_INT_5_9_9_9_REV ||
+ srcType == GL_UNSIGNED_INT_10F_11F_11F_REV);
/* Try simple cases first */
if (transferOps == 0) {
@@ -3667,7 +3806,9 @@ _mesa_unpack_color_span_float( struct gl_context *ctx, srcType == GL_UNSIGNED_INT_8_8_8_8 ||
srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
srcType == GL_UNSIGNED_INT_10_10_10_2 ||
- srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
+ srcType == GL_UNSIGNED_INT_2_10_10_10_REV ||
+ srcType == GL_UNSIGNED_INT_5_9_9_9_REV ||
+ srcType == GL_UNSIGNED_INT_10F_11F_11F_REV);
/* general solution, no special cases, yet */
{
@@ -3873,7 +4014,9 @@ _mesa_unpack_color_span_uint(struct gl_context *ctx, srcType == GL_UNSIGNED_INT_8_8_8_8 ||
srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
srcType == GL_UNSIGNED_INT_10_10_10_2 ||
- srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
+ srcType == GL_UNSIGNED_INT_2_10_10_10_REV ||
+ srcType == GL_UNSIGNED_INT_5_9_9_9_REV ||
+ srcType == GL_UNSIGNED_INT_10F_11F_11F_REV);
/* Extract image data as uint[4] pixels */
diff --git a/mesalib/src/mesa/main/texfetch.c b/mesalib/src/mesa/main/texfetch.c index cb2716619..ab3abf657 100644 --- a/mesalib/src/mesa/main/texfetch.c +++ b/mesalib/src/mesa/main/texfetch.c @@ -41,6 +41,8 @@ #include "texcompress_rgtc.h"
#include "texfetch.h"
#include "teximage.h"
+#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
+#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
/**
@@ -898,6 +900,20 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_signed_i16,
store_texel_signed_i16
},
+ {
+ MESA_FORMAT_RGB9_E5_FLOAT,
+ fetch_texel_1d_rgb9_e5,
+ fetch_texel_2d_rgb9_e5,
+ fetch_texel_3d_rgb9_e5,
+ store_texel_rgb9_e5
+ },
+ {
+ MESA_FORMAT_R11_G11_B10_FLOAT,
+ fetch_texel_1d_r11_g11_b10f,
+ fetch_texel_2d_r11_g11_b10f,
+ fetch_texel_3d_r11_g11_b10f,
+ store_texel_r11_g11_b10f
+ }
};
diff --git a/mesalib/src/mesa/main/texfetch_tmp.h b/mesalib/src/mesa/main/texfetch_tmp.h index 57bb94c68..278becc11 100644 --- a/mesalib/src/mesa/main/texfetch_tmp.h +++ b/mesalib/src/mesa/main/texfetch_tmp.h @@ -2332,6 +2332,48 @@ static void store_texel_s8_z24(struct gl_texture_image *texImage, #endif
+/* MESA_FORMAT_RGB9_E5 ******************************************************/
+
+static void FETCH(rgb9_e5)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ rgb9e5_to_float3(*src, texel);
+ texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_rgb9_e5(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLfloat *src = (const GLfloat *) texel;
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ *dst = float3_to_rgb9e5(src);
+}
+#endif
+
+
+/* MESA_FORMAT_R11_G11_B10_FLOAT *********************************************/
+
+static void FETCH(r11_g11_b10f)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ r11g11b10f_to_float3(*src, texel);
+ texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_r11_g11_b10f(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLfloat *src = (const GLfloat *) texel;
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ *dst = float3_to_r11g11b10f(src);
+}
+#endif
+
+
#undef TEXEL_ADDR
#undef DIM
#undef FETCH
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index 24c4f1a92..41d9e9599 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -382,6 +382,26 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, }
}
+ if (ctx->Extensions.EXT_texture_shared_exponent) {
+ switch (internalFormat) {
+ case GL_RGB9_E5:
+ ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_RGB9_E5_FLOAT]);
+ return MESA_FORMAT_RGB9_E5_FLOAT;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.EXT_packed_float) {
+ switch (internalFormat) {
+ case GL_R11F_G11F_B10F:
+ ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_R11_G11_B10_FLOAT]);
+ return MESA_FORMAT_R11_G11_B10_FLOAT;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
if (ctx->Extensions.EXT_packed_depth_stencil) {
switch (internalFormat) {
case GL_DEPTH_STENCIL_EXT:
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index c6683980a..74e1f4a1b 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -979,11 +979,9 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, }
break;
case GL_TEXTURE_SHARED_SIZE:
- if (ctx->VersionMajor >= 3) {
- /* XXX return number of exponent bits for shared exponent texture
- * formats, like GL_RGB9_E5.
- */
- *params = 0;
+ if (ctx->VersionMajor >= 3 ||
+ ctx->Extensions.EXT_texture_shared_exponent) {
+ *params = texFormat == MESA_FORMAT_RGB9_E5_FLOAT ? 5 : 0;
}
else {
goto invalid_pname;
diff --git a/mesalib/src/mesa/main/texrender.c b/mesalib/src/mesa/main/texrender.c index 2766bd6c5..4bcef9899 100644 --- a/mesalib/src/mesa/main/texrender.c +++ b/mesalib/src/mesa/main/texrender.c @@ -530,6 +530,7 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) {
struct texture_renderbuffer *trb
= (struct texture_renderbuffer *) att->Renderbuffer;
+ GLuint unused;
(void) ctx;
ASSERT(trb);
@@ -602,8 +603,10 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) trb->Base._BaseFormat = GL_RGBA;
break;
default:
- trb->Base.DataType = CHAN_TYPE;
- trb->Base._BaseFormat = GL_RGBA;
+ _mesa_format_to_type_and_comps(trb->TexImage->TexFormat,
+ &trb->Base.DataType, &unused);
+ trb->Base._BaseFormat =
+ _mesa_base_fbo_format(ctx, trb->TexImage->InternalFormat);
}
trb->Base.Data = trb->TexImage->Data;
}
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index bf2b6b6e4..ea116a011 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -70,6 +70,8 @@ #include "teximage.h"
#include "texstore.h"
#include "enums.h"
+#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
+#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
enum {
@@ -4176,6 +4178,111 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS) #endif /* FEATURE_EXT_texture_sRGB */
+static GLboolean
+_mesa_texstore_rgb9_e5(TEXSTORE_PARAMS)
+{
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+ ASSERT(dstFormat == MESA_FORMAT_RGB9_E5_FLOAT);
+ ASSERT(baseInternalFormat == GL_RGB);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ srcFormat == GL_RGB &&
+ srcType == GL_UNSIGNED_INT_5_9_9_9_REV) {
+ /* simple memcpy path */
+ memcpy_texture(ctx, dims,
+ dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride,
+ dstImageOffsets,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLfloat *tempImage = _mesa_make_temp_float_image(ctx, dims,
+ baseInternalFormat,
+ baseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking,
+ ctx->_ImageTransferState);
+ const GLfloat *srcRow = tempImage;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * 4
+ + dstYoffset * dstRowStride
+ + dstXoffset * 4;
+ for (row = 0; row < srcHeight; row++) {
+ GLuint *dstUI = (GLuint*)dstRow;
+ for (col = 0; col < srcWidth; col++) {
+ dstUI[col] = float3_to_rgb9e5(&srcRow[col * 3]);
+ }
+ dstRow += dstRowStride;
+ srcRow += srcWidth * 3;
+ }
+ }
+
+ free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+static GLboolean
+_mesa_texstore_r11_g11_b10f(TEXSTORE_PARAMS)
+{
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+ ASSERT(dstFormat == MESA_FORMAT_R11_G11_B10_FLOAT);
+ ASSERT(baseInternalFormat == GL_RGB);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ srcFormat == GL_RGB &&
+ srcType == GL_UNSIGNED_INT_10F_11F_11F_REV) {
+ /* simple memcpy path */
+ memcpy_texture(ctx, dims,
+ dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride,
+ dstImageOffsets,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLfloat *tempImage = _mesa_make_temp_float_image(ctx, dims,
+ baseInternalFormat,
+ baseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking,
+ ctx->_ImageTransferState);
+ const GLfloat *srcRow = tempImage;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * 4
+ + dstYoffset * dstRowStride
+ + dstXoffset * 4;
+ for (row = 0; row < srcHeight; row++) {
+ GLuint *dstUI = (GLuint*)dstRow;
+ for (col = 0; col < srcWidth; col++) {
+ dstUI[col] = float3_to_r11g11b10f(&srcRow[col * 3]);
+ }
+ dstRow += dstRowStride;
+ srcRow += srcWidth * 3;
+ }
+ }
+
+ free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
@@ -4309,6 +4416,9 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_SIGNED_L16, _mesa_texstore_snorm16 },
{ MESA_FORMAT_SIGNED_AL1616, _mesa_texstore_snorm1616 },
{ MESA_FORMAT_SIGNED_I16, _mesa_texstore_snorm16 },
+
+ { MESA_FORMAT_RGB9_E5_FLOAT, _mesa_texstore_rgb9_e5 },
+ { MESA_FORMAT_R11_G11_B10_FLOAT, _mesa_texstore_r11_g11_b10f },
};
diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index 2ff262fc6..85c213552 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -42,7 +42,6 @@ #include "main/dispatch.h"
#include "program/prog_parameter.h"
-//#include "program/shader_api.h"
#if FEATURE_EXT_transform_feedback
@@ -507,7 +506,7 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) if (obj->Active) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glBindBufferRange(transform feedback active)");
+ "glBindBufferBase(transform feedback active)");
return;
}
@@ -555,7 +554,7 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer, if (obj->Active) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glBindBufferRange(transform feedback active)");
+ "glBindBufferOffsetEXT(transform feedback active)");
return;
}
@@ -885,7 +884,7 @@ _mesa_ResumeTransformFeedback(void) if (!obj->Active || !obj->Paused) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glPauseTransformFeedback(feedback not active or not paused)");
+ "glResumeTransformFeedback(feedback not active or not paused)");
return;
}
@@ -932,15 +931,4 @@ _mesa_DrawTransformFeedback(GLenum mode, GLuint name) }
-/*
-XXX misc to do:
-
-glGet*() for
-
-GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED
-GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE
-GL_TRANSFORM_FEEDBACK_BINDING
-*/
-
-
#endif /* FEATURE_EXT_transform_feedback */
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index 1f771a585..6b888b485 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -57,8 +57,8 @@ #define HALF_BIT 0x80
#define FLOAT_BIT 0x100
#define DOUBLE_BIT 0x200
-#define FIXED_BIT 0x400
-
+#define FIXED_ES_BIT 0x400
+#define FIXED_GL_BIT 0x800
/** Convert GL datatype enum into a <type>_BIT value seen above */
@@ -90,7 +90,7 @@ type_to_bit(const struct gl_context *ctx, GLenum type) case GL_DOUBLE:
return DOUBLE_BIT;
case GL_FIXED:
- return FIXED_BIT;
+ return ctx->API == API_OPENGL ? FIXED_GL_BIT : FIXED_ES_BIT;
default:
return 0;
}
@@ -130,7 +130,10 @@ update_array(struct gl_context *ctx, if (ctx->API != API_OPENGLES && ctx->API != API_OPENGLES2) {
/* fixed point arrays / data is only allowed with OpenGL ES 1.x/2.0 */
- legalTypesMask &= ~FIXED_BIT;
+ legalTypesMask &= ~FIXED_ES_BIT;
+ }
+ if (!ctx->Extensions.ARB_ES2_compatibility) {
+ legalTypesMask &= ~FIXED_GL_BIT;
}
typeBit = type_to_bit(ctx, type);
@@ -198,7 +201,7 @@ void GLAPIENTRY _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
{
GLbitfield legalTypes = (SHORT_BIT | INT_BIT | FLOAT_BIT |
- DOUBLE_BIT | HALF_BIT | FIXED_BIT);
+ DOUBLE_BIT | HALF_BIT | FIXED_ES_BIT);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -217,7 +220,7 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) {
const GLbitfield legalTypes = (BYTE_BIT | SHORT_BIT | INT_BIT |
HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
- FIXED_BIT);
+ FIXED_ES_BIT);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -235,7 +238,7 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) SHORT_BIT | UNSIGNED_SHORT_BIT |
INT_BIT | UNSIGNED_INT_BIT |
HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
- FIXED_BIT);
+ FIXED_ES_BIT);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -299,7 +302,7 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, {
GLbitfield legalTypes = (SHORT_BIT | INT_BIT |
HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
- FIXED_BIT);
+ FIXED_ES_BIT);
GET_CURRENT_CONTEXT(ctx);
const GLuint unit = ctx->Array.ActiveTexture;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -337,7 +340,7 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr) void GLAPIENTRY
_mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr)
{
- const GLbitfield legalTypes = (FLOAT_BIT | FIXED_BIT);
+ const GLbitfield legalTypes = (FLOAT_BIT | FIXED_ES_BIT);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -405,7 +408,7 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, SHORT_BIT | UNSIGNED_SHORT_BIT |
INT_BIT | UNSIGNED_INT_BIT |
HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
- FIXED_BIT);
+ FIXED_ES_BIT | FIXED_GL_BIT);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
|