summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texformat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/texformat.c')
-rw-r--r--src/mesa/main/texformat.c749
1 files changed, 526 insertions, 223 deletions
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 7222b77eb59..31a99f5d330 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -1,15 +1,8 @@
-/**
- * \file texformat.c
- * Texture formats.
- *
- * \author Gareth Hughes
- */
-
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -30,6 +23,14 @@
*/
+/**
+ * \file texformat.c
+ * Texture formats.
+ *
+ * \author Gareth Hughes
+ */
+
+
#include "glheader.h"
#include "colormac.h"
#include "context.h"
@@ -40,6 +41,8 @@
#include "teximage.h"
#include "texstate.h"
+#include "newstore.h"
+
/* Texel fetch routines for all supported formats
*/
@@ -85,6 +88,7 @@ static void fetch_null_texelf( const struct gl_texture_image *texImage,
const struct gl_texture_format _mesa_texformat_rgba = {
MESA_FORMAT_RGBA, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
CHAN_BITS, /* RedBits */
CHAN_BITS, /* GreenBits */
CHAN_BITS, /* BlueBits */
@@ -94,6 +98,7 @@ const struct gl_texture_format _mesa_texformat_rgba = {
0, /* IndexBits */
0, /* DepthBits */
4 * CHAN_BITS / 8, /* TexelBytes */
+ _mesa_texstore_rgba, /* StoreTexImageFunc */
fetch_texel_1d_rgba, /* FetchTexel1D */
fetch_texel_2d_rgba, /* FetchTexel2D */
fetch_texel_3d_rgba, /* FetchTexel3D */
@@ -105,6 +110,7 @@ const struct gl_texture_format _mesa_texformat_rgba = {
const struct gl_texture_format _mesa_texformat_rgb = {
MESA_FORMAT_RGB, /* MesaFormat */
GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
CHAN_BITS, /* RedBits */
CHAN_BITS, /* GreenBits */
CHAN_BITS, /* BlueBits */
@@ -114,6 +120,7 @@ const struct gl_texture_format _mesa_texformat_rgb = {
0, /* IndexBits */
0, /* DepthBits */
3 * CHAN_BITS / 8, /* TexelBytes */
+ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */
fetch_texel_1d_rgb, /* FetchTexel1D */
fetch_texel_2d_rgb, /* FetchTexel2D */
fetch_texel_3d_rgb, /* FetchTexel3D */
@@ -125,6 +132,7 @@ const struct gl_texture_format _mesa_texformat_rgb = {
const struct gl_texture_format _mesa_texformat_alpha = {
MESA_FORMAT_ALPHA, /* MesaFormat */
GL_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -134,6 +142,7 @@ const struct gl_texture_format _mesa_texformat_alpha = {
0, /* IndexBits */
0, /* DepthBits */
CHAN_BITS / 8, /* TexelBytes */
+ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */
fetch_texel_1d_alpha, /* FetchTexel1D */
fetch_texel_2d_alpha, /* FetchTexel2D */
fetch_texel_3d_alpha, /* FetchTexel3D */
@@ -145,6 +154,7 @@ const struct gl_texture_format _mesa_texformat_alpha = {
const struct gl_texture_format _mesa_texformat_luminance = {
MESA_FORMAT_LUMINANCE, /* MesaFormat */
GL_LUMINANCE, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -154,6 +164,7 @@ const struct gl_texture_format _mesa_texformat_luminance = {
0, /* IndexBits */
0, /* DepthBits */
CHAN_BITS / 8, /* TexelBytes */
+ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */
fetch_texel_1d_luminance, /* FetchTexel1D */
fetch_texel_2d_luminance, /* FetchTexel2D */
fetch_texel_3d_luminance, /* FetchTexel3D */
@@ -165,6 +176,7 @@ const struct gl_texture_format _mesa_texformat_luminance = {
const struct gl_texture_format _mesa_texformat_luminance_alpha = {
MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */
GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -174,6 +186,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = {
0, /* IndexBits */
0, /* DepthBits */
2 * CHAN_BITS / 8, /* TexelBytes */
+ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */
fetch_texel_1d_luminance_alpha, /* FetchTexel1D */
fetch_texel_2d_luminance_alpha, /* FetchTexel2D */
fetch_texel_3d_luminance_alpha, /* FetchTexel3D */
@@ -185,6 +198,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = {
const struct gl_texture_format _mesa_texformat_intensity = {
MESA_FORMAT_INTENSITY, /* MesaFormat */
GL_INTENSITY, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -194,6 +208,7 @@ const struct gl_texture_format _mesa_texformat_intensity = {
0, /* IndexBits */
0, /* DepthBits */
CHAN_BITS / 8, /* TexelBytes */
+ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */
fetch_texel_1d_intensity, /* FetchTexel1D */
fetch_texel_2d_intensity, /* FetchTexel2D */
fetch_texel_3d_intensity, /* FetchTexel3D */
@@ -205,6 +220,7 @@ const struct gl_texture_format _mesa_texformat_intensity = {
const struct gl_texture_format _mesa_texformat_color_index = {
MESA_FORMAT_COLOR_INDEX, /* MesaFormat */
GL_COLOR_INDEX, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -214,6 +230,7 @@ const struct gl_texture_format _mesa_texformat_color_index = {
CHAN_BITS, /* IndexBits */
0, /* DepthBits */
CHAN_BITS / 8, /* TexelBytes */
+ _mesa_texstore_color_index, /* StoreTexImageFunc */
fetch_texel_1d_color_index, /* FetchTexel1D */
fetch_texel_2d_color_index, /* FetchTexel2D */
fetch_texel_3d_color_index, /* FetchTexel3D */
@@ -222,10 +239,10 @@ const struct gl_texture_format _mesa_texformat_color_index = {
fetch_texel_3d_f_color_index, /* FetchTexel3Df */
};
-/* XXX someday implement 16, 24 and 32-bit integer depth images */
-const struct gl_texture_format _mesa_texformat_depth_component = {
- MESA_FORMAT_DEPTH_COMPONENT, /* MesaFormat */
+const struct gl_texture_format _mesa_texformat_depth_component_float32 = {
+ MESA_FORMAT_DEPTH_COMPONENT_FLOAT32, /* MesaFormat */
GL_DEPTH_COMPONENT, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -235,17 +252,41 @@ const struct gl_texture_format _mesa_texformat_depth_component = {
0, /* IndexBits */
sizeof(GLfloat) * 8, /* DepthBits */
sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_depth_component_float32,/* StoreTexImageFunc */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_texel_1d_f_depth_component_f32,/* FetchTexel1Df */
+ fetch_texel_2d_f_depth_component_f32,/* FetchTexel2Df */
+ fetch_texel_3d_f_depth_component_f32,/* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_depth_component16 = {
+ MESA_FORMAT_DEPTH_COMPONENT16, /* MesaFormat */
+ GL_DEPTH_COMPONENT, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ sizeof(GLushort) * 8, /* DepthBits */
+ sizeof(GLushort), /* TexelBytes */
+ _mesa_texstore_depth_component16, /* StoreTexImageFunc */
fetch_null_texel, /* FetchTexel1D */
fetch_null_texel, /* FetchTexel1D */
fetch_null_texel, /* FetchTexel1D */
- fetch_texel_1d_f_depth_component, /* FetchTexel1Df */
- fetch_texel_2d_f_depth_component, /* FetchTexel2Df */
- fetch_texel_3d_f_depth_component, /* FetchTexel3Df */
+ fetch_texel_1d_f_depth_component16, /* FetchTexel1Df */
+ fetch_texel_2d_f_depth_component16, /* FetchTexel2Df */
+ fetch_texel_3d_f_depth_component16, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgba_float32 = {
MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_FLOAT, /* DataType */
8 * sizeof(GLfloat), /* RedBits */
8 * sizeof(GLfloat), /* GreenBits */
8 * sizeof(GLfloat), /* BlueBits */
@@ -255,9 +296,10 @@ const struct gl_texture_format _mesa_texformat_rgba_float32 = {
0, /* IndexBits */
0, /* DepthBits */
4 * sizeof(GLfloat), /* TexelBytes */
- fetch_null_texel, /* FetchTexel1D */
- fetch_null_texel, /* FetchTexel1D */
- fetch_null_texel, /* FetchTexel1D */
+ _mesa_texstore_rgba_float32, /* StoreTexImageFunc */
+ fetch_texel_1d_rgba_f32, /* FetchTexel1D */
+ fetch_texel_2d_rgba_f32, /* FetchTexel1D */
+ fetch_texel_3d_rgba_f32, /* FetchTexel1D */
fetch_texel_1d_f_rgba_f32, /* FetchTexel1Df */
fetch_texel_2d_f_rgba_f32, /* FetchTexel2Df */
fetch_texel_3d_f_rgba_f32, /* FetchTexel3Df */
@@ -266,18 +308,20 @@ const struct gl_texture_format _mesa_texformat_rgba_float32 = {
const struct gl_texture_format _mesa_texformat_rgba_float16 = {
MESA_FORMAT_RGBA_FLOAT16, /* MesaFormat */
GL_RGBA, /* BaseFormat */
- 8 * sizeof(GLhalfNV), /* RedBits */
- 8 * sizeof(GLhalfNV), /* GreenBits */
- 8 * sizeof(GLhalfNV), /* BlueBits */
- 8 * sizeof(GLhalfNV), /* AlphaBits */
+ GL_FLOAT, /* DataType */
+ 8 * sizeof(GLhalfARB), /* RedBits */
+ 8 * sizeof(GLhalfARB), /* GreenBits */
+ 8 * sizeof(GLhalfARB), /* BlueBits */
+ 8 * sizeof(GLhalfARB), /* AlphaBits */
0, /* LuminanceBits */
0, /* IntensityBits */
0, /* IndexBits */
0, /* DepthBits */
- 4 * sizeof(GLhalfNV), /* TexelBytes */
- fetch_null_texel, /* FetchTexel1D */
- fetch_null_texel, /* FetchTexel1D */
- fetch_null_texel, /* FetchTexel1D */
+ 4 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16, /* StoreTexImageFunc */
+ fetch_texel_1d_rgba_f16, /* FetchTexel1D */
+ fetch_texel_2d_rgba_f16, /* FetchTexel1D */
+ fetch_texel_3d_rgba_f16, /* FetchTexel1D */
fetch_texel_1d_f_rgba_f16, /* FetchTexel1Df */
fetch_texel_2d_f_rgba_f16, /* FetchTexel2Df */
fetch_texel_3d_f_rgba_f16, /* FetchTexel3Df */
@@ -286,6 +330,7 @@ const struct gl_texture_format _mesa_texformat_rgba_float16 = {
const struct gl_texture_format _mesa_texformat_rgb_float32 = {
MESA_FORMAT_RGB_FLOAT32, /* MesaFormat */
GL_RGB, /* BaseFormat */
+ GL_FLOAT, /* DataType */
8 * sizeof(GLfloat), /* RedBits */
8 * sizeof(GLfloat), /* GreenBits */
8 * sizeof(GLfloat), /* BlueBits */
@@ -294,10 +339,11 @@ const struct gl_texture_format _mesa_texformat_rgb_float32 = {
0, /* IntensityBits */
0, /* IndexBits */
0, /* DepthBits */
- 4 * sizeof(GLfloat), /* TexelBytes */
- fetch_null_texel, /* FetchTexel1D */
- fetch_null_texel, /* FetchTexel1D */
- fetch_null_texel, /* FetchTexel1D */
+ 3 * sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_rgb_f32, /* FetchTexel1D */
+ fetch_texel_2d_rgb_f32, /* FetchTexel1D */
+ fetch_texel_3d_rgb_f32, /* FetchTexel1D */
fetch_texel_1d_f_rgb_f32, /* FetchTexel1Df */
fetch_texel_2d_f_rgb_f32, /* FetchTexel2Df */
fetch_texel_3d_f_rgb_f32, /* FetchTexel3Df */
@@ -306,21 +352,199 @@ const struct gl_texture_format _mesa_texformat_rgb_float32 = {
const struct gl_texture_format _mesa_texformat_rgb_float16 = {
MESA_FORMAT_RGB_FLOAT16, /* MesaFormat */
GL_RGB, /* BaseFormat */
- 8 * sizeof(GLhalfNV), /* RedBits */
- 8 * sizeof(GLhalfNV), /* GreenBits */
- 8 * sizeof(GLhalfNV), /* BlueBits */
+ GL_FLOAT, /* DataType */
+ 8 * sizeof(GLhalfARB), /* RedBits */
+ 8 * sizeof(GLhalfARB), /* GreenBits */
+ 8 * sizeof(GLhalfARB), /* BlueBits */
0, /* AlphaBits */
0, /* LuminanceBits */
0, /* IntensityBits */
0, /* IndexBits */
0, /* DepthBits */
- 4 * sizeof(GLhalfNV), /* TexelBytes */
- fetch_null_texel, /* FetchTexel1D */
- fetch_null_texel, /* FetchTexel1D */
- fetch_null_texel, /* FetchTexel1D */
+ 3 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_rgb_f16, /* FetchTexel1D */
+ fetch_texel_2d_rgb_f16, /* FetchTexel1D */
+ fetch_texel_3d_rgb_f16, /* FetchTexel1D */
fetch_texel_1d_f_rgb_f16, /* FetchTexel1Df */
fetch_texel_2d_f_rgb_f16, /* FetchTexel2Df */
- fetch_texel_3d_f_rgb_f16, /* FetchTexel3Df */
+ fetch_texel_3d_f_rgb_f16 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_alpha_float32 = {
+ MESA_FORMAT_ALPHA_FLOAT32, /* MesaFormat */
+ GL_ALPHA, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8 * sizeof(GLfloat), /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_alpha_f32, /* FetchTexel1D */
+ fetch_texel_2d_alpha_f32, /* FetchTexel1D */
+ fetch_texel_3d_alpha_f32, /* FetchTexel1D */
+ fetch_texel_1d_f_alpha_f32, /* FetchTexel1Df */
+ fetch_texel_2d_f_alpha_f32, /* FetchTexel2Df */
+ fetch_texel_3d_f_alpha_f32 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_alpha_float16 = {
+ MESA_FORMAT_ALPHA_FLOAT16, /* MesaFormat */
+ GL_ALPHA, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8 * sizeof(GLhalfARB), /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_alpha_f16, /* FetchTexel1D */
+ fetch_texel_2d_alpha_f16, /* FetchTexel1D */
+ fetch_texel_3d_alpha_f16, /* FetchTexel1D */
+ fetch_texel_1d_f_alpha_f16, /* FetchTexel1Df */
+ fetch_texel_2d_f_alpha_f16, /* FetchTexel2Df */
+ fetch_texel_3d_f_alpha_f16 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_luminance_float32 = {
+ MESA_FORMAT_LUMINANCE_FLOAT32, /* MesaFormat */
+ GL_LUMINANCE, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 8 * sizeof(GLfloat), /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_luminance_f32, /* FetchTexel1D */
+ fetch_texel_2d_luminance_f32, /* FetchTexel2D */
+ fetch_texel_3d_luminance_f32, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance_f32, /* FetchTexel1Df */
+ fetch_texel_2d_f_luminance_f32, /* FetchTexel2Df */
+ fetch_texel_3d_f_luminance_f32 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_luminance_float16 = {
+ MESA_FORMAT_LUMINANCE_FLOAT16, /* MesaFormat */
+ GL_LUMINANCE, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 8 * sizeof(GLhalfARB), /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_luminance_f16, /* FetchTexel1D */
+ fetch_texel_2d_luminance_f16, /* FetchTexel2D */
+ fetch_texel_3d_luminance_f16, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance_f16, /* FetchTexel1Df */
+ fetch_texel_2d_f_luminance_f16, /* FetchTexel2Df */
+ fetch_texel_3d_f_luminance_f16 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = {
+ MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, /* MesaFormat */
+ GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8 * sizeof(GLfloat), /* AlphaBits */
+ 8 * sizeof(GLfloat), /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2 * sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_rgba_float32, /* StoreTexImageFunc */
+ fetch_texel_1d_luminance_alpha_f32, /* FetchTexel1D */
+ fetch_texel_2d_luminance_alpha_f32, /* FetchTexel2D */
+ fetch_texel_3d_luminance_alpha_f32, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance_alpha_f32,/* FetchTexel1Df */
+ fetch_texel_2d_f_luminance_alpha_f32,/* FetchTexel2Df */
+ fetch_texel_3d_f_luminance_alpha_f32 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = {
+ MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, /* MesaFormat */
+ GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 8 * sizeof(GLhalfARB), /* AlphaBits */
+ 8 * sizeof(GLhalfARB), /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 2 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16, /* StoreTexImageFunc */
+ fetch_texel_1d_luminance_alpha_f16, /* FetchTexel1D */
+ fetch_texel_2d_luminance_alpha_f16, /* FetchTexel2D */
+ fetch_texel_3d_luminance_alpha_f16, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance_alpha_f16,/* FetchTexel1Df */
+ fetch_texel_2d_f_luminance_alpha_f16,/* FetchTexel2Df */
+ fetch_texel_3d_f_luminance_alpha_f16 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_intensity_float32 = {
+ MESA_FORMAT_INTENSITY_FLOAT32, /* MesaFormat */
+ GL_INTENSITY, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 8 * sizeof(GLfloat), /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLfloat), /* TexelBytes */
+ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_intensity_f32, /* FetchTexel1D */
+ fetch_texel_2d_intensity_f32, /* FetchTexel2D */
+ fetch_texel_3d_intensity_f32, /* FetchTexel3D */
+ fetch_texel_1d_f_intensity_f32, /* FetchTexel1Df */
+ fetch_texel_2d_f_intensity_f32, /* FetchTexel2Df */
+ fetch_texel_3d_f_intensity_f32 /* FetchTexel3Df */
+};
+
+const struct gl_texture_format _mesa_texformat_intensity_float16 = {
+ MESA_FORMAT_INTENSITY_FLOAT16, /* MesaFormat */
+ GL_INTENSITY, /* BaseFormat */
+ GL_FLOAT, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 8 * sizeof(GLhalfARB), /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 1 * sizeof(GLhalfARB), /* TexelBytes */
+ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */
+ fetch_texel_1d_intensity_f16, /* FetchTexel1D */
+ fetch_texel_2d_intensity_f16, /* FetchTexel2D */
+ fetch_texel_3d_intensity_f16, /* FetchTexel3D */
+ fetch_texel_1d_f_intensity_f16, /* FetchTexel1Df */
+ fetch_texel_2d_f_intensity_f16, /* FetchTexel2Df */
+ fetch_texel_3d_f_intensity_f16 /* FetchTexel3Df */
};
@@ -334,6 +558,7 @@ const struct gl_texture_format _mesa_texformat_rgb_float16 = {
const struct gl_texture_format _mesa_texformat_rgba8888 = {
MESA_FORMAT_RGBA8888, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
8, /* RedBits */
8, /* GreenBits */
8, /* BlueBits */
@@ -343,6 +568,7 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = {
0, /* IndexBits */
0, /* DepthBits */
4, /* TexelBytes */
+ _mesa_texstore_rgba8888, /* StoreTexImageFunc */
fetch_texel_1d_rgba8888, /* FetchTexel1D */
fetch_texel_2d_rgba8888, /* FetchTexel2D */
fetch_texel_3d_rgba8888, /* FetchTexel3D */
@@ -354,6 +580,7 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = {
const struct gl_texture_format _mesa_texformat_argb8888 = {
MESA_FORMAT_ARGB8888, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
8, /* RedBits */
8, /* GreenBits */
8, /* BlueBits */
@@ -363,6 +590,7 @@ const struct gl_texture_format _mesa_texformat_argb8888 = {
0, /* IndexBits */
0, /* DepthBits */
4, /* TexelBytes */
+ _mesa_texstore_argb8888, /* StoreTexImageFunc */
fetch_texel_1d_argb8888, /* FetchTexel1D */
fetch_texel_2d_argb8888, /* FetchTexel2D */
fetch_texel_3d_argb8888, /* FetchTexel3D */
@@ -374,6 +602,7 @@ const struct gl_texture_format _mesa_texformat_argb8888 = {
const struct gl_texture_format _mesa_texformat_rgb888 = {
MESA_FORMAT_RGB888, /* MesaFormat */
GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
8, /* RedBits */
8, /* GreenBits */
8, /* BlueBits */
@@ -383,6 +612,7 @@ const struct gl_texture_format _mesa_texformat_rgb888 = {
0, /* IndexBits */
0, /* DepthBits */
3, /* TexelBytes */
+ _mesa_texstore_rgb888, /* StoreTexImageFunc */
fetch_texel_1d_rgb888, /* FetchTexel1D */
fetch_texel_2d_rgb888, /* FetchTexel2D */
fetch_texel_3d_rgb888, /* FetchTexel3D */
@@ -394,6 +624,7 @@ const struct gl_texture_format _mesa_texformat_rgb888 = {
const struct gl_texture_format _mesa_texformat_rgb565 = {
MESA_FORMAT_RGB565, /* MesaFormat */
GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
5, /* RedBits */
6, /* GreenBits */
5, /* BlueBits */
@@ -403,6 +634,7 @@ const struct gl_texture_format _mesa_texformat_rgb565 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
+ _mesa_texstore_rgb565, /* StoreTexImageFunc */
fetch_texel_1d_rgb565, /* FetchTexel1D */
fetch_texel_2d_rgb565, /* FetchTexel2D */
fetch_texel_3d_rgb565, /* FetchTexel3D */
@@ -414,6 +646,7 @@ const struct gl_texture_format _mesa_texformat_rgb565 = {
const struct gl_texture_format _mesa_texformat_argb4444 = {
MESA_FORMAT_ARGB4444, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4, /* RedBits */
4, /* GreenBits */
4, /* BlueBits */
@@ -423,6 +656,7 @@ const struct gl_texture_format _mesa_texformat_argb4444 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
+ _mesa_texstore_argb4444, /* StoreTexImageFunc */
fetch_texel_1d_argb4444, /* FetchTexel1D */
fetch_texel_2d_argb4444, /* FetchTexel2D */
fetch_texel_3d_argb4444, /* FetchTexel3D */
@@ -434,6 +668,7 @@ const struct gl_texture_format _mesa_texformat_argb4444 = {
const struct gl_texture_format _mesa_texformat_argb1555 = {
MESA_FORMAT_ARGB1555, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
5, /* RedBits */
5, /* GreenBits */
5, /* BlueBits */
@@ -443,6 +678,7 @@ const struct gl_texture_format _mesa_texformat_argb1555 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
+ _mesa_texstore_argb1555, /* StoreTexImageFunc */
fetch_texel_1d_argb1555, /* FetchTexel1D */
fetch_texel_2d_argb1555, /* FetchTexel2D */
fetch_texel_3d_argb1555, /* FetchTexel3D */
@@ -454,6 +690,7 @@ const struct gl_texture_format _mesa_texformat_argb1555 = {
const struct gl_texture_format _mesa_texformat_al88 = {
MESA_FORMAT_AL88, /* MesaFormat */
GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -463,6 +700,7 @@ const struct gl_texture_format _mesa_texformat_al88 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
+ _mesa_texstore_al88, /* StoreTexImageFunc */
fetch_texel_1d_al88, /* FetchTexel1D */
fetch_texel_2d_al88, /* FetchTexel2D */
fetch_texel_3d_al88, /* FetchTexel3D */
@@ -474,6 +712,7 @@ const struct gl_texture_format _mesa_texformat_al88 = {
const struct gl_texture_format _mesa_texformat_rgb332 = {
MESA_FORMAT_RGB332, /* MesaFormat */
GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
3, /* RedBits */
3, /* GreenBits */
2, /* BlueBits */
@@ -483,6 +722,7 @@ const struct gl_texture_format _mesa_texformat_rgb332 = {
0, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
+ _mesa_texstore_rgb332, /* StoreTexImageFunc */
fetch_texel_1d_rgb332, /* FetchTexel1D */
fetch_texel_2d_rgb332, /* FetchTexel2D */
fetch_texel_3d_rgb332, /* FetchTexel3D */
@@ -494,6 +734,7 @@ const struct gl_texture_format _mesa_texformat_rgb332 = {
const struct gl_texture_format _mesa_texformat_a8 = {
MESA_FORMAT_A8, /* MesaFormat */
GL_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -503,6 +744,7 @@ const struct gl_texture_format _mesa_texformat_a8 = {
0, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
+ _mesa_texstore_a8, /* StoreTexImageFunc */
fetch_texel_1d_a8, /* FetchTexel1D */
fetch_texel_2d_a8, /* FetchTexel2D */
fetch_texel_3d_a8, /* FetchTexel3D */
@@ -514,6 +756,7 @@ const struct gl_texture_format _mesa_texformat_a8 = {
const struct gl_texture_format _mesa_texformat_l8 = {
MESA_FORMAT_L8, /* MesaFormat */
GL_LUMINANCE, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -523,6 +766,7 @@ const struct gl_texture_format _mesa_texformat_l8 = {
0, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
+ _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */
fetch_texel_1d_l8, /* FetchTexel1D */
fetch_texel_2d_l8, /* FetchTexel2D */
fetch_texel_3d_l8, /* FetchTexel3D */
@@ -534,6 +778,7 @@ const struct gl_texture_format _mesa_texformat_l8 = {
const struct gl_texture_format _mesa_texformat_i8 = {
MESA_FORMAT_I8, /* MesaFormat */
GL_INTENSITY, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -543,6 +788,7 @@ const struct gl_texture_format _mesa_texformat_i8 = {
0, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
+ _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */
fetch_texel_1d_i8, /* FetchTexel1D */
fetch_texel_2d_i8, /* FetchTexel2D */
fetch_texel_3d_i8, /* FetchTexel3D */
@@ -554,6 +800,7 @@ const struct gl_texture_format _mesa_texformat_i8 = {
const struct gl_texture_format _mesa_texformat_ci8 = {
MESA_FORMAT_CI8, /* MesaFormat */
GL_COLOR_INDEX, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -563,6 +810,7 @@ const struct gl_texture_format _mesa_texformat_ci8 = {
8, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
+ _mesa_texstore_ci8, /* StoreTexImageFunc */
fetch_texel_1d_ci8, /* FetchTexel1D */
fetch_texel_2d_ci8, /* FetchTexel2D */
fetch_texel_3d_ci8, /* FetchTexel3D */
@@ -574,6 +822,7 @@ const struct gl_texture_format _mesa_texformat_ci8 = {
const struct gl_texture_format _mesa_texformat_ycbcr = {
MESA_FORMAT_YCBCR, /* MesaFormat */
GL_YCBCR_MESA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -583,6 +832,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
+ _mesa_texstore_ycbcr, /* StoreTexImageFunc */
fetch_texel_1d_ycbcr, /* FetchTexel1D */
fetch_texel_2d_ycbcr, /* FetchTexel2D */
fetch_texel_3d_ycbcr, /* FetchTexel3D */
@@ -594,6 +844,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr = {
const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
MESA_FORMAT_YCBCR_REV, /* MesaFormat */
GL_YCBCR_MESA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -603,6 +854,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
+ _mesa_texstore_ycbcr, /* StoreTexImageFunc */
fetch_texel_1d_ycbcr_rev, /* FetchTexel1D */
fetch_texel_2d_ycbcr_rev, /* FetchTexel2D */
fetch_texel_3d_ycbcr_rev, /* FetchTexel3D */
@@ -614,6 +866,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
MESA_FORMAT_RGB_FXT1, /* MesaFormat */
GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4, /*approx*/ /* RedBits */
4, /*approx*/ /* GreenBits */
4, /*approx*/ /* BlueBits */
@@ -623,6 +876,7 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
0, /* IndexBits */
0, /* DepthBits */
0, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
@@ -634,6 +888,7 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
MESA_FORMAT_RGBA_FXT1, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4, /*approx*/ /* RedBits */
4, /*approx*/ /* GreenBits */
4, /*approx*/ /* BlueBits */
@@ -643,6 +898,7 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
0, /* IndexBits */
0, /* DepthBits */
0, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
@@ -654,6 +910,7 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
MESA_FORMAT_RGB_DXT1, /* MesaFormat */
GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4, /*approx*/ /* RedBits */
4, /*approx*/ /* GreenBits */
4, /*approx*/ /* BlueBits */
@@ -663,6 +920,7 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
0, /* IndexBits */
0, /* DepthBits */
0, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
@@ -674,6 +932,7 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
MESA_FORMAT_RGBA_DXT1, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4, /*approx*/ /* RedBits */
4, /*approx*/ /* GreenBits */
4, /*approx*/ /* BlueBits */
@@ -683,6 +942,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
0, /* IndexBits */
0, /* DepthBits */
0, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
@@ -694,6 +954,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
MESA_FORMAT_RGBA_DXT3, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4, /*approx*/ /* RedBits */
4, /*approx*/ /* GreenBits */
4, /*approx*/ /* BlueBits */
@@ -703,6 +964,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
0, /* IndexBits */
0, /* DepthBits */
0, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
@@ -714,6 +976,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
MESA_FORMAT_RGBA_DXT5, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4,/*approx*/ /* RedBits */
4,/*approx*/ /* GreenBits */
4,/*approx*/ /* BlueBits */
@@ -723,6 +986,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
0, /* IndexBits */
0, /* DepthBits */
0, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
@@ -737,7 +1001,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
const struct gl_texture_format _mesa_texformat_abgr8888 = {
MESA_FORMAT_ABGR8888, /* MesaFormat */
GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_INT_8_8_8_8, /* Type */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
8, /* RedBits */
8, /* GreenBits */
8, /* BlueBits */
@@ -747,6 +1011,7 @@ const struct gl_texture_format _mesa_texformat_abgr8888 = {
0, /* IndexBits */
0, /* DepthBits */
4, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
fetch_texel_1d_abgr8888, /* FetchTexel1D */
fetch_texel_2d_abgr8888, /* FetchTexel2D */
fetch_texel_3d_abgr8888, /* FetchTexel3D */
@@ -756,6 +1021,7 @@ const struct gl_texture_format _mesa_texformat_abgr8888 = {
const struct gl_texture_format _mesa_texformat_bgra8888 = {
MESA_FORMAT_BGRA8888, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
GL_UNSIGNED_INT_8_8_8_8, /* Type */
8, /* RedBits */
8, /* GreenBits */
@@ -766,6 +1032,7 @@ const struct gl_texture_format _mesa_texformat_bgra8888 = {
0, /* IndexBits */
0, /* DepthBits */
4, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
fetch_texel_1d_bgra8888, /* FetchTexel1D */
fetch_texel_2d_bgra8888, /* FetchTexel2D */
fetch_texel_3d_bgra8888, /* FetchTexel3D */
@@ -775,6 +1042,7 @@ const struct gl_texture_format _mesa_texformat_bgra8888 = {
const struct gl_texture_format _mesa_texformat_bgr888 = {
MESA_FORMAT_BGR888, /* MesaFormat */
GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
GL_UNSIGNED_BYTE, /* Type */
8, /* RedBits */
8, /* GreenBits */
@@ -785,6 +1053,7 @@ const struct gl_texture_format _mesa_texformat_bgr888 = {
0, /* IndexBits */
0, /* DepthBits */
3, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
fetch_texel_1d_bgr888, /* FetchTexel1D */
fetch_texel_2d_bgr888, /* FetchTexel2D */
fetch_texel_3d_bgr888, /* FetchTexel3D */
@@ -794,6 +1063,7 @@ const struct gl_texture_format _mesa_texformat_bgr888 = {
const struct gl_texture_format _mesa_texformat_bgr565 = {
MESA_FORMAT_BGR565, /* MesaFormat */
GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
GL_UNSIGNED_SHORT_5_6_5, /* Type */
5, /* RedBits */
6, /* GreenBits */
@@ -804,6 +1074,7 @@ const struct gl_texture_format _mesa_texformat_bgr565 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
fetch_texel_1d_bgr565, /* FetchTexel1D */
fetch_texel_2d_bgr565, /* FetchTexel2D */
fetch_texel_3d_bgr565, /* FetchTexel3D */
@@ -813,6 +1084,7 @@ const struct gl_texture_format _mesa_texformat_bgr565 = {
const struct gl_texture_format _mesa_texformat_bgra4444 = {
MESA_FORMAT_BGRA4444, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
GL_UNSIGNED_SHORT_4_4_4_4_REV, /* Type */
4, /* RedBits */
4, /* GreenBits */
@@ -823,6 +1095,7 @@ const struct gl_texture_format _mesa_texformat_bgra4444 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
fetch_texel_1d_bgra4444, /* FetchTexel1D */
fetch_texel_2d_bgra4444, /* FetchTexel2D */
fetch_texel_3d_bgra4444, /* FetchTexel3D */
@@ -832,6 +1105,7 @@ const struct gl_texture_format _mesa_texformat_bgra4444 = {
const struct gl_texture_format _mesa_texformat_bgra5551 = {
MESA_FORMAT_BGRA5551, /* MesaFormat */
GL_RGBA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
GL_UNSIGNED_SHORT_1_5_5_5_REV, /* Type */
5, /* RedBits */
5, /* GreenBits */
@@ -842,6 +1116,7 @@ const struct gl_texture_format _mesa_texformat_bgra5551 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
fetch_texel_1d_bgra1555, /* FetchTexel1D */
fetch_texel_2d_bgra1555, /* FetchTexel2D */
fetch_texel_3d_bgra1555, /* FetchTexel3D */
@@ -851,6 +1126,7 @@ const struct gl_texture_format _mesa_texformat_bgra5551 = {
const struct gl_texture_format _mesa_texformat_la88 = {
MESA_FORMAT_LA88, /* MesaFormat */
GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
GL_UNSIGNED_BYTE, /* Type */
0, /* RedBits */
0, /* GreenBits */
@@ -861,6 +1137,7 @@ const struct gl_texture_format _mesa_texformat_la88 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
fetch_texel_1d_la88, /* FetchTexel1D */
fetch_texel_2d_la88, /* FetchTexel2D */
fetch_texel_3d_la88, /* FetchTexel3D */
@@ -870,6 +1147,7 @@ const struct gl_texture_format _mesa_texformat_la88 = {
const struct gl_texture_format _mesa_texformat_bgr233 = {
MESA_FORMAT_BGR233, /* MesaFormat */
GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB /* DataType */
GL_UNSIGNED_BYTE_3_3_2, /* Type */
3, /* RedBits */
3, /* GreenBits */
@@ -880,6 +1158,7 @@ const struct gl_texture_format _mesa_texformat_bgr233 = {
0, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
fetch_texel_1d_bgr233, /* FetchTexel1D */
fetch_texel_2d_bgr233, /* FetchTexel2D */
fetch_texel_3d_bgr233, /* FetchTexel3D */
@@ -897,6 +1176,7 @@ const struct gl_texture_format _mesa_texformat_bgr233 = {
const struct gl_texture_format _mesa_null_texformat = {
-1, /* MesaFormat */
0, /* BaseFormat */
+ GL_NONE, /* DataType */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -906,6 +1186,7 @@ const struct gl_texture_format _mesa_null_texformat = {
0, /* IndexBits */
0, /* DepthBits */
0, /* TexelBytes */
+ NULL, /* StoreTexImageFunc */
fetch_null_texel, /* FetchTexel1D */
fetch_null_texel, /* FetchTexel2D */
fetch_null_texel, /* FetchTexel3D */
@@ -917,6 +1198,7 @@ const struct gl_texture_format _mesa_null_texformat = {
/*@}*/
+#if !NEWTEXSTORE
/**
* Determine whether a given texture format is a hardware texture
* format.
@@ -934,6 +1216,7 @@ _mesa_is_hardware_tex_format( const struct gl_texture_format *format )
{
return (format->MesaFormat < MESA_FORMAT_RGBA);
}
+#endif
/**
@@ -949,7 +1232,7 @@ _mesa_is_hardware_tex_format( const struct gl_texture_format *format )
* choosen texture format, or NULL on failure.
*
* This is called via dd_function_table::ChooseTextureFormat. Hardware drivers
- * typically override this function with a specialized version.
+ * will typically override this function with a specialized version.
*/
const struct gl_texture_format *
_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
@@ -958,192 +1241,212 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
(void) format;
(void) type;
- switch ( internalFormat ) {
- /* GH: Bias towards GL_RGB, GL_RGBA texture formats. This has
- * got to be better than sticking them way down the end of this
- * huge list.
- */
- case 4: /* Quake3 uses this... */
- case GL_RGBA:
- return &_mesa_texformat_rgba;
-
- case 3: /* ... and this. */
- case GL_RGB:
- return &_mesa_texformat_rgb;
-
- /* GH: Okay, keep checking as normal. Still test for GL_RGB,
- * GL_RGBA formats first.
- */
- case GL_RGBA2:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_rgba;
-
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_rgb;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return &_mesa_texformat_alpha;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return &_mesa_texformat_luminance;
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return &_mesa_texformat_luminance_alpha;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return &_mesa_texformat_intensity;
-
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_color_index;
-
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16_SGIX:
- case GL_DEPTH_COMPONENT24_SGIX:
- case GL_DEPTH_COMPONENT32_SGIX:
- if (!ctx->Extensions.SGIX_depth_texture)
- _mesa_problem(ctx, "depth format without GL_SGIX_depth_texture");
- return &_mesa_texformat_depth_component;
+ switch (internalFormat) {
+ /* RGBA formats */
+ case 4:
+ case GL_RGBA:
+ case GL_RGBA8:
+ case GL_RGB10_A2:
+ case GL_RGBA12:
+ case GL_RGBA16:
+ return &_mesa_texformat_rgba;
+ case GL_RGB5_A1:
+ return &_mesa_texformat_argb1555;
+ case GL_RGBA2:
+ case GL_RGBA4:
+ return &_mesa_texformat_argb4444;
+
+ /* RGB formats */
+ case 3:
+ case GL_RGB:
+ case GL_RGB8:
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ return &_mesa_texformat_rgb;
+ case GL_R3_G3_B2:
+ return &_mesa_texformat_rgb332;
+ case GL_RGB4:
+ case GL_RGB5:
+ return &_mesa_texformat_rgb565;
+
+ /* Alpha formats */
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA8:
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ return &_mesa_texformat_alpha;
+
+ /* Luminance formats */
+ case 1:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ return &_mesa_texformat_luminance;
+ case GL_LUMINANCE8:
+ return &_mesa_texformat_l8;
+
+ /* Luminance/Alpha formats */
+ case 2:
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE4_ALPHA4:
+ case GL_LUMINANCE6_ALPHA2:
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+ return &_mesa_texformat_luminance_alpha;
+ case GL_LUMINANCE8_ALPHA8:
+ return &_mesa_texformat_al88;
+
+ case GL_INTENSITY:
+ case GL_INTENSITY4:
+ case GL_INTENSITY12:
+ case GL_INTENSITY16:
+ return &_mesa_texformat_intensity;
+ case GL_INTENSITY8:
+ return &_mesa_texformat_i8;
+
+ case GL_COLOR_INDEX:
+ case GL_COLOR_INDEX1_EXT:
+ case GL_COLOR_INDEX2_EXT:
+ case GL_COLOR_INDEX4_EXT:
+ case GL_COLOR_INDEX12_EXT:
+ case GL_COLOR_INDEX16_EXT:
+ return &_mesa_texformat_color_index;
+ case GL_COLOR_INDEX8_EXT:
+ return &_mesa_texformat_ci8;
+
+ default:
+ ; /* fallthrough */
+ }
- case GL_COMPRESSED_ALPHA_ARB:
- if (!ctx->Extensions.ARB_texture_compression)
- _mesa_problem(ctx, "texture compression extension not enabled");
- return &_mesa_texformat_alpha;
- case GL_COMPRESSED_LUMINANCE_ARB:
- if (!ctx->Extensions.ARB_texture_compression)
- _mesa_problem(ctx, "texture compression extension not enabled");
- return &_mesa_texformat_luminance;
- case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
- if (!ctx->Extensions.ARB_texture_compression)
- _mesa_problem(ctx, "texture compression extension not enabled");
- return &_mesa_texformat_luminance_alpha;
- case GL_COMPRESSED_INTENSITY_ARB:
- if (!ctx->Extensions.ARB_texture_compression)
- _mesa_problem(ctx, "texture compression extension not enabled");
- return &_mesa_texformat_intensity;
- case GL_COMPRESSED_RGB_ARB:
- if (!ctx->Extensions.ARB_texture_compression)
- _mesa_problem(ctx, "texture compression extension not enabled");
- if (ctx->Extensions.TDFX_texture_compression_FXT1)
- return &_mesa_texformat_rgb_fxt1;
- else if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc)
- return &_mesa_texformat_rgb_dxt1;
- return &_mesa_texformat_rgb;
- case GL_COMPRESSED_RGBA_ARB:
- if (!ctx->Extensions.ARB_texture_compression)
- _mesa_problem(ctx, "texture compression extension not enabled");
- if (ctx->Extensions.TDFX_texture_compression_FXT1)
- return &_mesa_texformat_rgba_fxt1;
- else if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc)
- return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1! See the spec */
- return &_mesa_texformat_rgba;
-
- /* GL_MESA_ycrcr_texture */
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_MESA)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- /* GL_3DFX_texture_compression_FXT1 */
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- if (ctx->Extensions.TDFX_texture_compression_FXT1)
- return &_mesa_texformat_rgb_fxt1;
- else
- return NULL;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- if (ctx->Extensions.TDFX_texture_compression_FXT1)
- return &_mesa_texformat_rgba_fxt1;
- else
- return NULL;
-
- /* GL_EXT_texture_compression_s3tc */
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- return &_mesa_texformat_rgb_dxt1;
- else
- return NULL;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- return &_mesa_texformat_rgba_dxt1;
- else
- return NULL;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- return &_mesa_texformat_rgba_dxt3;
- else
- return NULL;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- return &_mesa_texformat_rgba_dxt5;
- else
- return NULL;
-
- /* GL_S3_s3tc */
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- if (ctx->Extensions.S3_s3tc)
- return &_mesa_texformat_rgb_dxt1;
- else
- return NULL;
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- if (ctx->Extensions.S3_s3tc)
- return &_mesa_texformat_rgba_dxt3;
- else
- return NULL;
-
- /* XXX prototype/example code */
- /* GL_ATI_texture_float or GL_NV_float_buffer */
- case GL_RGBA_FLOAT32_ATI:
- return &_mesa_texformat_rgba_float32;
- case GL_RGBA_FLOAT16_ATI:
- return &_mesa_texformat_rgba_float16;
- case GL_RGB_FLOAT32_ATI:
- return &_mesa_texformat_rgb_float32;
- case GL_RGB_FLOAT16_ATI:
- return &_mesa_texformat_rgb_float16;
+ if (ctx->Extensions.SGIX_depth_texture) {
+ switch (internalFormat) {
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_COMPONENT24_SGIX:
+ case GL_DEPTH_COMPONENT32_SGIX:
+ return &_mesa_texformat_depth_component_float32;
+ case GL_DEPTH_COMPONENT16_SGIX:
+ return &_mesa_texformat_depth_component16;
+ default:
+ ; /* fallthrough */
+ }
+ }
- default:
- _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
- return NULL;
+ if (ctx->Extensions.ARB_texture_compression) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_ALPHA_ARB:
+ return &_mesa_texformat_alpha;
+ case GL_COMPRESSED_LUMINANCE_ARB:
+ return &_mesa_texformat_luminance;
+ case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
+ return &_mesa_texformat_luminance_alpha;
+ case GL_COMPRESSED_INTENSITY_ARB:
+ return &_mesa_texformat_intensity;
+ case GL_COMPRESSED_RGB_ARB:
+ if (ctx->Extensions.TDFX_texture_compression_FXT1)
+ return &_mesa_texformat_rgb_fxt1;
+ else if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
+ return &_mesa_texformat_rgb_dxt1;
+ else
+ return &_mesa_texformat_rgb;
+ case GL_COMPRESSED_RGBA_ARB:
+ if (ctx->Extensions.TDFX_texture_compression_FXT1)
+ return &_mesa_texformat_rgba_fxt1;
+ else if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
+ return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */
+ else
+ return &_mesa_texformat_rgba;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.MESA_ycbcr_texture) {
+ if (internalFormat == GL_YCBCR_MESA) {
+ if (type == GL_UNSIGNED_SHORT_8_8_MESA)
+ return &_mesa_texformat_ycbcr;
+ else
+ return &_mesa_texformat_ycbcr_rev;
+ }
}
+
+ if (ctx->Extensions.TDFX_texture_compression_FXT1) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ return &_mesa_texformat_rgb_fxt1;
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ return &_mesa_texformat_rgba_fxt1;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.EXT_texture_compression_s3tc) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgb_dxt1;
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgba_dxt1;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ return &_mesa_texformat_rgba_dxt3;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ return &_mesa_texformat_rgba_dxt5;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.S3_s3tc) {
+ switch (internalFormat) {
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ return &_mesa_texformat_rgb_dxt1;
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ return &_mesa_texformat_rgba_dxt3;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.ARB_texture_float) {
+ switch (internalFormat) {
+ case GL_ALPHA16F_ARB:
+ return &_mesa_texformat_alpha_float16;
+ case GL_ALPHA32F_ARB:
+ return &_mesa_texformat_alpha_float32;
+ case GL_LUMINANCE16F_ARB:
+ return &_mesa_texformat_luminance_float16;
+ case GL_LUMINANCE32F_ARB:
+ return &_mesa_texformat_luminance_float32;
+ case GL_LUMINANCE_ALPHA16F_ARB:
+ return &_mesa_texformat_luminance_alpha_float16;
+ case GL_LUMINANCE_ALPHA32F_ARB:
+ return &_mesa_texformat_luminance_alpha_float32;
+ case GL_INTENSITY16F_ARB:
+ return &_mesa_texformat_intensity_float16;
+ case GL_INTENSITY32F_ARB:
+ return &_mesa_texformat_intensity_float32;
+ case GL_RGB16F_ARB:
+ return &_mesa_texformat_rgb_float16;
+ case GL_RGB32F_ARB:
+ return &_mesa_texformat_rgb_float32;
+ case GL_RGBA16F_ARB:
+ return &_mesa_texformat_rgba_float16;
+ case GL_RGBA32F_ARB:
+ return &_mesa_texformat_rgba_float32;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
+ return NULL;
}