From 7870298086cfdde020437e23ba86abb61741129e Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 25 Oct 2009 23:24:18 +0800 Subject: glapi: Allow normal entry points to be skipped. Reorganize glapitemp.h such that it is possible to skip normal entry points or protocol entry points by defining _GLAPI_SKIP_NORMAL_ENTRY_POINTS or _GLAPI_SKIP_PROTO_ENTRY_POINTS. Protocol entry points are those with different GLX protocols. They are skipped in libglapi.a when GLX_INDIRECT_RENDERING is defined. Signed-off-by: Chia-I Wu --- src/mesa/main/dispatch.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index 97d213e8e1..cd5410514d 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -89,6 +89,10 @@ #define GLAPIENTRY #endif +#ifdef GLX_INDIRECT_RENDERING +/* those link to libglapi.a should provide the entry points */ +#define _GLAPI_SKIP_PROTO_ENTRY_POINTS +#endif #include "glapi/glapitemp.h" #endif /* USE_X86_ASM */ -- cgit v1.2.3 From c3d61d378574878deedb44d84f506ca23e66c6ca Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 7 Sep 2009 14:46:22 +0800 Subject: mesa/main: Add support for point size array in _mesa_GetPointerv. Signed-off-by: Chia-I Wu --- src/mesa/main/getstring.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index 6599ed9698..4b1f4b0ea1 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -242,6 +242,11 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) case GL_SELECTION_BUFFER_POINTER: *params = ctx->Select.Buffer; break; +#if FEATURE_point_size_array + case GL_POINT_SIZE_ARRAY_POINTER_OES: + *params = (GLvoid *) ctx->Array.ArrayObj->PointSize.Ptr; + break; +#endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" ); return; -- cgit v1.2.3 From 8d2edbf1395ca1e2d23b3bd2ba2c5d54f21d377b Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 21 Sep 2009 18:46:28 +0800 Subject: mesa/main: Add more OpenGL ES types to glheader.h. Signed-off-by: Chia-I Wu --- src/mesa/main/glheader.h | 7 +++++++ src/mesa/swrast/swrast.h | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 81d4ccf919..77544c88c6 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -57,6 +57,13 @@ #ifndef GL_FIXED #define GL_FIXED 0x140C +typedef int GLfixed; +typedef int GLclampx; +#endif + + +#ifndef GL_OES_EGL_image +typedef void *GLeglImageOES; #endif diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index c183b315b6..c01cf7d1f0 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -75,12 +75,6 @@ typedef struct { } SWvertex; -/** - * Fixed point data type. - */ -typedef int GLfixed; - - #define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0 -- cgit v1.2.3 From 5b426288c2dbc42ef44ea13fe37afa77223107bb Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 3 Sep 2009 11:03:20 +0800 Subject: glapi: Include headers with directory prefixes. This allows different sets of generated sources and headers to be used. Signed-off-by: Chia-I Wu --- src/mesa/glapi/dispatch.h | 6 +++--- src/mesa/glapi/gl_enums.py | 8 ++++---- src/mesa/glapi/gl_x86-64_asm.py | 2 +- src/mesa/glapi/gl_x86_asm.py | 2 +- src/mesa/glapi/glapi.c | 8 ++++---- src/mesa/glapi/glapi_getproc.c | 8 ++++---- src/mesa/glapi/glthread.c | 2 +- src/mesa/main/enums.c | 8 ++++---- src/mesa/main/remap.c | 2 +- src/mesa/x86-64/glapi_x86-64.S | 2 +- src/mesa/x86/glapi_x86.S | 2 +- 11 files changed, 25 insertions(+), 25 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h index 6623d52469..27f80a5062 100644 --- a/src/mesa/glapi/dispatch.h +++ b/src/mesa/glapi/dispatch.h @@ -30,8 +30,8 @@ #define _GLAPI_USE_REMAP_TABLE #endif -#include "glapitable.h" -#include "glapioffsets.h" -#include "glapidispatch.h" +#include "glapi/glapitable.h" +#include "glapi/glapioffsets.h" +#include "glapi/glapidispatch.h" #endif /* _DISPATCH_H */ diff --git a/src/mesa/glapi/gl_enums.py b/src/mesa/glapi/gl_enums.py index 27ab119537..acaa06ab37 100644 --- a/src/mesa/glapi/gl_enums.py +++ b/src/mesa/glapi/gl_enums.py @@ -42,10 +42,10 @@ class PrintGlEnums(gl_XML.gl_print_base): def printRealHeader(self): - print '#include "glheader.h"' - print '#include "mfeatures.h"' - print '#include "enums.h"' - print '#include "imports.h"' + print '#include "main/glheader.h"' + print '#include "main/mfeatures.h"' + print '#include "main/enums.h"' + print '#include "main/imports.h"' print '' print 'typedef struct {' print ' size_t offset;' diff --git a/src/mesa/glapi/gl_x86-64_asm.py b/src/mesa/glapi/gl_x86-64_asm.py index f36ad3a5d8..31c1a2b93a 100644 --- a/src/mesa/glapi/gl_x86-64_asm.py +++ b/src/mesa/glapi/gl_x86-64_asm.py @@ -122,7 +122,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): print " * the symbol visibility mode to 'default'." print ' */' print '' - print '#include "../x86/assyntax.h"' + print '#include "x86/assyntax.h"' print '' print '#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303' print '# pragma GCC visibility push(default)' diff --git a/src/mesa/glapi/gl_x86_asm.py b/src/mesa/glapi/gl_x86_asm.py index 36f0e31fe2..d293497736 100644 --- a/src/mesa/glapi/gl_x86_asm.py +++ b/src/mesa/glapi/gl_x86_asm.py @@ -53,7 +53,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): def printRealHeader(self): - print '#include "assyntax.h"' + print '#include "x86/assyntax.h"' print '#include "glapi/glapioffsets.h"' print '' print '#if defined(STDCALL_API)' diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index e36fccb354..ad72fe48be 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -69,9 +69,9 @@ #include #endif -#include "glapi.h" -#include "glapioffsets.h" -#include "glapitable.h" +#include "glapi/glapi.h" +#include "glapi/glapioffsets.h" +#include "glapi/glapitable.h" /***** BEGIN NO-OP DISPATCH *****/ @@ -145,7 +145,7 @@ static GLint NoOpUnused(void) return 0; } -#include "glapitemp.h" +#include "glapi/glapitemp.h" /***** END NO-OP DISPATCH *****/ diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c index ed443c12c8..decdd05b13 100644 --- a/src/mesa/glapi/glapi_getproc.c +++ b/src/mesa/glapi/glapi_getproc.c @@ -34,9 +34,9 @@ #include #include "main/glheader.h" #include "main/compiler.h" -#include "glapi.h" -#include "glapioffsets.h" -#include "glapitable.h" +#include "glapi/glapi.h" +#include "glapi/glapioffsets.h" +#include "glapi/glapitable.h" static void @@ -75,7 +75,7 @@ str_dup(const char *str) #endif /* The code in this file is auto-generated with Python */ -#include "glprocs.h" +#include "glapi/glprocs.h" /** diff --git a/src/mesa/glapi/glthread.c b/src/mesa/glapi/glthread.c index 737fd4d6a8..dc90b3602c 100644 --- a/src/mesa/glapi/glthread.c +++ b/src/mesa/glapi/glthread.c @@ -33,7 +33,7 @@ #endif #include "main/compiler.h" -#include "glthread.h" +#include "glapi/glthread.h" /* diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index 606d50c59a..dedb6af7b5 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -25,10 +25,10 @@ * SOFTWARE. */ -#include "glheader.h" -#include "mfeatures.h" -#include "enums.h" -#include "imports.h" +#include "main/glheader.h" +#include "main/mfeatures.h" +#include "main/enums.h" +#include "main/imports.h" typedef struct { size_t offset; diff --git a/src/mesa/main/remap.c b/src/mesa/main/remap.c index 0385ae8d7d..5f32a48258 100644 --- a/src/mesa/main/remap.c +++ b/src/mesa/main/remap.c @@ -45,7 +45,7 @@ #define need_MESA_remap_table -#include "remap_helper.h" +#include "main/remap_helper.h" #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) #define MAX_ENTRY_POINTS 16 diff --git a/src/mesa/x86-64/glapi_x86-64.S b/src/mesa/x86-64/glapi_x86-64.S index 72d0532906..05afbb294c 100644 --- a/src/mesa/x86-64/glapi_x86-64.S +++ b/src/mesa/x86-64/glapi_x86-64.S @@ -29,7 +29,7 @@ * the symbol visibility mode to 'default'. */ -#include "../x86/assyntax.h" +#include "x86/assyntax.h" #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 # pragma GCC visibility push(default) diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S index 12c77f434e..117e31ede0 100644 --- a/src/mesa/x86/glapi_x86.S +++ b/src/mesa/x86/glapi_x86.S @@ -26,7 +26,7 @@ * SOFTWARE. */ -#include "assyntax.h" +#include "x86/assyntax.h" #include "glapi/glapioffsets.h" #if defined(STDCALL_API) -- cgit v1.2.3 From 7cdf8ab0967b1a80c16d317ed5b0e3b810312ad1 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 20 Oct 2009 12:39:56 +0800 Subject: mesa/main: Make _mesa_TexGenf and _mesa_GetTexGenfv global again. They are needed by OpenGL ES overlay. Signed-off-by: Chia-I Wu --- src/mesa/main/texgen.c | 4 ++-- src/mesa/main/texgen.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index 733e129fcf..8d114108f8 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -208,7 +208,7 @@ _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) } -static void GLAPIENTRY +void GLAPIENTRY _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) { _mesa_TexGenfv(coord, pname, ¶m); @@ -261,7 +261,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) -static void GLAPIENTRY +void GLAPIENTRY _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) { struct gl_texture_unit *texUnit; diff --git a/src/mesa/main/texgen.h b/src/mesa/main/texgen.h index f6924ef722..eb4626033a 100644 --- a/src/mesa/main/texgen.h +++ b/src/mesa/main/texgen.h @@ -40,9 +40,15 @@ extern void GLAPIENTRY _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); +extern void GLAPIENTRY +_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ); + extern void GLAPIENTRY _mesa_TexGeni( GLenum coord, GLenum pname, GLint param ); +extern void GLAPIENTRY +_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); + extern void _mesa_init_texgen_dispatch(struct _glapi_table *disp); -- cgit v1.2.3 From 34064756a5e2c8952c9de26eaebafddabd562540 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 22 Sep 2009 15:00:24 +0800 Subject: mesa/es: Add support for GL_OES_draw_texture. Signed-off-by: Chia-I Wu --- src/mesa/es/main/APIspec.txt | 77 ++++++++ src/mesa/es/main/drawtex.c | 148 +++++++++++++++ src/mesa/es/main/drawtex.h | 77 ++++++++ src/mesa/es/main/mfeatures_es1.h | 1 + src/mesa/es/main/mfeatures_es2.h | 1 + src/mesa/es/main/specials_es1.c | 5 + src/mesa/es/sources.mak | 4 +- src/mesa/es/state_tracker/st_cb_drawtex.c | 297 ++++++++++++++++++++++++++++++ src/mesa/es/state_tracker/st_cb_drawtex.h | 18 ++ src/mesa/main/dd.h | 10 + src/mesa/main/extensions.c | 3 + src/mesa/main/mtypes.h | 3 + src/mesa/state_tracker/st_context.c | 9 +- src/mesa/state_tracker/st_extensions.c | 4 + 14 files changed, 654 insertions(+), 3 deletions(-) create mode 100644 src/mesa/es/main/drawtex.c create mode 100644 src/mesa/es/main/drawtex.h create mode 100644 src/mesa/es/state_tracker/st_cb_drawtex.c create mode 100644 src/mesa/es/state_tracker/st_cb_drawtex.h (limited to 'src/mesa/main') diff --git a/src/mesa/es/main/APIspec.txt b/src/mesa/es/main/APIspec.txt index 86dd546f63..6d18ae67d9 100644 --- a/src/mesa/es/main/APIspec.txt +++ b/src/mesa/es/main/APIspec.txt @@ -412,6 +412,8 @@ checkdependentparam pname GL_TEXTURE_WRAP_T params GLES1.1:GL_MIRRORED_REPEAT_OE dependentvector params 1 pname GL_TEXTURE_MAX_ANISOTROPY_EXT # OES_texture_3D checkdependentparam pname GL_TEXTURE_WRAP_R_OES params GLES2.0:GL_CLAMP_TO_EDGE GLES2.0:GL_REPEAT GLES2.0:GL_MIRRORED_REPEAT +# OES_draw_texture - not in gl2ext.h +dependentvector params 4 pname GLES1.1:GL_TEXTURE_CROP_RECT_OES category GLES1.1 GLES2.0 name TexParameteri @@ -457,6 +459,8 @@ checkdependentparam pname GL_TEXTURE_WRAP_T params GLES1.1:GL_MIRRORED_REPEAT_OE dependentvector params 1 pname GL_TEXTURE_MAX_ANISOTROPY_EXT # OES_texture_3D checkdependentparam pname GL_TEXTURE_WRAP_R_OES params GLES2.0:GL_CLAMP_TO_EDGE GLES2.0:GL_REPEAT GLES2.0:GL_MIRRORED_REPEAT +# OES_draw_texture - not in gl2ext.h +dependentvector params 4 pname GLES1.1:GL_TEXTURE_CROP_RECT_OES category GLES1.1 GLES2.0 name TexParameterx @@ -498,6 +502,8 @@ checkdependentparam pname GL_TEXTURE_MAG_FILTER params GL_NEAREST GL_LINEAR checkdependentparam pname GL_GENERATE_MIPMAP params GL_TRUE GL_FALSE convertalias TexParameterfv convertparams GLfloat params +# OES_draw_texture +dependentvector params 4 pname GL_TEXTURE_CROP_RECT_OES # OES_texture_cube_map checkparam target GL_TEXTURE_CUBE_MAP_OES # OES_texture_mirrored_repeat @@ -1352,6 +1358,8 @@ param pname GLenum param params GLfloat * dependentvector params 1 pname GL_TEXTURE_WRAP_S GL_TEXTURE_WRAP_T GL_TEXTURE_MIN_FILTER GL_TEXTURE_MAG_FILTER GLES1.1:GL_GENERATE_MIPMAP props get +# OES_draw_texture - not in gl2ext.h +dependentvector params 4 pname GLES1.1:GL_TEXTURE_CROP_RECT_OES # OES_texture_cube_map checkparam target GLES1.1:GL_TEXTURE_CUBE_MAP_OES category GLES1.1 GLES2.0 @@ -1366,6 +1374,8 @@ dependentvector params 1 pname GL_TEXTURE_WRAP_S GL_TEXTURE_WRAP_T GL_TEXTURE_MI props get # OES_texture_cube_map checkparam target GLES1.1:GL_TEXTURE_CUBE_MAP_OES +# OES_draw_texture - not in gl2ext.h +dependentvector params 4 pname GLES1.1:GL_TEXTURE_CROP_RECT_OES # OES_texture_3D checkparam target GLES2.0:GL_TEXTURE_3D_OES category GLES1.1 GLES2.0 @@ -1383,6 +1393,8 @@ dependentnovalueconvert params pname GL_TEXTURE_WRAP_S GL_TEXTURE_WRAP_T GL_TEXT props get # OES_texture_cube_map checkparam target GL_TEXTURE_CUBE_MAP_OES +# OES_draw_texture +dependentvector params 4 pname GL_TEXTURE_CROP_RECT_OES category GLES1.1 GLES1.1:OES_fixed_point # GLES1.1 and GLES2.0 have different capabilities @@ -2867,6 +2879,71 @@ vector exponent 16 props get category GLES1.1:OES_query_matrix +# OES_draw_texture +name DrawTexf +return void +param x GLfloat +param y GLfloat +param z GLfloat +param w GLfloat +param h GLfloat +category GLES1.1:OES_draw_texture + +name DrawTexi +return void +param x GLint +param y GLint +param z GLint +param w GLint +param h GLint +category GLES1.1:OES_draw_texture + +name DrawTexs +return void +param x GLshort +param y GLshort +param z GLshort +param w GLshort +param h GLshort +category GLES1.1:OES_draw_texture + +name DrawTexx +return void +param x GLfixed +param y GLfixed +param z GLfixed +param w GLfixed +param h GLfixed +convertalias DrawTexf +convertparams GLfloat x y z w h +category GLES1.1:OES_draw_texture + +name DrawTexfv +return void +param coords const GLfloat * +vector coords 5 +category GLES1.1:OES_draw_texture + +name DrawTexiv +return void +param coords const GLint * +vector coords 5 +category GLES1.1:OES_draw_texture + +name DrawTexsv +return void +param coords const GLshort * +vector coords 5 +category GLES1.1:OES_draw_texture + +name DrawTexxv +return void +param coords const GLfixed * +vector coords 5 +convertalias DrawTexfv +convertparams GLfloat coords +category GLES1.1:OES_draw_texture + # We don't support OES_get_program_binary yet either #name GetProgramBinary #return void diff --git a/src/mesa/es/main/drawtex.c b/src/mesa/es/main/drawtex.c new file mode 100644 index 0000000000..cbd41ca975 --- /dev/null +++ b/src/mesa/es/main/drawtex.c @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2009 Chia-I Wu + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "drawtex.h" +#include "main/state.h" +#include "main/imports.h" + +#include "glapi/dispatch.h" + + +#if FEATURE_OES_draw_texture + + +static void +draw_texture(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, + GLfloat width, GLfloat height) +{ + if (!ctx->Extensions.OES_draw_texture) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawTex(unsupported)"); + return; + } + if (width <= 0.0f || height <= 0.0f) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDrawTex(width or height <= 0)"); + return; + } + + if (ctx->NewState) + _mesa_update_state(ctx); + + ASSERT(ctx->Driver.DrawTex); + ctx->Driver.DrawTex(ctx, x, y, z, width, height); +} + + +void GLAPIENTRY +_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, x, y, z, width, height); +} + + +void GLAPIENTRY +_mesa_DrawTexfv(const GLfloat *coords) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, coords[0], coords[1], coords[2], coords[3], coords[4]); +} + + +void GLAPIENTRY +_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, (GLfloat) x, (GLfloat) y, (GLfloat) z, + (GLfloat) width, (GLfloat) height); +} + + +void GLAPIENTRY +_mesa_DrawTexiv(const GLint *coords) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, (GLfloat) coords[0], (GLfloat) coords[1], + (GLfloat) coords[2], (GLfloat) coords[3], (GLfloat) coords[4]); +} + + +void GLAPIENTRY +_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, (GLfloat) x, (GLfloat) y, (GLfloat) z, + (GLfloat) width, (GLfloat) height); +} + + +void GLAPIENTRY +_mesa_DrawTexsv(const GLshort *coords) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, (GLfloat) coords[0], (GLfloat) coords[1], + (GLfloat) coords[2], (GLfloat) coords[3], (GLfloat) coords[4]); +} + + +void GLAPIENTRY +_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, + (GLfloat) x / 65536.0f, + (GLfloat) y / 65536.0f, + (GLfloat) z / 65536.0f, + (GLfloat) width / 65536.0f, + (GLfloat) height / 65536.0f); +} + + +void GLAPIENTRY +_mesa_DrawTexxv(const GLfixed *coords) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, + (GLfloat) coords[0] / 65536.0f, + (GLfloat) coords[1] / 65536.0f, + (GLfloat) coords[2] / 65536.0f, + (GLfloat) coords[3] / 65536.0f, + (GLfloat) coords[4] / 65536.0f); +} + + +void +_mesa_init_drawtex_dispatch(struct _glapi_table *disp) +{ + SET_DrawTexfOES(disp, _mesa_DrawTexf); + SET_DrawTexfvOES(disp, _mesa_DrawTexfv); + SET_DrawTexiOES(disp, _mesa_DrawTexi); + SET_DrawTexivOES(disp, _mesa_DrawTexiv); + SET_DrawTexsOES(disp, _mesa_DrawTexs); + SET_DrawTexsvOES(disp, _mesa_DrawTexsv); + SET_DrawTexxOES(disp, _mesa_DrawTexx); + SET_DrawTexxvOES(disp, _mesa_DrawTexxv); +} + + +#endif /* FEATURE_OES_draw_texture */ diff --git a/src/mesa/es/main/drawtex.h b/src/mesa/es/main/drawtex.h new file mode 100644 index 0000000000..0f3bac38c7 --- /dev/null +++ b/src/mesa/es/main/drawtex.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2009 Chia-I Wu + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef DRAWTEX_H +#define DRAWTEX_H + + +#include "main/mtypes.h" + + +#if FEATURE_OES_draw_texture + +#define _MESA_INIT_DRAWTEX_FUNCTIONS(driver, impl) \ + do { \ + (driver)->DrawTex = impl ## DrawTex; \ + } while (0) + +extern void GLAPIENTRY +_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); + +extern void GLAPIENTRY +_mesa_DrawTexfv(const GLfloat *coords); + +extern void GLAPIENTRY +_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height); + +extern void GLAPIENTRY +_mesa_DrawTexiv(const GLint *coords); + +extern void GLAPIENTRY +_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); + +extern void GLAPIENTRY +_mesa_DrawTexsv(const GLshort *coords); + +extern void GLAPIENTRY +_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); + +extern void GLAPIENTRY +_mesa_DrawTexxv(const GLfixed *coords); + +extern void +_mesa_init_drawtex_dispatch(struct _glapi_table *disp); + +#else /* FEATURE_OES_draw_texture */ + +#define _MESA_INIT_DRAWTEX_FUNCTIONS(driver, impl) do { } while (0) + +static INLINE void +_mesa_init_drawtex_dispatch(struct _glapi_table *disp) +{ +} + +#endif /* FEATURE_OES_draw_texture */ + + +#endif /* DRAWTEX_H */ diff --git a/src/mesa/es/main/mfeatures_es1.h b/src/mesa/es/main/mfeatures_es1.h index 9c65596089..6c2ece2608 100644 --- a/src/mesa/es/main/mfeatures_es1.h +++ b/src/mesa/es/main/mfeatures_es1.h @@ -103,6 +103,7 @@ #define FEATURE_NV_vertex_program 0 #define FEATURE_OES_framebuffer_object 1 +#define FEATURE_OES_draw_texture 1 #define FEATURE_OES_mapbuffer 1 #define FEATURE_extra_context_init 1 diff --git a/src/mesa/es/main/mfeatures_es2.h b/src/mesa/es/main/mfeatures_es2.h index 6ed7b678dc..f34782fedb 100644 --- a/src/mesa/es/main/mfeatures_es2.h +++ b/src/mesa/es/main/mfeatures_es2.h @@ -103,6 +103,7 @@ #define FEATURE_NV_vertex_program 0 #define FEATURE_OES_framebuffer_object 1 +#define FEATURE_OES_draw_texture 0 #define FEATURE_OES_mapbuffer 1 #define FEATURE_extra_context_init 1 diff --git a/src/mesa/es/main/specials_es1.c b/src/mesa/es/main/specials_es1.c index 84d339ebf6..548fb0f029 100644 --- a/src/mesa/es/main/specials_es1.c +++ b/src/mesa/es/main/specials_es1.c @@ -100,6 +100,11 @@ make_extension_string(const GLcontext *ctx, char *str) /* 1.1 deprecated extensions */ len += append_extension(&str, "GL_OES_query_matrix"); +#if FEATURE_OES_draw_texture + if (ctx->Extensions.OES_draw_texture) + len += append_extension(&str, "GL_OES_draw_texture"); +#endif + if (ctx->Extensions.EXT_blend_equation_separate) len += append_extension(&str, "GL_OES_blend_equation_separate"); if (ctx->Extensions.EXT_blend_func_separate) diff --git a/src/mesa/es/sources.mak b/src/mesa/es/sources.mak index d12acaae80..11f735d52a 100644 --- a/src/mesa/es/sources.mak +++ b/src/mesa/es/sources.mak @@ -4,6 +4,7 @@ include $(MESA)/sources.mak LOCAL_ES1_SOURCES := \ main/api_exec_es1.c \ + main/drawtex.c \ main/get_es1.c \ main/specials_es1.c \ main/drawtex.c \ @@ -14,7 +15,8 @@ LOCAL_ES1_SOURCES := \ glapi/glapi-es1/main/enums.c LOCAL_ES1_GALLIUM_SOURCES := \ - $(LOCAL_ES1_SOURCES) + $(LOCAL_ES1_SOURCES) \ + state_tracker/st_cb_drawtex.c # always use local version of GLAPI_ASM_SOURCES LOCAL_ES1_API_ASM := $(addprefix glapi/glapi-es1/, $(GLAPI_ASM_SOURCES)) diff --git a/src/mesa/es/state_tracker/st_cb_drawtex.c b/src/mesa/es/state_tracker/st_cb_drawtex.c new file mode 100644 index 0000000000..3b98b9c40b --- /dev/null +++ b/src/mesa/es/state_tracker/st_cb_drawtex.c @@ -0,0 +1,297 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + **************************************************************************/ + + +/** + * Implementation of glDrawTex() for GL_OES_draw_tex + */ + + + +#include "main/imports.h" +#include "main/image.h" +#include "main/bufferobj.h" +#include "main/drawtex.h" +#include "main/macros.h" +#include "main/state.h" +#include "main/texformat.h" +#include "shader/program.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" + +#include "st_context.h" +#include "st_atom.h" +#include "st_atom_constbuf.h" +#include "st_draw.h" +#include "st_cb_drawtex.h" + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" +#include "pipe/p_inlines.h" +#include "pipe/p_shader_tokens.h" +#include "util/u_tile.h" +#include "util/u_draw_quad.h" +#include "util/u_simple_shaders.h" + +#include "cso_cache/cso_context.h" + + +struct cached_shader +{ + //struct pipe_shader_state shader; + void *handle; + + uint num_attribs; + uint semantic_names[2 + MAX_TEXTURE_UNITS]; + uint semantic_indexes[2 + MAX_TEXTURE_UNITS]; +}; + +#define MAX_SHADERS (2 * MAX_TEXTURE_UNITS) + +/** + * Simple linear list cache. + * Most of the time there'll only be one cached shader. + */ +static struct cached_shader CachedShaders[MAX_SHADERS]; +static GLuint NumCachedShaders = 0; + + +#if FEATURE_OES_draw_texture + + +static void * +lookup_shader(struct pipe_context *pipe, + uint num_attribs, + const uint *semantic_names, + const uint *semantic_indexes) +{ + GLuint i, j; + + /* look for existing shader with same attributes */ + for (i = 0; i < NumCachedShaders; i++) { + if (CachedShaders[i].num_attribs == num_attribs) { + GLboolean match = GL_TRUE; + for (j = 0; j < num_attribs; j++) { + if (semantic_names[j] != CachedShaders[i].semantic_names[j] || + semantic_indexes[j] != CachedShaders[i].semantic_indexes[j]) { + match = GL_FALSE; + break; + } + } + if (match) + return CachedShaders[i].handle; + } + } + + /* not found - create new one now */ + if (NumCachedShaders >= MAX_SHADERS) { + return NULL; + } + + CachedShaders[i].num_attribs = num_attribs; + for (j = 0; j < num_attribs; j++) { + CachedShaders[i].semantic_names[j] = semantic_names[j]; + CachedShaders[i].semantic_indexes[j] = semantic_indexes[j]; + } + + CachedShaders[i].handle = + util_make_vertex_passthrough_shader(pipe, + num_attribs, + semantic_names, + semantic_indexes); + NumCachedShaders++; + + return CachedShaders[i].handle; +} + +static void +st_DrawTex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, + GLfloat width, GLfloat height) +{ + struct st_context *st = ctx->st; + struct pipe_context *pipe = st->pipe; + struct cso_context *cso = ctx->st->cso_context; + struct pipe_buffer *vbuffer; + GLuint i, numTexCoords, numAttribs; + GLboolean emitColor; + uint semantic_names[2 + MAX_TEXTURE_UNITS]; + uint semantic_indexes[2 + MAX_TEXTURE_UNITS]; + GLbitfield inputs = VERT_BIT_POS; + + /* determine if we need vertex color */ + if (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL0) + emitColor = GL_TRUE; + else + emitColor = GL_FALSE; + + /* determine how many enabled sets of texcoords */ + numTexCoords = 0; + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + if (ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_2D_BIT) { + inputs |= VERT_BIT_TEX(i); + numTexCoords++; + } + } + + /* total number of attributes per vertex */ + numAttribs = 1 + emitColor + numTexCoords; + + + /* create the vertex buffer */ + vbuffer = pipe_buffer_create(pipe->screen, 32, PIPE_BUFFER_USAGE_VERTEX, + numAttribs * 4 * 4 * sizeof(GLfloat)); + + /* load vertex buffer */ + { +#define SET_ATTRIB(VERT, ATTR, X, Y, Z, W) \ + do { \ + GLuint k = (((VERT) * numAttribs + (ATTR)) * 4); \ + assert(k < 4 * 4 * numAttribs); \ + vbuf[k + 0] = X; \ + vbuf[k + 1] = Y; \ + vbuf[k + 2] = Z; \ + vbuf[k + 3] = W; \ + } while (0) + + const GLfloat x0 = x, y0 = y, x1 = x + width, y1 = y + height; + GLfloat *vbuf = (GLfloat *) pipe_buffer_map(pipe->screen, vbuffer, + PIPE_BUFFER_USAGE_CPU_WRITE); + GLuint attr; + + z = CLAMP(z, 0.0f, 1.0f); + + /* positions (in clip coords) */ + { + const struct gl_framebuffer *fb = st->ctx->DrawBuffer; + const GLfloat fb_width = (GLfloat)fb->Width; + const GLfloat fb_height = (GLfloat)fb->Height; + + const GLfloat clip_x0 = (GLfloat)(x0 / fb_width * 2.0 - 1.0); + const GLfloat clip_y0 = (GLfloat)(y0 / fb_height * 2.0 - 1.0); + const GLfloat clip_x1 = (GLfloat)(x1 / fb_width * 2.0 - 1.0); + const GLfloat clip_y1 = (GLfloat)(y1 / fb_height * 2.0 - 1.0); + + SET_ATTRIB(0, 0, clip_x0, clip_y0, z, 1.0f); /* lower left */ + SET_ATTRIB(1, 0, clip_x1, clip_y0, z, 1.0f); /* lower right */ + SET_ATTRIB(2, 0, clip_x1, clip_y1, z, 1.0f); /* upper right */ + SET_ATTRIB(3, 0, clip_x0, clip_y1, z, 1.0f); /* upper left */ + + semantic_names[0] = TGSI_SEMANTIC_POSITION; + semantic_indexes[0] = 0; + } + + /* colors */ + if (emitColor) { + const GLfloat *c = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; + SET_ATTRIB(0, 1, c[0], c[1], c[2], c[3]); + SET_ATTRIB(1, 1, c[0], c[1], c[2], c[3]); + SET_ATTRIB(2, 1, c[0], c[1], c[2], c[3]); + SET_ATTRIB(3, 1, c[0], c[1], c[2], c[3]); + semantic_names[1] = TGSI_SEMANTIC_COLOR; + semantic_indexes[1] = 0; + attr = 2; + } + else { + attr = 1; + } + + /* texcoords */ + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + if (ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_2D_BIT) { + struct gl_texture_object *obj = ctx->Texture.Unit[i]._Current; + struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; + const GLfloat wt = (GLfloat) img->Width; + const GLfloat ht = (GLfloat) img->Height; + const GLfloat s0 = obj->CropRect[0] / wt; + const GLfloat t0 = obj->CropRect[1] / ht; + const GLfloat s1 = (obj->CropRect[0] + obj->CropRect[2]) / wt; + const GLfloat t1 = (obj->CropRect[1] + obj->CropRect[3]) / ht; + + /*printf("crop texcoords: %g, %g .. %g, %g\n", s0, t0, s1, t1);*/ + SET_ATTRIB(0, attr, s0, t0, 0.0f, 1.0f); /* lower left */ + SET_ATTRIB(1, attr, s1, t0, 0.0f, 1.0f); /* lower right */ + SET_ATTRIB(2, attr, s1, t1, 0.0f, 1.0f); /* upper right */ + SET_ATTRIB(3, attr, s0, t1, 0.0f, 1.0f); /* upper left */ + + semantic_names[attr] = TGSI_SEMANTIC_GENERIC; + semantic_indexes[attr] = 0; + + attr++; + } + } + + pipe_buffer_unmap(pipe->screen, vbuffer); + +#undef SET_ATTRIB + } + + + cso_save_viewport(cso); + cso_save_vertex_shader(cso); + + { + void *vs = lookup_shader(pipe, numAttribs, + semantic_names, semantic_indexes); + cso_set_vertex_shader_handle(cso, vs); + } + + /* viewport state: viewport matching window dims */ + { + const struct gl_framebuffer *fb = st->ctx->DrawBuffer; + const GLboolean invert = (st_fb_orientation(fb) == Y_0_TOP); + const GLfloat width = (GLfloat)fb->Width; + const GLfloat height = (GLfloat)fb->Height; + struct pipe_viewport_state vp; + vp.scale[0] = 0.5f * width; + vp.scale[1] = height * (invert ? -0.5f : 0.5f); + vp.scale[2] = 1.0f; + vp.scale[3] = 1.0f; + vp.translate[0] = 0.5f * width; + vp.translate[1] = 0.5f * height; + vp.translate[2] = 0.0f; + vp.translate[3] = 0.0f; + cso_set_viewport(cso, &vp); + } + + + util_draw_vertex_buffer(pipe, vbuffer, + 0, /* offset */ + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + numAttribs); /* attribs/vert */ + + + pipe_buffer_reference(&vbuffer, NULL); + + /* restore state */ + cso_restore_viewport(cso); + cso_restore_vertex_shader(cso); +} + + +#endif /* FEATURE_OES_draw_texture */ + + +void +st_init_drawtex_functions(struct dd_function_table *functions) +{ + _MESA_INIT_DRAWTEX_FUNCTIONS(functions, st_); +} + + +/** + * Free any cached shaders + */ +void +st_destroy_drawtex(struct st_context *st) +{ + GLuint i; + for (i = 0; i < NumCachedShaders; i++) { + cso_delete_vertex_shader(st->cso_context, CachedShaders[i].handle); + } + NumCachedShaders = 0; +} diff --git a/src/mesa/es/state_tracker/st_cb_drawtex.h b/src/mesa/es/state_tracker/st_cb_drawtex.h new file mode 100644 index 0000000000..7b0da70279 --- /dev/null +++ b/src/mesa/es/state_tracker/st_cb_drawtex.h @@ -0,0 +1,18 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + **************************************************************************/ + + +#ifndef ST_CB_DRAWTEX_H +#define ST_CB_DRAWTEX_H + +extern void +st_init_drawtex_functions(struct dd_function_table *functions); + +extern void +st_destroy_drawtex(struct st_context *st); + +#endif /* ST_CB_DRAWTEX_H */ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 99f2cad402..0488a693b2 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1046,6 +1046,16 @@ struct dd_function_table { GLbitfield, GLuint64); /*@}*/ #endif + +#if FEATURE_OES_draw_texture + /** + * \name GL_OES_draw_texture interface + */ + /*@{*/ + void (*DrawTex)(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, + GLfloat width, GLfloat height); + /*@}*/ +#endif }; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 54cf37c5f4..7a8184ffc8 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -185,6 +185,9 @@ static const struct { { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) }, { ON, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { OFF, "GL_S3_s3tc", F(S3_s3tc) }, +#if FEATURE_OES_draw_texture + { OFF, "GL_OES_draw_texture", F(OES_draw_texture) }, +#endif /* FEATURE_OES_draw_texture */ }; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 94d29a7dbb..e91c7e5ac1 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2485,6 +2485,9 @@ struct gl_extensions GLboolean SGIS_texture_lod; GLboolean TDFX_texture_compression_FXT1; GLboolean S3_s3tc; +#if FEATURE_OES_draw_texture + GLboolean OES_draw_texture; +#endif /* FEATURE_OES_draw_texture */ /** The extension string */ const GLubyte *String; }; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index f0eddafd33..e82598c8e7 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -47,7 +47,7 @@ #include "st_cb_drawpixels.h" #include "st_cb_rasterpos.h" #endif -#ifdef FEATURE_OES_draw_texture +#if FEATURE_OES_draw_texture #include "st_cb_drawtex.h" #endif #include "st_cb_fbo.h" @@ -209,7 +209,7 @@ static void st_destroy_context_priv( struct st_context *st ) st_destroy_bitmap(st); st_destroy_drawpix(st); #endif -#ifdef FEATURE_OES_draw_texture +#if FEATURE_OES_draw_texture st_destroy_drawtex(st); #endif @@ -330,6 +330,11 @@ void st_init_driver_functions(struct dd_function_table *functions) st_init_drawpixels_functions(functions); st_init_rasterpos_functions(functions); #endif + +#if FEATURE_OES_draw_texture + st_init_drawtex_functions(functions); +#endif + st_init_fbo_functions(functions); st_init_get_functions(functions); #if FEATURE_feedback diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 3f835d38dd..ce3c302e48 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -183,6 +183,10 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.NV_texgen_reflection = GL_TRUE; ctx->Extensions.NV_texture_env_combine4 = GL_TRUE; +#if FEATURE_OES_draw_texture + ctx->Extensions.OES_draw_texture = GL_TRUE; +#endif + ctx->Extensions.SGI_color_matrix = GL_TRUE; ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; -- cgit v1.2.3 From 7fb41df2cbae4cf35d0f73c2261a9409a1367903 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 30 Oct 2009 14:09:09 +0800 Subject: mesa/main: linear_to_nonlinear is not always available. Signed-off-by: Chia-I Wu --- src/mesa/main/texgetimage.c | 62 +++++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 24 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 2f88718933..4b0915b3b2 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -42,30 +42,6 @@ -#if FEATURE_EXT_texture_sRGB - -/** - * Convert a float value from linear space to a - * non-linear sRGB value in [0, 255]. - * Not terribly efficient. - */ -static INLINE GLfloat -linear_to_nonlinear(GLfloat cl) -{ - /* can't have values outside [0, 1] */ - GLfloat cs; - if (cl < 0.0031308f) { - cs = 12.92f * cl; - } - else { - cs = (GLfloat)(1.055 * _mesa_pow(cl, 0.41666) - 0.055); - } - return cs; -} - -#endif /* FEATURE_EXT_texture_sRGB */ - - /** * Can the given type represent negative values? */ @@ -233,6 +209,29 @@ get_tex_ycbcr(GLcontext *ctx, GLuint dimensions, } +#if FEATURE_EXT_texture_sRGB + + +/** + * Convert a float value from linear space to a + * non-linear sRGB value in [0, 255]. + * Not terribly efficient. + */ +static INLINE GLfloat +linear_to_nonlinear(GLfloat cl) +{ + /* can't have values outside [0, 1] */ + GLfloat cs; + if (cl < 0.0031308f) { + cs = 12.92f * cl; + } + else { + cs = (GLfloat)(1.055 * _mesa_pow(cl, 0.41666) - 0.055); + } + return cs; +} + + /** * glGetTexImagefor sRGB pixels; */ @@ -284,6 +283,21 @@ get_tex_srgb(GLcontext *ctx, GLuint dimensions, } +#else /* FEATURE_EXT_texture_sRGB */ + + +static INLINE void +get_tex_srgb(GLcontext *ctx, GLuint dimensions, + GLenum format, GLenum type, GLvoid *pixels, + const struct gl_texture_image *texImage) +{ + ASSERT_NO_FEATURE(); +} + + +#endif /* FEATURE_EXT_texture_sRGB */ + + /** * glGetTexImagefor RGBA, Luminance, etc. pixels. * This is the slow way since we use texture sampling. -- cgit v1.2.3