summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/es/main/APIspec.txt8
-rw-r--r--src/mesa/es/main/drawtex.c144
-rw-r--r--src/mesa/es/main/drawtex.h79
-rw-r--r--src/mesa/es/sources.mak17
-rw-r--r--src/mesa/main/dd.h10
-rw-r--r--src/mesa/main/extensions.c3
-rw-r--r--src/mesa/main/mtypes.h3
7 files changed, 253 insertions, 11 deletions
diff --git a/src/mesa/es/main/APIspec.txt b/src/mesa/es/main/APIspec.txt
index 07a529d6e9..f102e7083c 100644
--- a/src/mesa/es/main/APIspec.txt
+++ b/src/mesa/es/main/APIspec.txt
@@ -2891,8 +2891,6 @@ param y GLint
param z GLint
param w GLint
param h GLint
-convertalias DrawTexf
-convertparams GLfloat x y z w h
category GLES1.1:OES_draw_texture
name DrawTexs
@@ -2902,8 +2900,6 @@ param y GLshort
param z GLshort
param w GLshort
param h GLshort
-convertalias DrawTexf
-convertparams GLfloat x y z w h
category GLES1.1:OES_draw_texture
name DrawTexx
@@ -2927,16 +2923,12 @@ name DrawTexiv
return void
param coords const GLint *
vector coords 5
-convertalias DrawTexfv
-convertparams GLfloat coords
category GLES1.1:OES_draw_texture
name DrawTexsv
return void
param coords const GLshort *
vector coords 5
-convertalias DrawTexfv
-convertparams GLfloat coords
category GLES1.1:OES_draw_texture
name DrawTexxv
diff --git a/src/mesa/es/main/drawtex.c b/src/mesa/es/main/drawtex.c
new file mode 100644
index 0000000000..af055d07d2
--- /dev/null
+++ b/src/mesa/es/main/drawtex.c
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
+ *
+ * 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 INLINE void
+draw_texture(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
+ GLfloat width, GLfloat height)
+{
+ 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);
+
+ if (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]);
+}
+
+
+/* it is static because GLfixed is not defined publicly */
+static 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);
+}
+
+
+static 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..04c5bdd123
--- /dev/null
+++ b/src/mesa/es/main/drawtex.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
+ *
+ * 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);
+
+#if 0
+extern void GLAPIENTRY
+_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
+
+extern void GLAPIENTRY
+_mesa_DrawTexxv(const GLfixed *coords);
+#endif
+
+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/sources.mak b/src/mesa/es/sources.mak
index aef0650c21..6dedb726bd 100644
--- a/src/mesa/es/sources.mak
+++ b/src/mesa/es/sources.mak
@@ -2,6 +2,7 @@
ES1_LOCAL_SOURCES := \
main/api_exec_es1.c \
+ main/drawtex.c \
main/get_es1.c \
main/specials_es1.c \
main/es_cpaltex.c \
@@ -21,9 +22,19 @@ ES1_LOCAL_INCLUDES := \
-I./state_tracker \
-I$(MESA)/state_tracker
-ES2_LOCAL_SOURCES := $(subst es1,es2,$(ES1_LOCAL_SOURCES))
-ES2_GALLIUM_LOCAL_SOURCES := $(subst es1,es2,$(ES1_GALLIUM_LOCAL_SOURCES))
-ES2_API_LOCAL_SOURCES := $(subst es1,es2,$(ES1_API_LOCAL_SOURCES))
+ES2_LOCAL_SOURCES := \
+ main/api_exec_es2.c \
+ main/get_es2.c \
+ main/specials_es2.c \
+ main/es_cpaltex.c \
+ main/es_fbo.c \
+ main/stubs.c
+
+ES2_GALLIUM_LOCAL_SOURCES := \
+ $(ES2_LOCAL_SOURCES)
+
+ES2_API_LOCAL_SOURCES :=
+
ES2_LOCAL_INCLUDES := $(subst es1,es2,$(ES1_LOCAL_INCLUDES))
# MESA sources
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index ce5e158626..afcab5bf2b 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1060,6 +1060,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 cfc87e6fe6..7e289743ce 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -183,6 +183,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 ae169fb9db..bebb3e56a6 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2599,6 +2599,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;
};