diff options
author | Maciej Cencora <m.cencora@gmail.com> | 2009-08-16 14:51:22 +0200 |
---|---|---|
committer | Maciej Cencora <m.cencora@gmail.com> | 2009-08-16 14:51:55 +0200 |
commit | 50b5ea55ef73f52604c6c0e6b7489b5944416f0a (patch) | |
tree | e5dd430fd087d4030d44d66e654c719b9eb511cb | |
parent | cc88658e40c144729df53796245735ee98b63ade (diff) |
mesa: add support for ARB_texture_rg
-rw-r--r-- | src/mesa/glapi/ARB_texture_rg.xml | 39 | ||||
-rw-r--r-- | src/mesa/glapi/gl_API.xml | 2 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 1 | ||||
-rw-r--r-- | src/mesa/main/image.c | 18 | ||||
-rw-r--r-- | src/mesa/main/texformat.c | 142 | ||||
-rw-r--r-- | src/mesa/main/texformat.h | 12 | ||||
-rw-r--r-- | src/mesa/main/texformat_tmp.h | 111 | ||||
-rw-r--r-- | src/mesa/main/texparam.c | 3 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 6 | ||||
-rw-r--r-- | src/mesa/main/texstore.c | 42 |
10 files changed, 355 insertions, 21 deletions
diff --git a/src/mesa/glapi/ARB_texture_rg.xml b/src/mesa/glapi/ARB_texture_rg.xml new file mode 100644 index 0000000000..c783887853 --- /dev/null +++ b/src/mesa/glapi/ARB_texture_rg.xml @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<OpenGLAPI> + +<category name="GL_ARB_texture_rg" number="53"> + <enum name="R8" value="0x8229"/> + <enum name="R16" value="0x822A"/> + + <enum name="RG8" value="0x822B"/> + <enum name="RG16" value="0x822C"/> + + <enum name="R16F" value="0x822D"/> + <enum name="R32F" value="0x822E"/> + + <enum name="RG16F" value="0x822F"/> + <enum name="RG32F" value="0x8230"/> + + <enum name="R8I" value="0x8231"/> + <enum name="R8UI" value="0x8232"/> + <enum name="R16I" value="0x8233"/> + <enum name="R16UI" value="0x8234"/> + <enum name="R32I" value="0x8235"/> + <enum name="R32UI" value="0x8236"/> + + <enum name="RG8I" value="0x8237"/> + <enum name="RG8UI" value="0x8238"/> + <enum name="RG16I" value="0x8239"/> + <enum name="RG16UI" value="0x823A"/> + <enum name="RG32I" value="0x823B"/> + <enum name="RG32UI" value="0x823C"/> + + <enum name="RG" value="0x8227"/> + <enum name="RG_INTEGER" value="0x8228"/> + + <enum name="RED" value="0x1903"/> +</category> + +</OpenGLAPI> diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index d2fcc6dc1f..0074683dbc 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -8946,6 +8946,8 @@ </function> </category> +<xi:include href="ARB_texture_rg.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + <category name="GL_EXT_point_parameters" number="54"> <enum name="POINT_SIZE_MIN_EXT" count="1" value="0x8126"> <size name="PointParameterfvEXT"/> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index f43b3a4790..cccc4bd69f 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -232,6 +232,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE; ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; ctx->Extensions.ARB_vertex_array_object = GL_TRUE; + ctx->Extensions.ARB_texture_rg = GL_TRUE; #if FEATURE_ARB_vertex_program ctx->Extensions.ARB_vertex_program = GL_TRUE; #endif diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index d77c593ac7..5af8a9eb69 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -282,6 +282,8 @@ _mesa_components_in_format( GLenum format ) return 1; case GL_LUMINANCE_ALPHA: return 2; + case GL_RG: + return 2; case GL_RGB: return 3; case GL_RGBA: @@ -435,6 +437,21 @@ _mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type ) default: return GL_FALSE; } + case GL_RG: + switch (type) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + return GL_TRUE; + case GL_HALF_FLOAT_ARB: + return ctx->Extensions.ARB_half_float_pixel; + default: + return GL_FALSE; + } case GL_RGB: switch (type) { case GL_BYTE: @@ -555,6 +572,7 @@ _mesa_is_color_format(GLenum format) case GL_LUMINANCE12: case GL_LUMINANCE16: case 2: + case GL_RG: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index dfe62e19be..8eced924f0 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -211,8 +211,8 @@ const struct gl_texture_format _mesa_texformat_rg = { store_texel_rg /* StoreTexel */ }; -const struct gl_texture_format _mesa_texformat_r = { - MESA_FORMAT_R, /* MesaFormat */ +const struct gl_texture_format _mesa_texformat_red = { + MESA_FORMAT_RED, /* MesaFormat */ GL_RED, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ CHAN_BITS, /* RedBits */ @@ -229,10 +229,10 @@ const struct gl_texture_format _mesa_texformat_r = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_r, /* FetchTexel1Df */ - fetch_texel_2d_f_r, /* FetchTexel2Df */ - fetch_texel_3d_f_r, /* FetchTexel3Df */ - store_texel_r /* StoreTexel */ + fetch_texel_1d_f_red, /* FetchTexel1Df */ + fetch_texel_2d_f_red, /* FetchTexel2Df */ + fetch_texel_3d_f_red, /* FetchTexel3Df */ + store_texel_red /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha = { @@ -553,6 +553,102 @@ const struct gl_texture_format _mesa_texformat_rgb_float16 = { store_texel_rgb_f16 /* StoreTexel */ }; +const struct gl_texture_format _mesa_texformat_rg_float32 = { + MESA_FORMAT_RG_FLOAT32, /* MesaFormat */ + GL_RG, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 8 * sizeof(GLfloat), /* RedBits */ + 8 * sizeof(GLfloat), /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* StencilBits */ + 2 * sizeof(GLfloat), /* TexelBytes */ + _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + fetch_texel_1d_f_rg_f32, /* FetchTexel1Df */ + fetch_texel_2d_f_rg_f32, /* FetchTexel2Df */ + fetch_texel_3d_f_rg_f32, /* FetchTexel3Df */ + store_texel_rg_f32 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rg_float16 = { + MESA_FORMAT_RG_FLOAT16, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 8 * sizeof(GLhalfARB), /* RedBits */ + 8 * sizeof(GLhalfARB), /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* StencilBits */ + 2 * sizeof(GLhalfARB), /* TexelBytes */ + _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + fetch_texel_1d_f_rg_f16, /* FetchTexel1Df */ + fetch_texel_2d_f_rg_f16, /* FetchTexel2Df */ + fetch_texel_3d_f_rg_f16, /* FetchTexel3Df */ + store_texel_rg_f16 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_red_float32 = { + MESA_FORMAT_RED_FLOAT32, /* MesaFormat */ + GL_RED, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 8 * sizeof(GLfloat), /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* StencilBits */ + 1 * sizeof(GLfloat), /* TexelBytes */ + _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + fetch_texel_1d_f_red_f32, /* FetchTexel1Df */ + fetch_texel_2d_f_red_f32, /* FetchTexel2Df */ + fetch_texel_3d_f_red_f32, /* FetchTexel3Df */ + store_texel_red_f32 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_red_float16 = { + MESA_FORMAT_RED_FLOAT16, /* MesaFormat */ + GL_RED, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 8 * sizeof(GLhalfARB), /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* StencilBits */ + 1 * sizeof(GLhalfARB), /* TexelBytes */ + _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + fetch_texel_1d_f_red_f16, /* FetchTexel1Df */ + fetch_texel_2d_f_red_f16, /* FetchTexel2Df */ + fetch_texel_3d_f_red_f16, /* FetchTexel3Df */ + store_texel_red_f16 /* StoreTexel */ +}; + const struct gl_texture_format _mesa_texformat_alpha_float32 = { MESA_FORMAT_ALPHA_FLOAT32, /* MesaFormat */ GL_ALPHA, /* BaseFormat */ @@ -1536,7 +1632,7 @@ const struct gl_texture_format _mesa_texformat_r8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_r8, /* StoreTexImageFunc */ + _mesa_texstore_a8, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1907,21 +2003,39 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, if (ctx->Extensions.ARB_texture_rg) { switch (internalFormat) { case GL_RG: - return &_mesa_texformat_rg; + return &_mesa_texformat_rg; case GL_RG8: - return &_mesa_texformat_rg88; + return &_mesa_texformat_rg88; case GL_RED: - return &_mesa_texformat_r; + return &_mesa_texformat_red; case GL_R8: - return &_mesa_texformat_r8; + return &_mesa_texformat_r8; default: ; /* fallthrough */ } - _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); - return NULL; + + if (ctx->Extensions.ARB_texture_float) { + switch (internalFormat) { + case GL_R16F: + return &_mesa_texformat_red_float16; + case GL_R32F: + return &_mesa_texformat_red_float32; + + case GL_RG16F: + return &_mesa_texformat_rg_float16; + case GL_RG32F: + return &_mesa_texformat_rg_float32; + + default: + ; /* fallthrough */ + } + } } + + _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); + return NULL; } @@ -2080,7 +2194,7 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format, case MESA_FORMAT_ALPHA: case MESA_FORMAT_LUMINANCE: case MESA_FORMAT_INTENSITY: - case MESA_FORMAT_R: + case MESA_FORMAT_RED: *datatype = CHAN_TYPE; *comps = 1; return; diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index fb438c0905..7a9f0821c1 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -144,7 +144,7 @@ enum _format { MESA_FORMAT_RGBA, MESA_FORMAT_RGB, MESA_FORMAT_RG, - MESA_FORMAT_R, + MESA_FORMAT_RED, MESA_FORMAT_ALPHA, MESA_FORMAT_LUMINANCE, MESA_FORMAT_LUMINANCE_ALPHA, @@ -159,6 +159,10 @@ enum _format { MESA_FORMAT_RGBA_FLOAT16, MESA_FORMAT_RGB_FLOAT32, MESA_FORMAT_RGB_FLOAT16, + MESA_FORMAT_RG_FLOAT32, + MESA_FORMAT_RG_FLOAT16, + MESA_FORMAT_RED_FLOAT32, + MESA_FORMAT_RED_FLOAT16, MESA_FORMAT_ALPHA_FLOAT32, MESA_FORMAT_ALPHA_FLOAT16, MESA_FORMAT_LUMINANCE_FLOAT32, @@ -185,7 +189,7 @@ enum _format { extern const struct gl_texture_format _mesa_texformat_rgba; extern const struct gl_texture_format _mesa_texformat_rgb; extern const struct gl_texture_format _mesa_texformat_rg; -extern const struct gl_texture_format _mesa_texformat_r; +extern const struct gl_texture_format _mesa_texformat_red; extern const struct gl_texture_format _mesa_texformat_alpha; extern const struct gl_texture_format _mesa_texformat_luminance; extern const struct gl_texture_format _mesa_texformat_luminance_alpha; @@ -215,6 +219,10 @@ extern const struct gl_texture_format _mesa_texformat_rgba_float32; extern const struct gl_texture_format _mesa_texformat_rgba_float16; extern const struct gl_texture_format _mesa_texformat_rgb_float32; extern const struct gl_texture_format _mesa_texformat_rgb_float16; +extern const struct gl_texture_format _mesa_texformat_rg_float32; +extern const struct gl_texture_format _mesa_texformat_rg_float16; +extern const struct gl_texture_format _mesa_texformat_red_float32; +extern const struct gl_texture_format _mesa_texformat_red_float16; extern const struct gl_texture_format _mesa_texformat_alpha_float32; extern const struct gl_texture_format _mesa_texformat_alpha_float16; extern const struct gl_texture_format _mesa_texformat_luminance_float32; diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 5b5431c048..dc8f50e6c5 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -146,10 +146,10 @@ static void store_texel_rg(struct gl_texture_image *texImage, } #endif -/* MESA_FORMAT_R ***********************************************************/ +/* MESA_FORMAT_RED ***********************************************************/ /* Fetch texel from 1D, 2D or 3D RED texture, returning 4 GLfloats */ -static void FETCH(f_r)(const struct gl_texture_image *texImage, +static void FETCH(f_red)(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel) { const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); @@ -160,7 +160,7 @@ static void FETCH(f_r)(const struct gl_texture_image *texImage, } #if DIM == 3 -static void store_texel_r(struct gl_texture_image *texImage, +static void store_texel_red(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLchan *rgba = (const GLchan *) texel; @@ -416,6 +416,110 @@ static void store_texel_rgb_f16(struct gl_texture_image *texImage, #endif +/* MESA_FORMAT_RG_F32 *******************************************************/ + +/* Fetch texel from 1D, 2D or 3D RG_FLOAT32 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_rg_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3); + texel[RCOMP] = src[0]; + texel[GCOMP] = src[1]; + texel[BCOMP] = 0.0; + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_rg_f32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *depth = (const GLfloat *) texel; + GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); + dst[0] = *depth; +} +#endif + + +/* MESA_FORMAT_RG_F16 *******************************************************/ + +/* Fetch texel from 1D, 2D or 3D RG_FLOAT16 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_rg_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3); + texel[RCOMP] = _mesa_half_to_float(src[0]); + texel[GCOMP] = _mesa_half_to_float(src[1]); + texel[BCOMP] = 0.0; + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_rg_f16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *depth = (const GLfloat *) texel; + GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); + dst[0] = _mesa_float_to_half(*depth); +} +#endif + + +/* MESA_FORMAT_RED_F32 *******************************************************/ + +/* Fetch texel from 1D, 2D or 3D RED_FLOAT32 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_red_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3); + texel[RCOMP] = src[0]; + texel[GCOMP] = 0.0; + texel[BCOMP] = 0.0;; + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_red_f32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *depth = (const GLfloat *) texel; + GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); + dst[0] = *depth; +} +#endif + + +/* MESA_FORMAT_RED_F16 *******************************************************/ + +/* Fetch texel from 1D, 2D or 3D RED_FLOAT16 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_red_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3); + texel[RCOMP] = _mesa_half_to_float(src[0]); + texel[GCOMP] = 0.0; + texel[BCOMP] = 0.0;; + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_red_f16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *depth = (const GLfloat *) texel; + GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); + dst[0] = _mesa_float_to_half(*depth); +} +#endif + + /* MESA_FORMAT_ALPHA_F32 *****************************************************/ /* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture, @@ -1052,7 +1156,6 @@ static void store_texel_r8(struct gl_texture_image *texImage, } #endif - /* MESA_FORMAT_AL88 **********************************************************/ /* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */ diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 05d144270e..e67cc40a80 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -353,7 +353,8 @@ set_tex_parameteri(GLcontext *ctx, if (ctx->Extensions.ARB_depth_texture && (params[0] == GL_LUMINANCE || params[0] == GL_INTENSITY || - params[0] == GL_ALPHA)) { + params[0] == GL_ALPHA || + params[0] == GL_RED)) { if (texObj->DepthMode != params[0]) { flush(ctx, texObj); texObj->DepthMode = params[0]; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 6e0c0c688a..af99543dd7 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -180,6 +180,8 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state, case GL_RGB: case GL_YCBCR_MESA: case GL_DUDV_ATI: + case GL_RED: + case GL_RG: state->SourceA[0] = GL_PREVIOUS; break; @@ -220,6 +222,8 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state, case GL_RGB: case GL_YCBCR_MESA: case GL_DUDV_ATI: + case GL_RED: + case GL_RG: mode_rgb = GL_REPLACE; break; case GL_RGBA: @@ -247,6 +251,8 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state, case GL_RGBA: case GL_YCBCR_MESA: case GL_DUDV_ATI: + case GL_RED: + case GL_RG: state->SourceRGB[2] = GL_TEXTURE; state->SourceA[2] = GL_TEXTURE; state->SourceRGB[0] = GL_CONSTANT; diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 8be2c9fa1b..db27f215ba 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -86,6 +86,7 @@ can_swizzle(GLenum logicalBaseFormat) switch (logicalBaseFormat) { case GL_RGBA: case GL_RGB: + case GL_RG: case GL_LUMINANCE_ALPHA: case GL_INTENSITY: case GL_ALPHA: @@ -117,6 +118,7 @@ enum { IDX_BGR, IDX_BGRA, IDX_ABGR, + IDX_RG, MAX_IDX }; @@ -204,6 +206,13 @@ static const struct { MAP4(3,2,1,0), MAP4(3,2,1,0) }, + + { + IDX_RG, + MAP4(0, 1, ZERO, ONE), + MAP2(0, 1) + } + }; @@ -227,6 +236,7 @@ get_map_idx(GLenum value) case GL_BGR: return IDX_BGR; case GL_BGRA: return IDX_BGRA; case GL_ABGR_EXT: return IDX_ABGR; + case GL_RG: return IDX_RG; default: _mesa_problem(NULL, "Unexpected inFormat"); return 0; @@ -321,6 +331,8 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, ASSERT(logicalBaseFormat == GL_RGBA || logicalBaseFormat == GL_RGB || + logicalBaseFormat == GL_RG || + logicalBaseFormat == GL_RED || logicalBaseFormat == GL_LUMINANCE_ALPHA || logicalBaseFormat == GL_LUMINANCE || logicalBaseFormat == GL_ALPHA || @@ -330,6 +342,8 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, ASSERT(textureBaseFormat == GL_RGBA || textureBaseFormat == GL_RGB || + textureBaseFormat == GL_RG || + textureBaseFormat == GL_RED || textureBaseFormat == GL_LUMINANCE_ALPHA || textureBaseFormat == GL_LUMINANCE || textureBaseFormat == GL_ALPHA || @@ -550,6 +564,8 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, ASSERT(logicalBaseFormat == GL_RGBA || logicalBaseFormat == GL_RGB || + logicalBaseFormat == GL_RG || + logicalBaseFormat == GL_RED || logicalBaseFormat == GL_LUMINANCE_ALPHA || logicalBaseFormat == GL_LUMINANCE || logicalBaseFormat == GL_ALPHA || @@ -557,6 +573,8 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, ASSERT(textureBaseFormat == GL_RGBA || textureBaseFormat == GL_RGB || + textureBaseFormat == GL_RG || + textureBaseFormat == GL_RED || textureBaseFormat == GL_LUMINANCE_ALPHA || textureBaseFormat == GL_LUMINANCE || textureBaseFormat == GL_ALPHA || @@ -1000,6 +1018,8 @@ memcpy_texture(GLcontext *ctx, * Store an image in any of the formats: * _mesa_texformat_rgba * _mesa_texformat_rgb + * _mesa_texformat_rg + * _mesa_texformat_red * _mesa_texformat_alpha * _mesa_texformat_luminance * _mesa_texformat_luminance_alpha @@ -1013,12 +1033,16 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) ASSERT(dstFormat == &_mesa_texformat_rgba || dstFormat == &_mesa_texformat_rgb || + dstFormat == &_mesa_texformat_rg || + dstFormat == &_mesa_texformat_red || dstFormat == &_mesa_texformat_alpha || dstFormat == &_mesa_texformat_luminance || dstFormat == &_mesa_texformat_luminance_alpha || dstFormat == &_mesa_texformat_intensity); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || + baseInternalFormat == GL_RG || + baseInternalFormat == GL_RED || baseInternalFormat == GL_ALPHA || baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || @@ -1104,6 +1128,14 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) dstmap = mappings[IDX_INTENSITY].from_rgba; components = 1; } + else if (dstFormat == &_mesa_texformat_rg) { + dstmap = mappings[IDX_RG].from_rgba; + components = 2; + } + else if (dstFormat == &_mesa_texformat_red) { + dstmap = mappings[IDX_RED].from_rgba; + components = 1; + } else { _mesa_problem(ctx, "Unexpected dstFormat in _mesa_texstore_rgba"); return GL_FALSE; @@ -2983,6 +3015,8 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) * Store an image in any of the formats: * _mesa_texformat_rgba_float32 * _mesa_texformat_rgb_float32 + * _mesa_texformat_rg_float32 + * _mesa_texformat_red_float32 * _mesa_texformat_alpha_float32 * _mesa_texformat_luminance_float32 * _mesa_texformat_luminance_alpha_float32 @@ -2995,12 +3029,16 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) ASSERT(dstFormat == &_mesa_texformat_rgba_float32 || dstFormat == &_mesa_texformat_rgb_float32 || + dstFormat == &_mesa_texformat_rg_float32 || + dstFormat == &_mesa_texformat_red_float32 || dstFormat == &_mesa_texformat_alpha_float32 || dstFormat == &_mesa_texformat_luminance_float32 || dstFormat == &_mesa_texformat_luminance_alpha_float32 || dstFormat == &_mesa_texformat_intensity_float32); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || + baseInternalFormat == GL_RG || + baseInternalFormat == GL_RED || baseInternalFormat == GL_ALPHA || baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || @@ -3062,12 +3100,16 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) ASSERT(dstFormat == &_mesa_texformat_rgba_float16 || dstFormat == &_mesa_texformat_rgb_float16 || + dstFormat == &_mesa_texformat_rg_float16 || + dstFormat == &_mesa_texformat_red_float16 || dstFormat == &_mesa_texformat_alpha_float16 || dstFormat == &_mesa_texformat_luminance_float16 || dstFormat == &_mesa_texformat_luminance_alpha_float16 || dstFormat == &_mesa_texformat_intensity_float16); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || + baseInternalFormat == GL_RG || + baseInternalFormat == GL_RED || baseInternalFormat == GL_ALPHA || baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || |