diff options
author | Chia-I Wu <[email protected]> | 2009-09-22 15:00:24 +0800 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-11-05 20:04:20 -0700 |
commit | 34064756a5e2c8952c9de26eaebafddabd562540 (patch) | |
tree | afb8aa9358db033b672db8b69f7dabbb4ec800a1 /src/mesa/es/main | |
parent | bfa66bd6f941920cf32ce79fb103c3755b4dd8fb (diff) |
mesa/es: Add support for GL_OES_draw_texture.
Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src/mesa/es/main')
-rw-r--r-- | src/mesa/es/main/APIspec.txt | 77 | ||||
-rw-r--r-- | src/mesa/es/main/drawtex.c | 148 | ||||
-rw-r--r-- | src/mesa/es/main/drawtex.h | 77 | ||||
-rw-r--r-- | src/mesa/es/main/mfeatures_es1.h | 1 | ||||
-rw-r--r-- | src/mesa/es/main/mfeatures_es2.h | 1 | ||||
-rw-r--r-- | src/mesa/es/main/specials_es1.c | 5 |
6 files changed, 309 insertions, 0 deletions
diff --git a/src/mesa/es/main/APIspec.txt b/src/mesa/es/main/APIspec.txt index 86dd546f634..6d18ae67d9f 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 00000000000..cbd41ca9759 --- /dev/null +++ b/src/mesa/es/main/drawtex.c @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2009 Chia-I Wu <[email protected]> + * + * 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 00000000000..0f3bac38c77 --- /dev/null +++ b/src/mesa/es/main/drawtex.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2009 Chia-I Wu <[email protected]> + * + * 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 9c655960893..6c2ece26080 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 6ed7b678dcd..f34782fedb9 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 84d339ebf67..548fb0f0297 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) |