diff options
author | marha <marha@users.sourceforge.net> | 2012-08-21 07:55:46 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-08-21 07:55:46 +0200 |
commit | 1bf52245e51f23656a3520056b440a633ea5a61b (patch) | |
tree | 4e175b2e2a4a843e101d582ba996eaef336f90fc /mesalib/src/mesa | |
parent | 0f140f539691e1657d8ea0fcbcca2d5947574406 (diff) | |
parent | 7cd970786d72a68b735f33904bdded6c8aebdf33 (diff) | |
download | vcxsrv-1bf52245e51f23656a3520056b440a633ea5a61b.tar.gz vcxsrv-1bf52245e51f23656a3520056b440a633ea5a61b.tar.bz2 vcxsrv-1bf52245e51f23656a3520056b440a633ea5a61b.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r-- | mesalib/src/mesa/SConscript | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/APIspec.xml | 381 | ||||
-rw-r--r-- | mesalib/src/mesa/main/es1_conversion.c | 1368 | ||||
-rw-r--r-- | mesalib/src/mesa/main/es1_conversion.h | 157 | ||||
-rw-r--r-- | mesalib/src/mesa/main/es_generator.py | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texgetimage.c | 45 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texparam.c | 240 | ||||
-rw-r--r-- | mesalib/src/mesa/sources.mak | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_texture.c | 11 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_context.c | 5 |
11 files changed, 1795 insertions, 428 deletions
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript index a3cbc16de..1b98b04c1 100644 --- a/mesalib/src/mesa/SConscript +++ b/mesalib/src/mesa/SConscript @@ -338,7 +338,7 @@ if env['gles']: env.Append(CPPDEFINES = ['FEATURE_ES1=1', 'FEATURE_ES2=1']) # generate GLES sources - gles_sources = [] + gles_sources = ['main/es1_conversion.c',] gles_sources += env.CodeGenerate( target = 'main/api_exec_es1.c', script = 'main/es_generator.py', diff --git a/mesalib/src/mesa/main/APIspec.xml b/mesalib/src/mesa/main/APIspec.xml index b6cf52d07..c26caf6ad 100644 --- a/mesalib/src/mesa/main/APIspec.xml +++ b/mesalib/src/mesa/main/APIspec.xml @@ -48,12 +48,6 @@ <return type="void"/> <param name="mode" type="GLenum"/> </proto> - - <desc name="mode"> - <value name="GL_FRONT"/> - <value name="GL_BACK"/> - <value name="GL_FRONT_AND_BACK"/> - </desc> </template> <template name="Fog"> @@ -94,11 +88,6 @@ <return type="void"/> <param name="mode" type="GLenum"/> </proto> - - <desc name="mode"> - <value name="GL_CW"/> - <value name="GL_CCW"/> - </desc> </template> <template name="Hint"> @@ -120,12 +109,6 @@ <desc name="target"> <value name="GL_GENERATE_MIPMAP_HINT"/> </desc> - - <desc name="mode"> - <value name="GL_FASTEST"/> - <value name="GL_NICEST"/> - <value name="GL_DONT_CARE"/> - </desc> </template> <template name="Light"> @@ -137,35 +120,6 @@ <param name="param" type="GLtype"/> </vector> </proto> - - <desc name="light"> - <range base="GL_LIGHT" from="0" to="7"/> - </desc> - - <desc name="pname"> - <value name="GL_AMBIENT"/> - <value name="GL_DIFFUSE"/> - <value name="GL_SPECULAR"/> - <value name="GL_POSITION"/> - - <desc name="params" vector_size="4"/> - </desc> - - <desc name="pname"> - <value name="GL_SPOT_DIRECTION"/> - - <desc name="params" vector_size="3"/> - </desc> - - <desc name="pname"> - <value name="GL_SPOT_EXPONENT"/> - <value name="GL_SPOT_CUTOFF"/> - <value name="GL_CONSTANT_ATTENUATION"/> - <value name="GL_LINEAR_ATTENUATION"/> - <value name="GL_QUADRATIC_ATTENUATION"/> - - <desc name="params" vector_size="1"/> - </desc> </template> <template name="LightModel"> @@ -244,11 +198,6 @@ <param name="stride" type="GLsizei"/> <param name="pointer" type="const GLvoid *"/> </proto> - - <desc name="type"> - <value name="GL_FLOAT"/> - <value name="GL_FIXED"/> - </desc> </template> <template name="Scissor"> @@ -266,11 +215,6 @@ <return type="void"/> <param name="mode" type="GLenum"/> </proto> - - <desc name="mode"> - <value name="GL_FLAT"/> - <value name="GL_SMOOTH"/> - </desc> </template> <template name="TexParameter"> @@ -304,27 +248,11 @@ </desc> </desc> - <desc name="pname"> - <value name="GL_TEXTURE_MIN_FILTER"/> - - <desc name="param"> - <value name="GL_NEAREST"/> - <value name="GL_LINEAR"/> - <value name="GL_NEAREST_MIPMAP_NEAREST"/> - <value name="GL_NEAREST_MIPMAP_LINEAR"/> - <value name="GL_LINEAR_MIPMAP_NEAREST"/> - <value name="GL_LINEAR_MIPMAP_LINEAR"/> - </desc> - </desc> - - <desc name="pname"> - <value name="GL_TEXTURE_MAG_FILTER"/> - - <desc name="param"> - <value name="GL_NEAREST"/> - <value name="GL_LINEAR"/> - </desc> - </desc> + <desc name="pname"> + <value name="GL_TEXTURE_MIN_FILTER"/> + <value name="GL_TEXTURE_MAG_FILTER"/> + <value name="GL_TEXTURE_MAX_ANISOTROPY_EXT" category="EXT_texture_filter_anisotropic"/> + </desc> <desc name="pname" category="GLES1.1"> <value name="GL_GENERATE_MIPMAP"/> @@ -335,11 +263,6 @@ </desc> </desc> - <desc name="pname" category="EXT_texture_filter_anisotropic"> - <value name="GL_TEXTURE_MAX_ANISOTROPY_EXT"/> - <desc name="params" vector_size="1"/> - </desc> - <desc name="pname" category="OES_draw_texture"> <value name="GL_TEXTURE_CROP_RECT_OES"/> <desc name="params" vector_size="4"/> @@ -762,12 +685,6 @@ <param name="face" type="GLenum"/> <param name="mask" type="GLuint"/> </proto> - - <desc name="face"> - <value name="GL_FRONT"/> - <value name="GL_BACK"/> - <value name="GL_FRONT_AND_BACK"/> - </desc> </template> <template name="ColorMask"> @@ -920,16 +837,6 @@ <param name="func" type="GLenum"/> <param name="ref" type="GLtype"/> </proto> - <desc name="func"> - <value name="GL_NEVER"/> - <value name="GL_LESS"/> - <value name="GL_EQUAL"/> - <value name="GL_LEQUAL"/> - <value name="GL_GREATER"/> - <value name="GL_NOTEQUAL"/> - <value name="GL_GEQUAL"/> - <value name="GL_ALWAYS"/> - </desc> </template> <template name="BlendFunc"> @@ -982,25 +889,6 @@ <return type="void"/> <param name="opcode" type="GLenum"/> </proto> - - <desc name="opcode"> - <value name="GL_CLEAR"/> - <value name="GL_SET"/> - <value name="GL_COPY"/> - <value name="GL_COPY_INVERTED"/> - <value name="GL_NOOP"/> - <value name="GL_INVERT"/> - <value name="GL_AND"/> - <value name="GL_NAND"/> - <value name="GL_OR"/> - <value name="GL_NOR"/> - <value name="GL_XOR"/> - <value name="GL_EQUIV"/> - <value name="GL_AND_REVERSE"/> - <value name="GL_AND_INVERTED"/> - <value name="GL_OR_REVERSE"/> - <value name="GL_OR_INVERTED"/> - </desc> </template> <template name="StencilFunc"> @@ -1010,17 +898,6 @@ <param name="ref" type="GLint"/> <param name="mask" type="GLuint"/> </proto> - - <desc name="func"> - <value name="GL_NEVER"/> - <value name="GL_LESS"/> - <value name="GL_LEQUAL"/> - <value name="GL_GREATER"/> - <value name="GL_GEQUAL"/> - <value name="GL_EQUAL"/> - <value name="GL_NOTEQUAL"/> - <value name="GL_ALWAYS"/> - </desc> </template> <template name="StencilFuncSeparate"> @@ -1031,23 +908,6 @@ <param name="ref" type="GLint"/> <param name="mask" type="GLuint"/> </proto> - - <desc name="face"> - <value name="GL_FRONT"/> - <value name="GL_BACK"/> - <value name="GL_FRONT_AND_BACK"/> - </desc> - - <desc name="func"> - <value name="GL_NEVER"/> - <value name="GL_LESS"/> - <value name="GL_LEQUAL"/> - <value name="GL_GREATER"/> - <value name="GL_GEQUAL"/> - <value name="GL_EQUAL"/> - <value name="GL_NOTEQUAL"/> - <value name="GL_ALWAYS"/> - </desc> </template> <template name="StencilOp"> @@ -1057,45 +917,6 @@ <param name="zfail" type="GLenum"/> <param name="zpass" type="GLenum"/> </proto> - - <desc name="fail"> - <value name="GL_KEEP"/> - <value name="GL_ZERO"/> - <value name="GL_REPLACE"/> - <value name="GL_INCR"/> - <value name="GL_DECR"/> - <value name="GL_INVERT"/> - <value name="GL_INCR_WRAP" category="GLES2.0"/> - <value name="GL_DECR_WRAP" category="GLES2.0"/> - <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/> - <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/> - </desc> - - <desc name="zfail"> - <value name="GL_KEEP"/> - <value name="GL_ZERO"/> - <value name="GL_REPLACE"/> - <value name="GL_INCR"/> - <value name="GL_DECR"/> - <value name="GL_INVERT"/> - <value name="GL_INCR_WRAP" category="GLES2.0"/> - <value name="GL_DECR_WRAP" category="GLES2.0"/> - <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/> - <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/> - </desc> - - <desc name="zpass"> - <value name="GL_KEEP"/> - <value name="GL_ZERO"/> - <value name="GL_REPLACE"/> - <value name="GL_INCR"/> - <value name="GL_DECR"/> - <value name="GL_INVERT"/> - <value name="GL_INCR_WRAP" category="GLES2.0"/> - <value name="GL_DECR_WRAP" category="GLES2.0"/> - <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/> - <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/> - </desc> </template> <template name="StencilOpSeparate"> @@ -1106,45 +927,6 @@ <param name="zfail" type="GLenum"/> <param name="zpass" type="GLenum"/> </proto> - - <desc name="face"> - <value name="GL_FRONT"/> - <value name="GL_BACK"/> - <value name="GL_FRONT_AND_BACK"/> - </desc> - - <desc name="fail"> - <value name="GL_KEEP"/> - <value name="GL_ZERO"/> - <value name="GL_REPLACE"/> - <value name="GL_INCR"/> - <value name="GL_DECR"/> - <value name="GL_INVERT"/> - <value name="GL_INCR_WRAP"/> - <value name="GL_DECR_WRAP"/> - </desc> - - <desc name="zfail"> - <value name="GL_KEEP"/> - <value name="GL_ZERO"/> - <value name="GL_REPLACE"/> - <value name="GL_INCR"/> - <value name="GL_DECR"/> - <value name="GL_INVERT"/> - <value name="GL_INCR_WRAP"/> - <value name="GL_DECR_WRAP"/> - </desc> - - <desc name="zpass"> - <value name="GL_KEEP"/> - <value name="GL_ZERO"/> - <value name="GL_REPLACE"/> - <value name="GL_INCR"/> - <value name="GL_DECR"/> - <value name="GL_INVERT"/> - <value name="GL_INCR_WRAP"/> - <value name="GL_DECR_WRAP"/> - </desc> </template> <template name="DepthFunc"> @@ -1152,17 +934,6 @@ <return type="void"/> <param name="func" type="GLenum"/> </proto> - - <desc name="func"> - <value name="GL_NEVER"/> - <value name="GL_LESS"/> - <value name="GL_EQUAL"/> - <value name="GL_LEQUAL"/> - <value name="GL_GREATER"/> - <value name="GL_NOTEQUAL"/> - <value name="GL_GEQUAL"/> - <value name="GL_ALWAYS"/> - </desc> </template> <template name="PixelStore"> @@ -1297,35 +1068,6 @@ <param name="pname" type="GLenum"/> <vector name="params" type="GLtype *" size="dynamic"/> </proto> - - <desc name="light"> - <range base="GL_LIGHT" from="0" to="7"/> - </desc> - - <desc name="pname"> - <value name="GL_AMBIENT"/> - <value name="GL_DIFFUSE"/> - <value name="GL_SPECULAR"/> - <value name="GL_POSITION"/> - - <desc name="params" vector_size="4"/> - </desc> - - <desc name="pname"> - <value name="GL_SPOT_DIRECTION"/> - - <desc name="params" vector_size="3"/> - </desc> - - <desc name="pname"> - <value name="GL_SPOT_EXPONENT"/> - <value name="GL_SPOT_CUTOFF"/> - <value name="GL_CONSTANT_ATTENUATION"/> - <value name="GL_LINEAR_ATTENUATION"/> - <value name="GL_QUADRATIC_ATTENUATION"/> - - <desc name="params" vector_size="1"/> - </desc> </template> <template name="GetMaterial" direction="get"> @@ -1770,12 +1512,6 @@ <value name="GL_TRIANGLE_STRIP"/> <value name="GL_TRIANGLE_FAN"/> </desc> - - <desc name="type"> - <value name="GL_UNSIGNED_BYTE"/> - <value name="GL_UNSIGNED_SHORT"/> - <value name="GL_UNSIGNED_INT" category="OES_element_index_uint"/> - </desc> </template> <template name="EnableClientState"> @@ -2133,18 +1869,6 @@ <return type="void"/> <param name="mode" type="GLenum"/> </proto> - - <desc name="mode"> - <value name="GL_FUNC_ADD" category="GLES2.0"/> - <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/> - <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/> - <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/> - <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/> - <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/> - - <value name="GL_MIN_EXT" category="EXT_blend_minmax"/> - <value name="GL_MAX_EXT" category="EXT_blend_minmax"/> - </desc> </template> <template name="BlendEquationSeparate"> @@ -2153,30 +1877,6 @@ <param name="modeRGB" type="GLenum"/> <param name="modeAlpha" type="GLenum"/> </proto> - - <desc name="modeRGB"> - <value name="GL_FUNC_ADD" category="GLES2.0"/> - <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/> - <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/> - <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/> - <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/> - <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/> - - <value name="GL_MIN_EXT" category="EXT_blend_minmax"/> - <value name="GL_MAX_EXT" category="EXT_blend_minmax"/> - </desc> - - <desc name="modeAlpha"> - <value name="GL_FUNC_ADD" category="GLES2.0"/> - <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/> - <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/> - <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/> - <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/> - <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/> - - <value name="GL_MIN_EXT" category="EXT_blend_minmax"/> - <value name="GL_MAX_EXT" category="EXT_blend_minmax"/> - </desc> </template> <template name="TexImage3D"> @@ -2366,10 +2066,6 @@ <param name="q" type="GLtype"/> </vector> </proto> - - <desc name="texture"> - <range base="GL_TEXTURE" from="0" to="31"/> - </desc> </template> <template name="CompressedTexImage3D"> @@ -2389,14 +2085,6 @@ <desc name="target"> <value name="GL_TEXTURE_3D_OES"/> </desc> - - <desc name="internalFormat"> - <value name="GL_3DC_X_AMD" category="AMD_compressed_3DC_texture"/> - <value name="GL_3DC_XY_AMD" category="AMD_compressed_3DC_texture"/> - <value name="GL_ATC_RGB_AMD" category="AMD_compressed_ATC_texture"/> - <value name="GL_ATC_RGBA_EXPLICIT_ALPHA_AMD" category="AMD_compressed_ATC_texture"/> - <value name="GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD" category="AMD_compressed_ATC_texture"/> - </desc> </template> <template name="CompressedTexSubImage3D"> @@ -2425,10 +2113,6 @@ <return type="void"/> <param name="texture" type="GLenum"/> </proto> - - <desc name="texture"> - <range base="GL_TEXTURE" from="0" to="31"/> - </desc> </template> <template name="ClientActiveTexture"> @@ -2436,10 +2120,6 @@ <return type="void"/> <param name="texture" type="GLenum"/> </proto> - - <desc name="texture"> - <range base="GL_TEXTURE" from="0" to="31"/> - </desc> </template> <template name="SampleCoverage"> @@ -2493,20 +2173,9 @@ <value name="GL_PALETTE8_RGBA4_OES" category="OES_compressed_paletted_texture"/> <value name="GL_PALETTE8_RGB5_A1_OES" category="OES_compressed_paletted_texture"/> - <value name="GL_3DC_X_AMD" category="AMD_compressed_3DC_texture"/> - <value name="GL_3DC_XY_AMD" category="AMD_compressed_3DC_texture"/> - - <value name="GL_ATC_RGB_AMD" category="AMD_compressed_ATC_texture"/> - <value name="GL_ATC_RGBA_EXPLICIT_ALPHA_AMD" category="AMD_compressed_ATC_texture"/> - <value name="GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD" category="AMD_compressed_ATC_texture"/> - <value name="GL_COMPRESSED_RGB_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/> <value name="GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/> </desc> - - <desc name="border" error="GL_INVALID_VALUE"> - <value name="0"/> - </desc> </template> <template name="CompressedTexSubImage2D"> @@ -2783,10 +2452,6 @@ <param name="pname" type="GLenum"/> <vector name="pointer" type="GLvoid **" size="dynamic"/> </proto> - - <desc name="pname"> - <value name="GL_VERTEX_ATTRIB_ARRAY_POINTER"/> - </desc> </template> <template name="GetBufferPointer" direction="get"> @@ -2801,10 +2466,6 @@ <value name="GL_ARRAY_BUFFER"/> <value name="GL_ELEMENT_ARRAY_BUFFER"/> </desc> - - <desc name="pname"> - <value name="GL_BUFFER_MAP_POINTER_OES"/> - </desc> </template> <template name="MapBuffer" direction="get"> @@ -3251,10 +2912,6 @@ <param name="level" type="GLint"/> <param name="zoffset" type="GLint"/> </proto> - - <desc name="textarget" error="GL_INVALID_OPERATION"> - <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/> - </desc> </template> <template name="CheckFramebufferStatus" direction="get"> @@ -3354,14 +3011,6 @@ <param name="pname" type="GLenum"/> <vector name="params" type="GLtype *" size="dynamic"/> </proto> - - <desc name="pname"> - <value name="GL_SHADER_TYPE"/> - <value name="GL_COMPILE_STATUS"/> - <value name="GL_DELETE_STATUS"/> - <value name="GL_INFO_LOG_LENGTH"/> - <value name="GL_SHADER_SOURCE_LENGTH"/> - </desc> </template> <template name="GetAttachedShaders" direction="get"> @@ -3412,20 +3061,6 @@ <param name="range" type="GLint *"/> <param name="precision" type="GLint *"/> </proto> - - <desc name="shadertype"> - <value name="GL_VERTEX_SHADER"/> - <value name="GL_FRAGMENT_SHADER"/> - </desc> - - <desc name="precisiontype"> - <value name="GL_LOW_FLOAT"/> - <value name="GL_MEDIUM_FLOAT"/> - <value name="GL_HIGH_FLOAT"/> - <value name="GL_LOW_INT"/> - <value name="GL_MEDIUM_INT"/> - <value name="GL_HIGH_INT"/> - </desc> </template> <template name="GetUniform" direction="get"> @@ -3497,12 +3132,6 @@ <value name="GL_TRIANGLE_STRIP"/> <value name="GL_TRIANGLE_FAN"/> </desc> - - <desc name="type"> - <value name="GL_UNSIGNED_BYTE"/> - <value name="GL_UNSIGNED_SHORT"/> - <value name="GL_UNSIGNED_INT" category="OES_element_index_uint"/> - </desc> </template> <template name="EGLImageTargetTexture2D"> diff --git a/mesalib/src/mesa/main/es1_conversion.c b/mesalib/src/mesa/main/es1_conversion.c new file mode 100644 index 000000000..ebd1e889f --- /dev/null +++ b/mesalib/src/mesa/main/es1_conversion.c @@ -0,0 +1,1368 @@ +#include <stdbool.h> +#include "main/mfeatures.h" + +#if FEATURE_ES1 + +#include "api_loopback.h" +#include "api_exec.h" +#include "blend.h" +#include "clear.h" +#include "clip.h" +#include "context.h" +#include "depth.h" +#include "fog.h" +#include "imports.h" +#include "light.h" +#include "lines.h" +#include "matrix.h" +#include "multisample.h" +#include "pixelstore.h" +#include "points.h" +#include "polygon.h" +#include "readpix.h" +#include "texenv.h" +#include "texgen.h" +#include "texobj.h" +#include "texparam.h" +#include "mtypes.h" +#include "viewport.h" +#include "main/drawtex.h" +#include "vbo/vbo.h" + +#ifndef GL_APIENTRY +#define GL_APIENTRY GLAPIENTRY +#endif + +#include "main/es1_conversion.h" + +void GL_APIENTRY +_es_AlphaFuncx(GLenum func, GLclampx ref) +{ + _mesa_AlphaFunc(func, (GLclampf) (ref / 65536.0f)); +} + +void GL_APIENTRY +_es_ClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) +{ + _mesa_ClearColor((GLclampf) (red / 65536.0f), + (GLclampf) (green / 65536.0f), + (GLclampf) (blue / 65536.0f), + (GLclampf) (alpha / 65536.0f)); +} + +void GL_APIENTRY +_es_ClearDepthx(GLclampx depth) +{ + _mesa_ClearDepthf((GLclampf) (depth / 65536.0f)); +} + +void GL_APIENTRY +_es_ClipPlanef(GLenum plane, const GLfloat *equation) +{ + unsigned int i; + GLdouble converted_equation[4]; + + for (i = 0; i < Elements(converted_equation); i++) { + converted_equation[i] = (GLdouble) (equation[i]); + } + + _mesa_ClipPlane(plane, converted_equation); +} + +void GL_APIENTRY +_es_ClipPlanex(GLenum plane, const GLfixed *equation) +{ + unsigned int i; + GLdouble converted_equation[4]; + + for (i = 0; i < Elements(converted_equation); i++) { + converted_equation[i] = (GLdouble) (equation[i] / 65536.0); + } + + _mesa_ClipPlane(plane, converted_equation); +} + +void GL_APIENTRY +_es_Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) +{ + _es_Color4f((GLfloat) (red / 255.0f), + (GLfloat) (green / 255.0f), + (GLfloat) (blue / 255.0f), + (GLfloat) (alpha / 255.0f)); +} + +void GL_APIENTRY +_es_Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) +{ + _es_Color4f((GLfloat) (red / 65536.0f), + (GLfloat) (green / 65536.0f), + (GLfloat) (blue / 65536.0f), + (GLfloat) (alpha / 65536.0f)); +} + +void GL_APIENTRY +_es_DepthRangex(GLclampx zNear, GLclampx zFar) +{ + _mesa_DepthRangef((GLclampf) (zNear / 65536.0f), + (GLclampf) (zFar / 65536.0f)); +} + +void GL_APIENTRY +_es_DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h) +{ + + _mesa_DrawTexf((GLfloat) (x / 65536.0f), + (GLfloat) (y / 65536.0f), + (GLfloat) (z / 65536.0f), + (GLfloat) (w / 65536.0f), + (GLfloat) (h / 65536.0f)); +} + +void GL_APIENTRY +_es_DrawTexxvOES(const GLfixed *coords) +{ + unsigned int i; + GLfloat converted_coords[5]; + + for (i = 0; i < Elements(converted_coords); i++) { + converted_coords[i] = (GLfloat) (coords[i] / 65536.0f); + } + + _mesa_DrawTexfv(converted_coords); +} + +void GL_APIENTRY +_es_Fogx(GLenum pname, GLfixed param) +{ + bool convert_param_value = true; + + switch(pname) { + case GL_FOG_MODE: + if (param != GL_EXP && param != GL_EXP2 && param != GL_LINEAR) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glFogx(pname=0x%x)", pname); + return; + } + convert_param_value = false; + break; + case GL_FOG_DENSITY: + case GL_FOG_START: + case GL_FOG_END: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glFogx(pname=0x%x)", pname); + return; + } + + if (convert_param_value) { + _mesa_Fogf(pname, (GLfloat) (param / 65536.0f)); + } else { + _mesa_Fogf(pname, (GLfloat) param); + } + +} + +void GL_APIENTRY +_es_Fogxv(GLenum pname, const GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 4; + GLfloat converted_params[4]; + bool convert_params_value = true; + + switch(pname) { + case GL_FOG_MODE: + if (params[0] != GL_EXP && params[0] != GL_EXP2 && params[0] != GL_LINEAR) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glFogxv(pname=0x%x)", pname); + return; + } + convert_params_value = false; + n_params = 1; + break; + case GL_FOG_COLOR: + n_params = 4; + break; + case GL_FOG_DENSITY: + case GL_FOG_START: + case GL_FOG_END: + n_params = 1; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glFogxv(pname=0x%x)", pname); + return; + } + + if (convert_params_value) { + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) (params[i] / 65536.0f); + } + } else { + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) params[i]; + } + } + + _mesa_Fogfv(pname, converted_params); +} + +void GL_APIENTRY +_es_Frustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, + GLfloat zNear, GLfloat zFar) +{ + _mesa_Frustum((GLdouble) (left), + (GLdouble) (right), + (GLdouble) (bottom), + (GLdouble) (top), + (GLdouble) (zNear), + (GLdouble) (zFar)); +} + +void GL_APIENTRY +_es_Frustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, + GLfixed zNear, GLfixed zFar) +{ + _mesa_Frustum((GLdouble) (left / 65536.0), + (GLdouble) (right / 65536.0), + (GLdouble) (bottom / 65536.0), + (GLdouble) (top / 65536.0), + (GLdouble) (zNear / 65536.0), + (GLdouble) (zFar / 65536.0)); +} + +void GL_APIENTRY +_es_GetClipPlanef(GLenum plane, GLfloat *equation) +{ + unsigned int i; + GLdouble converted_equation[4]; + + _mesa_GetClipPlane(plane, converted_equation); + for (i = 0; i < Elements(converted_equation); i++) { + equation[i] = (GLfloat) (converted_equation[i]); + } +} + +void GL_APIENTRY +_es_GetClipPlanex(GLenum plane, GLfixed *equation) +{ + unsigned int i; + GLdouble converted_equation[4]; + + _mesa_GetClipPlane(plane, converted_equation); + for (i = 0; i < Elements(converted_equation); i++) { + equation[i] = (GLfixed) (converted_equation[i] * 65536); + } +} + +void GL_APIENTRY +_es_GetLightxv(GLenum light, GLenum pname, GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 4; + GLfloat converted_params[4]; + + if (light < GL_LIGHT0 || light > GL_LIGHT7) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetLightxv(light=0x%x)", light); + return; + } + switch(pname) { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_POSITION: + n_params = 4; + break; + case GL_SPOT_DIRECTION: + n_params = 3; + break; + case GL_SPOT_EXPONENT: + case GL_SPOT_CUTOFF: + case GL_CONSTANT_ATTENUATION: + case GL_LINEAR_ATTENUATION: + case GL_QUADRATIC_ATTENUATION: + n_params = 1; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetLightxv(pname=0x%x)", pname); + return; + } + + _mesa_GetLightfv(light, pname, converted_params); + for (i = 0; i < n_params; i++) { + params[i] = (GLint) (converted_params[i] * 65536); + } +} + +void GL_APIENTRY +_es_GetMaterialxv(GLenum face, GLenum pname, GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 4; + GLfloat converted_params[4]; + + switch(face) { + case GL_FRONT: + case GL_BACK: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetMaterialxv(face=0x%x)", face); + return; + } + switch(pname) { + case GL_SHININESS: + n_params = 1; + break; + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_AMBIENT_AND_DIFFUSE: + case GL_SPECULAR: + case GL_EMISSION: + n_params = 4; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetMaterialxv(pname=0x%x)", pname); + return; + } + + _mesa_GetMaterialfv(face, pname, converted_params); + for (i = 0; i < n_params; i++) { + params[i] = (GLint) (converted_params[i] * 65536); + } +} + +void GL_APIENTRY +_es_GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 4; + GLfloat converted_params[4]; + bool convert_params_value = true; + + switch(target) { + case GL_POINT_SPRITE: + if (pname != GL_COORD_REPLACE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetTexEnvxv(target=0x%x)", target); + return; + } + break; + case GL_TEXTURE_FILTER_CONTROL_EXT: + if (pname != GL_TEXTURE_LOD_BIAS_EXT) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetTexEnvxv(target=0x%x)", target); + return; + } + break; + case GL_TEXTURE_ENV: + if (pname != GL_TEXTURE_ENV_COLOR && pname != GL_RGB_SCALE && pname != GL_ALPHA_SCALE && pname != GL_TEXTURE_ENV_MODE && pname != GL_COMBINE_RGB && pname != GL_COMBINE_ALPHA && pname != GL_SRC0_RGB && pname != GL_SRC1_RGB && pname != GL_SRC2_RGB && pname != GL_SRC0_ALPHA && pname != GL_SRC1_ALPHA && pname != GL_SRC2_ALPHA && pname != GL_OPERAND0_RGB && pname != GL_OPERAND1_RGB && pname != GL_OPERAND2_RGB && pname != GL_OPERAND0_ALPHA && pname != GL_OPERAND1_ALPHA && pname != GL_OPERAND2_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetTexEnvxv(target=0x%x)", target); + return; + } + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetTexEnvxv(target=0x%x)", target); + return; + } + switch(pname) { + case GL_COORD_REPLACE: + convert_params_value = false; + n_params = 1; + break; + case GL_TEXTURE_LOD_BIAS_EXT: + n_params = 1; + break; + case GL_TEXTURE_ENV_COLOR: + n_params = 4; + break; + case GL_RGB_SCALE: + case GL_ALPHA_SCALE: + n_params = 1; + break; + case GL_TEXTURE_ENV_MODE: + case GL_COMBINE_RGB: + case GL_COMBINE_ALPHA: + case GL_SRC0_RGB: + case GL_SRC1_RGB: + case GL_SRC2_RGB: + case GL_SRC0_ALPHA: + case GL_SRC1_ALPHA: + case GL_SRC2_ALPHA: + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + case GL_OPERAND2_RGB: + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + case GL_OPERAND2_ALPHA: + convert_params_value = false; + n_params = 1; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetTexEnvxv(pname=0x%x)", pname); + return; + } + + _mesa_GetTexEnvfv(target, pname, converted_params); + if (convert_params_value) { + for (i = 0; i < n_params; i++) { + params[i] = (GLint) (converted_params[i] * 65536); + } + } else { + for (i = 0; i < n_params; i++) { + params[i] = (GLfixed) converted_params[i]; + } + } +} + +void GL_APIENTRY +_check_GetTexGenivOES(GLenum coord, GLenum pname, GLint *params) +{ + unsigned int i; + unsigned int n_params = 1; + GLfloat converted_params[1]; + + switch(coord) { + case GL_TEXTURE_GEN_STR_OES: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetTexGenivOES(coord=0x%x)", coord); + return; + } + switch(pname) { + case GL_TEXTURE_GEN_MODE: + n_params = 1; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetTexGenivOES(pname=0x%x)", pname); + return; + } + + _es_GetTexGenfv(coord, pname, converted_params); + for (i = 0; i < n_params; i++) { + params[i] = (GLfloat) converted_params[i]; + } +} + +void GL_APIENTRY +_check_GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 1; + GLfloat converted_params[1]; + + switch(coord) { + case GL_TEXTURE_GEN_STR_OES: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetTexGenxvOES(coord=0x%x)", coord); + return; + } + switch(pname) { + case GL_TEXTURE_GEN_MODE: + n_params = 1; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetTexGenxvOES(pname=0x%x)", pname); + return; + } + + _es_GetTexGenfv(coord, pname, converted_params); + for (i = 0; i < n_params; i++) { + params[i] = (GLfloat) converted_params[i]; + } +} + +void GL_APIENTRY +_es_GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 4; + GLfloat converted_params[4]; + bool convert_params_value = true; + + switch(target) { + case GL_TEXTURE_2D: + case GL_TEXTURE_CUBE_MAP: + case GL_TEXTURE_EXTERNAL_OES: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetTexParameterxv(target=0x%x)", target); + return; + } + switch(pname) { + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_MIN_FILTER: + case GL_TEXTURE_MAG_FILTER: + case GL_GENERATE_MIPMAP: + convert_params_value = false; + n_params = 1; + break; + case GL_TEXTURE_CROP_RECT_OES: + n_params = 4; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glGetTexParameterxv(pname=0x%x)", pname); + return; + } + + _mesa_GetTexParameterfv(target, pname, converted_params); + if (convert_params_value) { + for (i = 0; i < n_params; i++) { + params[i] = (GLint) (converted_params[i] * 65536); + } + } else { + for (i = 0; i < n_params; i++) { + params[i] = (GLfixed) converted_params[i]; + } + } +} + +void GL_APIENTRY +_es_LightModelx(GLenum pname, GLfixed param) +{ + switch(pname) { + case GL_LIGHT_MODEL_TWO_SIDE: + if (param != GL_TRUE && param != GL_FALSE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glLightModelx(pname=0x%x)", pname); + return; + } + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glLightModelx(pname=0x%x)", pname); + return; + } + + _mesa_LightModelf(pname, (GLfloat) param); +} + +void GL_APIENTRY +_es_LightModelxv(GLenum pname, const GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 4; + GLfloat converted_params[4]; + bool convert_params_value = true; + + switch(pname) { + case GL_LIGHT_MODEL_AMBIENT: + n_params = 4; + break; + case GL_LIGHT_MODEL_TWO_SIDE: + if (params[0] != GL_TRUE && params[0] != GL_FALSE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glLightModelxv(pname=0x%x)", pname); + return; + } + convert_params_value = false; + n_params = 1; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glLightModelxv(pname=0x%x)", pname); + return; + } + + if (convert_params_value) { + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) (params[i] / 65536.0f); + } + } else { + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) params[i]; + } + } + + _mesa_LightModelfv(pname, converted_params); +} + +void GL_APIENTRY +_es_Lightx(GLenum light, GLenum pname, GLfixed param) +{ + _mesa_Lightf(light, pname, (GLfloat) (param / 65536.0f)); +} + +void GL_APIENTRY +_es_Lightxv(GLenum light, GLenum pname, const GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 4; + GLfloat converted_params[4]; + + if (light < GL_LIGHT0 || light > GL_LIGHT7) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glLightxv(light=0x%x)", light); + return; + } + switch(pname) { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_POSITION: + n_params = 4; + break; + case GL_SPOT_DIRECTION: + n_params = 3; + break; + case GL_SPOT_EXPONENT: + case GL_SPOT_CUTOFF: + case GL_CONSTANT_ATTENUATION: + case GL_LINEAR_ATTENUATION: + case GL_QUADRATIC_ATTENUATION: + n_params = 1; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glLightxv(pname=0x%x)", pname); + return; + } + + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) (params[i] / 65536.0f); + } + + _mesa_Lightfv(light, pname, converted_params); +} + +void GL_APIENTRY +_es_LineWidthx(GLfixed width) +{ + _mesa_LineWidth((GLfloat) (width / 65536.0f)); +} + +void GL_APIENTRY +_es_LoadMatrixx(const GLfixed *m) +{ + unsigned int i; + GLfloat converted_m[16]; + + for (i = 0; i < Elements(converted_m); i++) { + converted_m[i] = (GLfloat) (m[i] / 65536.0f); + } + + _mesa_LoadMatrixf(converted_m); +} + +void GL_APIENTRY +_es_Materialx(GLenum face, GLenum pname, GLfixed param) +{ + switch(face) { + case GL_FRONT_AND_BACK: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glMaterialx(face=0x%x)", face); + return; + } + switch(pname) { + case GL_SHININESS: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glMaterialx(pname=0x%x)", pname); + return; + } + + _es_Materialf(face, pname, (GLfloat) (param / 65536.0f)); +} + +void GL_APIENTRY +_es_Materialxv(GLenum face, GLenum pname, const GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 4; + GLfloat converted_params[4]; + + switch(face) { + case GL_FRONT_AND_BACK: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glMaterialxv(face=0x%x)", face); + return; + } + switch(pname) { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_AMBIENT_AND_DIFFUSE: + case GL_SPECULAR: + case GL_EMISSION: + n_params = 4; + break; + case GL_SHININESS: + n_params = 1; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glMaterialxv(pname=0x%x)", pname); + return; + } + + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) (params[i] / 65536.0f); + } + + _es_Materialfv(face, pname, converted_params); +} + +void GL_APIENTRY +_es_MultMatrixx(const GLfixed *m) +{ + unsigned int i; + GLfloat converted_m[16]; + + for (i = 0; i < Elements(converted_m); i++) { + converted_m[i] = (GLfloat) (m[i] / 65536.0f); + } + + _mesa_MultMatrixf(converted_m); +} + +void GL_APIENTRY +_es_MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q) +{ + _es_MultiTexCoord4f(texture, + (GLfloat) (s / 65536.0f), + (GLfloat) (t / 65536.0f), + (GLfloat) (r / 65536.0f), + (GLfloat) (q / 65536.0f)); +} + +void GL_APIENTRY +_es_Normal3x(GLfixed nx, GLfixed ny, GLfixed nz) +{ + _es_Normal3f((GLfloat) (nx / 65536.0f), + (GLfloat) (ny / 65536.0f), + (GLfloat) (nz / 65536.0f)); +} + +void GL_APIENTRY +_es_Orthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, + GLfloat zNear, GLfloat zFar) +{ + _mesa_Ortho((GLdouble) (left), + (GLdouble) (right), + (GLdouble) (bottom), + (GLdouble) (top), + (GLdouble) (zNear), + (GLdouble) (zFar)); +} + +void GL_APIENTRY +_es_Orthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, + GLfixed zNear, GLfixed zFar) +{ + _mesa_Ortho((GLdouble) (left / 65536.0), + (GLdouble) (right / 65536.0), + (GLdouble) (bottom / 65536.0), + (GLdouble) (top / 65536.0), + (GLdouble) (zNear / 65536.0), + (GLdouble) (zFar / 65536.0)); +} + +void GL_APIENTRY +_es_PointParameterx(GLenum pname, GLfixed param) +{ + switch(pname) { + case GL_POINT_SIZE_MIN: + case GL_POINT_SIZE_MAX: + case GL_POINT_FADE_THRESHOLD_SIZE: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glPointParameterx(pname=0x%x)", pname); + return; + } + + _mesa_PointParameterf(pname, (GLfloat) (param / 65536.0f)); +} + +void GL_APIENTRY +_es_PointParameterxv(GLenum pname, const GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 3; + GLfloat converted_params[3]; + + switch(pname) { + case GL_POINT_SIZE_MIN: + case GL_POINT_SIZE_MAX: + case GL_POINT_FADE_THRESHOLD_SIZE: + n_params = 1; + break; + case GL_POINT_DISTANCE_ATTENUATION: + n_params = 3; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glPointParameterxv(pname=0x%x)", pname); + return; + } + + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) (params[i] / 65536.0f); + } + + _mesa_PointParameterfv(pname, converted_params); +} + +void GL_APIENTRY +_es_PointSizex(GLfixed size) +{ + _mesa_PointSize((GLfloat) (size / 65536.0f)); +} + +void GL_APIENTRY +_es_PolygonOffsetx(GLfixed factor, GLfixed units) +{ + _mesa_PolygonOffset((GLfloat) (factor / 65536.0f), + (GLfloat) (units / 65536.0f)); +} + +void GL_APIENTRY +_es_Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) +{ + _mesa_Rotatef((GLfloat) (angle / 65536.0f), + (GLfloat) (x / 65536.0f), + (GLfloat) (y / 65536.0f), + (GLfloat) (z / 65536.0f)); +} + +void GL_APIENTRY +_es_SampleCoveragex(GLclampx value, GLboolean invert) +{ + _mesa_SampleCoverageARB((GLclampf) (value / 65536.0f), + invert); +} + +void GL_APIENTRY +_es_Scalex(GLfixed x, GLfixed y, GLfixed z) +{ + _mesa_Scalef((GLfloat) (x / 65536.0f), + (GLfloat) (y / 65536.0f), + (GLfloat) (z / 65536.0f)); +} + +void GL_APIENTRY +_es_TexEnvx(GLenum target, GLenum pname, GLfixed param) +{ + GLfloat converted_param; + bool convert_param_value = true; + + switch(target) { + case GL_POINT_SPRITE: + if (pname != GL_COORD_REPLACE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvx(target=0x%x)", target); + return; + } + break; + case GL_TEXTURE_FILTER_CONTROL_EXT: + if (pname != GL_TEXTURE_LOD_BIAS_EXT) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvx(target=0x%x)", target); + return; + } + break; + case GL_TEXTURE_ENV: + if (pname != GL_TEXTURE_ENV_MODE && pname != GL_COMBINE_RGB && pname != GL_COMBINE_ALPHA && pname != GL_RGB_SCALE && pname != GL_ALPHA_SCALE && pname != GL_SRC0_RGB && pname != GL_SRC1_RGB && pname != GL_SRC2_RGB && pname != GL_SRC0_ALPHA && pname != GL_SRC1_ALPHA && pname != GL_SRC2_ALPHA && pname != GL_OPERAND0_RGB && pname != GL_OPERAND1_RGB && pname != GL_OPERAND2_RGB && pname != GL_OPERAND0_ALPHA && pname != GL_OPERAND1_ALPHA && pname != GL_OPERAND2_ALPHA && pname != GL_TEXTURE_ENV_COLOR) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvx(target=0x%x)", target); + return; + } + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvx(target=0x%x)", target); + return; + } + switch(pname) { + case GL_COORD_REPLACE: + if (param != GL_TRUE && param != GL_FALSE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvx(pname=0x%x)", pname); + return; + } + convert_param_value = false; + break; + case GL_TEXTURE_LOD_BIAS_EXT: + break; + case GL_TEXTURE_ENV_MODE: + if (param != GL_REPLACE && param != GL_MODULATE && param != GL_DECAL && param != GL_BLEND && param != GL_ADD && param != GL_COMBINE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvx(pname=0x%x)", pname); + return; + } + convert_param_value = false; + break; + case GL_COMBINE_RGB: + if (param != GL_REPLACE && param != GL_MODULATE && param != GL_ADD && param != GL_ADD_SIGNED && param != GL_INTERPOLATE && param != GL_SUBTRACT && param != GL_DOT3_RGB && param != GL_DOT3_RGBA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvx(pname=0x%x)", pname); + return; + } + convert_param_value = false; + break; + case GL_COMBINE_ALPHA: + if (param != GL_REPLACE && param != GL_MODULATE && param != GL_ADD && param != GL_ADD_SIGNED && param != GL_INTERPOLATE && param != GL_SUBTRACT) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvx(pname=0x%x)", pname); + return; + } + convert_param_value = false; + break; + case GL_RGB_SCALE: + case GL_ALPHA_SCALE: + break; + case GL_SRC0_RGB: + case GL_SRC1_RGB: + case GL_SRC2_RGB: + case GL_SRC0_ALPHA: + case GL_SRC1_ALPHA: + case GL_SRC2_ALPHA: + convert_param_value = false; + break; + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + case GL_OPERAND2_RGB: + if (param != GL_SRC_COLOR && param != GL_ONE_MINUS_SRC_COLOR && param != GL_SRC_ALPHA && param != GL_ONE_MINUS_SRC_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvx(pname=0x%x)", pname); + return; + } + convert_param_value = false; + break; + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + case GL_OPERAND2_ALPHA: + if (param != GL_SRC_ALPHA && param != GL_ONE_MINUS_SRC_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvx(pname=0x%x)", pname); + return; + } + convert_param_value = false; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvx(pname=0x%x)", pname); + return; + } + + if (convert_param_value) { + converted_param = (GLfloat) (param / 65536.0f); + } else { + converted_param = (GLfloat) param; + } + + _mesa_TexEnvf(target, pname, converted_param); +} + +void GL_APIENTRY +_es_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 4; + GLfloat converted_params[4]; + bool convert_params_value = true; + + switch(target) { + case GL_POINT_SPRITE: + if (pname != GL_COORD_REPLACE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvxv(target=0x%x)", target); + return; + } + break; + case GL_TEXTURE_FILTER_CONTROL_EXT: + if (pname != GL_TEXTURE_LOD_BIAS_EXT) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvxv(target=0x%x)", target); + return; + } + break; + case GL_TEXTURE_ENV: + if (pname != GL_TEXTURE_ENV_MODE && pname != GL_COMBINE_RGB && pname != GL_COMBINE_ALPHA && pname != GL_RGB_SCALE && pname != GL_ALPHA_SCALE && pname != GL_SRC0_RGB && pname != GL_SRC1_RGB && pname != GL_SRC2_RGB && pname != GL_SRC0_ALPHA && pname != GL_SRC1_ALPHA && pname != GL_SRC2_ALPHA && pname != GL_OPERAND0_RGB && pname != GL_OPERAND1_RGB && pname != GL_OPERAND2_RGB && pname != GL_OPERAND0_ALPHA && pname != GL_OPERAND1_ALPHA && pname != GL_OPERAND2_ALPHA && pname != GL_TEXTURE_ENV_COLOR) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvxv(target=0x%x)", target); + return; + } + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvxv(target=0x%x)", target); + return; + } + switch(pname) { + case GL_COORD_REPLACE: + if (params[0] != GL_TRUE && params[0] != GL_FALSE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvxv(pname=0x%x)", pname); + return; + } + convert_params_value = false; + n_params = 1; + break; + case GL_TEXTURE_LOD_BIAS_EXT: + n_params = 1; + break; + case GL_TEXTURE_ENV_MODE: + if (params[0] != GL_REPLACE && params[0] != GL_MODULATE && params[0] != GL_DECAL && params[0] != GL_BLEND && params[0] != GL_ADD && params[0] != GL_COMBINE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvxv(pname=0x%x)", pname); + return; + } + convert_params_value = false; + n_params = 1; + break; + case GL_COMBINE_RGB: + if (params[0] != GL_REPLACE && params[0] != GL_MODULATE && params[0] != GL_ADD && params[0] != GL_ADD_SIGNED && params[0] != GL_INTERPOLATE && params[0] != GL_SUBTRACT && params[0] != GL_DOT3_RGB && params[0] != GL_DOT3_RGBA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvxv(pname=0x%x)", pname); + return; + } + convert_params_value = false; + n_params = 1; + break; + case GL_COMBINE_ALPHA: + if (params[0] != GL_REPLACE && params[0] != GL_MODULATE && params[0] != GL_ADD && params[0] != GL_ADD_SIGNED && params[0] != GL_INTERPOLATE && params[0] != GL_SUBTRACT) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvxv(pname=0x%x)", pname); + return; + } + convert_params_value = false; + n_params = 1; + break; + case GL_RGB_SCALE: + case GL_ALPHA_SCALE: + break; + case GL_SRC0_RGB: + case GL_SRC1_RGB: + case GL_SRC2_RGB: + case GL_SRC0_ALPHA: + case GL_SRC1_ALPHA: + case GL_SRC2_ALPHA: + convert_params_value = false; + n_params = 1; + break; + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + case GL_OPERAND2_RGB: + if (params[0] != GL_SRC_COLOR && params[0] != GL_ONE_MINUS_SRC_COLOR && params[0] != GL_SRC_ALPHA && params[0] != GL_ONE_MINUS_SRC_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvxv(pname=0x%x)", pname); + return; + } + convert_params_value = false; + n_params = 1; + break; + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + case GL_OPERAND2_ALPHA: + if (params[0] != GL_SRC_ALPHA && params[0] != GL_ONE_MINUS_SRC_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvxv(pname=0x%x)", pname); + return; + } + convert_params_value = false; + n_params = 1; + break; + case GL_TEXTURE_ENV_COLOR: + n_params = 4; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexEnvxv(pname=0x%x)", pname); + return; + } + + if (convert_params_value) { + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) (params[i] / 65536.0f); + } + } else { + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) params[i]; + } + } + + _mesa_TexEnvfv(target, pname, converted_params); +} + +void GL_APIENTRY +_check_TexGeniOES(GLenum coord, GLenum pname, GLint param) +{ + switch(coord) { + case GL_TEXTURE_GEN_STR_OES: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGeniOES(coord=0x%x)", coord); + return; + } + switch(pname) { + case GL_TEXTURE_GEN_MODE: + if (param != GL_NORMAL_MAP && param != GL_REFLECTION_MAP) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGeniOES(pname=0x%x)", pname); + return; + } + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGeniOES(pname=0x%x)", pname); + return; + } + + _es_TexGenf(coord, pname, (GLfloat) param); +} + +void GL_APIENTRY +_check_TexGenivOES(GLenum coord, GLenum pname, const GLint *params) +{ + unsigned int i; + unsigned int n_params = 1; + GLfloat converted_params[1]; + + switch(coord) { + case GL_TEXTURE_GEN_STR_OES: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGenivOES(coord=0x%x)", coord); + return; + } + switch(pname) { + case GL_TEXTURE_GEN_MODE: + if (params[0] != GL_NORMAL_MAP && params[0] != GL_REFLECTION_MAP) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGenivOES(pname=0x%x)", pname); + return; + } + n_params = 1; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGenivOES(pname=0x%x)", pname); + return; + } + + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) params[i]; + } + + _es_TexGenfv(coord, pname, converted_params); +} + +void GL_APIENTRY +_check_TexGenxOES(GLenum coord, GLenum pname, GLfixed param) +{ + switch(coord) { + case GL_TEXTURE_GEN_STR_OES: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGenxOES(coord=0x%x)", coord); + return; + } + switch(pname) { + case GL_TEXTURE_GEN_MODE: + if (param != GL_NORMAL_MAP && param != GL_REFLECTION_MAP) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGenxOES(pname=0x%x)", pname); + return; + } + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGenxOES(pname=0x%x)", pname); + return; + } + + _es_TexGenf(coord, pname, (GLfloat) param); +} + +void GL_APIENTRY +_check_TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 1; + GLfloat converted_params[1]; + + switch(coord) { + case GL_TEXTURE_GEN_STR_OES: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGenxvOES(coord=0x%x)", coord); + return; + } + switch(pname) { + case GL_TEXTURE_GEN_MODE: + if (params[0] != GL_NORMAL_MAP && params[0] != GL_REFLECTION_MAP) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGenxvOES(pname=0x%x)", pname); + return; + } + n_params = 1; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexGenxvOES(pname=0x%x)", pname); + return; + } + + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) params[i]; + } + + _es_TexGenfv(coord, pname, converted_params); +} + +void GL_APIENTRY +_es_TexParameterx(GLenum target, GLenum pname, GLfixed param) +{ + GLfloat converted_param; + bool convert_param_value = true; + + switch(target) { + case GL_TEXTURE_2D: + case GL_TEXTURE_CUBE_MAP: + case GL_TEXTURE_EXTERNAL_OES: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexParameterx(target=0x%x)", target); + return; + } + switch(pname) { + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + if (param != GL_CLAMP_TO_EDGE && param != GL_REPEAT && param != GL_MIRRORED_REPEAT) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexParameterx(pname=0x%x)", pname); + return; + } + convert_param_value = false; + break; + case GL_TEXTURE_MIN_FILTER: + case GL_TEXTURE_MAG_FILTER: + convert_param_value = false; + break; + case GL_GENERATE_MIPMAP: + if (param != GL_TRUE && param != GL_FALSE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexParameterx(pname=0x%x)", pname); + return; + } + convert_param_value = false; + break; + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexParameterx(pname=0x%x)", pname); + return; + } + + if (convert_param_value) { + converted_param = (GLfloat) (param / 65536.0f); + } else { + converted_param = (GLfloat) param; + } + + _mesa_TexParameterf(target, pname, converted_param); +} + +void GL_APIENTRY +_es_TexParameterxv(GLenum target, GLenum pname, const GLfixed *params) +{ + unsigned int i; + unsigned int n_params = 4; + GLfloat converted_params[4]; + bool convert_params_value = true; + + switch(target) { + case GL_TEXTURE_2D: + case GL_TEXTURE_CUBE_MAP: + case GL_TEXTURE_EXTERNAL_OES: + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexParameterxv(target=0x%x)", target); + return; + } + switch(pname) { + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + if (params[0] != GL_CLAMP_TO_EDGE && params[0] != GL_REPEAT && params[0] != GL_MIRRORED_REPEAT) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexParameterxv(pname=0x%x)", pname); + return; + } + convert_params_value = false; + n_params = 1; + break; + case GL_TEXTURE_MIN_FILTER: + case GL_TEXTURE_MAG_FILTER: + convert_params_value = false; + n_params = 1; + break; + case GL_GENERATE_MIPMAP: + if (params[0] != GL_TRUE && params[0] != GL_FALSE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexParameterxv(pname=0x%x)", pname); + return; + } + convert_params_value = false; + n_params = 1; + break; + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + n_params = 1; + break; + case GL_TEXTURE_CROP_RECT_OES: + n_params = 4; + break; + default: + _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, + "glTexParameterxv(pname=0x%x)", pname); + return; + } + + if (convert_params_value) { + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) (params[i] / 65536.0f); + } + } else { + for (i = 0; i < n_params; i++) { + converted_params[i] = (GLfloat) params[i]; + } + } + + _mesa_TexParameterfv(target, pname, converted_params); +} + +void GL_APIENTRY +_es_Translatex(GLfixed x, GLfixed y, GLfixed z) +{ + _mesa_Translatef((GLfloat) (x / 65536.0f), + (GLfloat) (y / 65536.0f), + (GLfloat) (z / 65536.0f)); +} + +#endif /* FEATURE_ES1 */ diff --git a/mesalib/src/mesa/main/es1_conversion.h b/mesalib/src/mesa/main/es1_conversion.h new file mode 100644 index 000000000..ece3893a1 --- /dev/null +++ b/mesalib/src/mesa/main/es1_conversion.h @@ -0,0 +1,157 @@ +void GL_APIENTRY +_es_AlphaFuncx(GLenum func, GLclampx ref); + +void GL_APIENTRY +_es_ClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); + +void GL_APIENTRY +_es_ClearDepthx(GLclampx depth); + +void GL_APIENTRY +_es_ClipPlanef(GLenum plane, const GLfloat *equation); + +void GL_APIENTRY +_es_ClipPlanex(GLenum plane, const GLfixed *equation); + +void GL_APIENTRY +_es_Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); + +void GL_APIENTRY +_es_Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); + +void GL_APIENTRY +_es_DepthRangex(GLclampx zNear, GLclampx zFar); + +void GL_APIENTRY +_es_DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h); + +void GL_APIENTRY +_es_DrawTexxvOES(const GLfixed *coords); + +void GL_APIENTRY +_es_Fogx(GLenum pname, GLfixed param); + +void GL_APIENTRY +_es_Fogxv(GLenum pname, const GLfixed *params); + +void GL_APIENTRY +_es_Frustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, + GLfloat zNear, GLfloat zFar); + +void GL_APIENTRY +_es_Frustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, + GLfixed zNear, GLfixed zFar); + +void GL_APIENTRY +_es_GetClipPlanef(GLenum plane, GLfloat *equation); + +void GL_APIENTRY +_es_GetClipPlanex(GLenum plane, GLfixed *equation); + +void GL_APIENTRY +_es_GetLightxv(GLenum light, GLenum pname, GLfixed *params); + +void GL_APIENTRY +_es_GetMaterialxv(GLenum face, GLenum pname, GLfixed *params); + +void GL_APIENTRY +_check_GetTexGenivOES(GLenum coord, GLenum pname, GLint *params); + +void GL_APIENTRY +_es_GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params); + +void GL_APIENTRY +_check_GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params); + +void GL_APIENTRY +_es_GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params); + +void GL_APIENTRY +_es_LightModelx(GLenum pname, GLfixed param); + +void GL_APIENTRY +_es_LightModelxv(GLenum pname, const GLfixed *params); + +void GL_APIENTRY +_es_Lightx(GLenum light, GLenum pname, GLfixed param); + +void GL_APIENTRY +_es_Lightxv(GLenum light, GLenum pname, const GLfixed *params); + +void GL_APIENTRY +_es_LineWidthx(GLfixed width); + +void GL_APIENTRY +_es_LoadMatrixx(const GLfixed *m); + +void GL_APIENTRY +_es_Materialx(GLenum face, GLenum pname, GLfixed param); + +void GL_APIENTRY +_es_Materialxv(GLenum face, GLenum pname, const GLfixed *params); + +void GL_APIENTRY +_es_MultMatrixx(const GLfixed *m); + +void GL_APIENTRY +_es_MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); + +void GL_APIENTRY +_es_Normal3x(GLfixed nx, GLfixed ny, GLfixed nz); + +void GL_APIENTRY +_es_Orthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, + GLfloat zNear, GLfloat zFar); + +void GL_APIENTRY +_es_Orthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, + GLfixed zNear, GLfixed zFar); + +void GL_APIENTRY +_es_PointParameterx(GLenum pname, GLfixed param); + +void GL_APIENTRY +_es_PointParameterxv(GLenum pname, const GLfixed *params); + +void GL_APIENTRY +_es_PointSizex(GLfixed size); + +void GL_APIENTRY +_es_PolygonOffsetx(GLfixed factor, GLfixed units); + +void GL_APIENTRY +_es_Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); + +void GL_APIENTRY +_es_SampleCoveragex(GLclampx value, GLboolean invert); + +void GL_APIENTRY +_es_Scalex(GLfixed x, GLfixed y, GLfixed z); + +void GL_APIENTRY +_es_TexEnvx(GLenum target, GLenum pname, GLfixed param); + +void GL_APIENTRY +_es_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params); + +void GL_APIENTRY +_check_TexGeniOES(GLenum coord, GLenum pname, GLint param); + +void GL_APIENTRY +_check_TexGenivOES(GLenum coord, GLenum pname, const GLint *params); + +void GL_APIENTRY +_check_TexGenxOES(GLenum coord, GLenum pname, GLfixed param); + +void GL_APIENTRY +_check_TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params); + +void GL_APIENTRY +_es_TexParameterx(GLenum target, GLenum pname, GLfixed param); + +void GL_APIENTRY +_es_TexParameterxv(GLenum target, GLenum pname, const GLfixed *params); + +void GL_APIENTRY +_es_Translatex(GLfixed x, GLfixed y, GLfixed z); + diff --git a/mesalib/src/mesa/main/es_generator.py b/mesalib/src/mesa/main/es_generator.py index cad3deaef..b074e9dcf 100644 --- a/mesalib/src/mesa/main/es_generator.py +++ b/mesalib/src/mesa/main/es_generator.py @@ -201,6 +201,10 @@ print """ #endif """ % (versionHeader, versionExtHeader, shortname.upper()) +if version == "GLES1.1": + print '#include "main/es1_conversion.h"' + print + # Everyone needs these types. print """ /* These types are needed for the Mesa veneer, but are not defined in @@ -566,6 +570,9 @@ for funcName in keys: # endfor every param + if conversionCodeOutgoing != [] or conversionCodeIncoming != []: + continue + # Here, the passthroughDeclarationString and passthroughCallString # are complete; remove the extra ", " at the front of each. passthroughDeclarationString = passthroughDeclarationString[2:] diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c index 4cd87c645..ee43d0d89 100644 --- a/mesalib/src/mesa/main/texgetimage.c +++ b/mesalib/src/mesa/main/texgetimage.c @@ -642,6 +642,36 @@ _mesa_get_compressed_teximage(struct gl_context *ctx, } +/** + * Validate the texture target enum supplied to glTexImage or + * glCompressedTexImage. + */ +static GLboolean +legal_getteximage_target(struct gl_context *ctx, GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + return GL_TRUE; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + return ctx->Extensions.ARB_texture_cube_map; + case GL_TEXTURE_RECTANGLE_NV: + return ctx->Extensions.NV_texture_rectangle; + case GL_TEXTURE_1D_ARRAY_EXT: + case GL_TEXTURE_2D_ARRAY_EXT: + return (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); + default: + return GL_FALSE; + } +} + /** * Do error checking for a glGetTexImage() call. @@ -658,11 +688,12 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level, const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2; GLenum baseFormat, err; - if (maxLevels == 0) { + if (!legal_getteximage_target(ctx, target)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target=0x%x)", target); return GL_TRUE; } + assert(maxLevels != 0); if (level < 0 || level >= maxLevels) { _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" ); return GL_TRUE; @@ -676,7 +707,7 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level, texObj = _mesa_get_current_tex_object(ctx, target); - if (!texObj || _mesa_is_proxy_texture(target)) { + if (!texObj) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)"); return GL_TRUE; } @@ -820,25 +851,19 @@ getcompressedteximage_error_check(struct gl_context *ctx, GLenum target, const GLint maxLevels = _mesa_max_texture_levels(ctx, target); GLuint compressedSize; - if (maxLevels == 0) { + if (!legal_getteximage_target(ctx, target)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImage(target=0x%x)", target); return GL_TRUE; } + assert(maxLevels != 0); if (level < 0 || level >= maxLevels) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(bad level = %d)", level); return GL_TRUE; } - if (_mesa_is_proxy_texture(target)) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetCompressedTexImageARB(bad target = %s)", - _mesa_lookup_enum_by_nr(target)); - return GL_TRUE; - } - texObj = _mesa_get_current_tex_object(ctx, target); if (!texObj) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)"); diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 569adc16a..fd02a1be2 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -946,6 +946,7 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target) case GL_TEXTURE_3D: case GL_PROXY_TEXTURE_3D: return ctx->Const.Max3DTextureLevels; + case GL_TEXTURE_CUBE_MAP: case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: @@ -966,6 +967,9 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target) ctx->Extensions.EXT_texture_array) ? ctx->Const.MaxTextureLevels : 0; case GL_TEXTURE_BUFFER: + return _mesa_is_desktop_gl(ctx) && + (ctx->Extensions.ARB_texture_buffer_object || + (ctx->Version >= 31)) ? 1 : 0; case GL_TEXTURE_EXTERNAL_OES: /* fall-through */ default: diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index 690fd6c25..41b9f97bf 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -871,50 +871,67 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params) } -void GLAPIENTRY -_mesa_GetTexLevelParameterfv( GLenum target, GLint level, - GLenum pname, GLfloat *params ) +static GLboolean +legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target) { - GLint iparam; - _mesa_GetTexLevelParameteriv( target, level, pname, &iparam ); - *params = (GLfloat) iparam; + switch (target) { + case GL_TEXTURE_1D: + case GL_PROXY_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_PROXY_TEXTURE_2D: + case GL_TEXTURE_3D: + case GL_PROXY_TEXTURE_3D: + return GL_TRUE; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + return ctx->Extensions.ARB_texture_cube_map; + case GL_TEXTURE_RECTANGLE_NV: + case GL_PROXY_TEXTURE_RECTANGLE_NV: + return ctx->Extensions.NV_texture_rectangle; + case GL_TEXTURE_1D_ARRAY_EXT: + case GL_PROXY_TEXTURE_1D_ARRAY_EXT: + case GL_TEXTURE_2D_ARRAY_EXT: + case GL_PROXY_TEXTURE_2D_ARRAY_EXT: + return (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); + case GL_TEXTURE_BUFFER: + /* GetTexLevelParameter accepts GL_TEXTURE_BUFFER in GL 3.1+ contexts, + * but not in earlier versions that expose ARB_texture_buffer_object. + * + * From the ARB_texture_buffer_object spec: + * "(7) Do buffer textures support texture parameters (TexParameter) or + * queries (GetTexParameter, GetTexLevelParameter, GetTexImage)? + * + * RESOLVED: No. [...] Note that the spec edits above don't add + * explicit error language for any of these cases. That is because + * each of the functions enumerate the set of valid <target> + * parameters. Not editing the spec to allow TEXTURE_BUFFER_ARB in + * these cases means that target is not legal, and an INVALID_ENUM + * error should be generated." + * + * From the OpenGL 3.1 spec: + * "target may also be TEXTURE_BUFFER, indicating the texture buffer." + */ + return _mesa_is_desktop_gl(ctx) && ctx->Version >= 31; + default: + return GL_FALSE; + } } -void GLAPIENTRY -_mesa_GetTexLevelParameteriv( GLenum target, GLint level, - GLenum pname, GLint *params ) +static void +get_tex_level_parameter_image(struct gl_context *ctx, + const struct gl_texture_object *texObj, + GLenum target, GLint level, + GLenum pname, GLint *params) { - const struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; const struct gl_texture_image *img = NULL; - GLint maxLevels; gl_format texFormat; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxCombinedTextureImageUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetTexLevelParameteriv(current unit)"); - return; - } - - texUnit = _mesa_get_current_tex_unit(ctx); - - /* this will catch bad target values */ - maxLevels = _mesa_max_texture_levels(ctx, target); - if (maxLevels == 0) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(target=0x%x)", target); - return; - } - - if (level < 0 || level >= maxLevels) { - _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" ); - return; - } - - texObj = _mesa_select_tex_object(ctx, texUnit, target); img = _mesa_select_tex_image(ctx, texObj, target, level); if (!img || img->TexFormat == MESA_FORMAT_NONE) { @@ -1054,6 +1071,155 @@ invalid_pname: } +static void +get_tex_level_parameter_buffer(struct gl_context *ctx, + const struct gl_texture_object *texObj, + GLenum pname, GLint *params) +{ + const struct gl_buffer_object *bo = texObj->BufferObject; + gl_format texFormat = texObj->_BufferObjectFormat; + GLenum internalFormat = texObj->BufferObjectFormat; + GLenum baseFormat = _mesa_get_format_base_format(texFormat); + + if (!bo) { + /* undefined texture buffer object */ + *params = pname == GL_TEXTURE_COMPONENTS ? 1 : 0; + return; + } + + switch (pname) { + case GL_TEXTURE_BUFFER_DATA_STORE_BINDING: + *params = bo->Name; + break; + case GL_TEXTURE_WIDTH: + *params = bo->Size; + break; + case GL_TEXTURE_HEIGHT: + case GL_TEXTURE_DEPTH: + case GL_TEXTURE_BORDER: + case GL_TEXTURE_SHARED_SIZE: + case GL_TEXTURE_COMPRESSED: + *params = 0; + break; + case GL_TEXTURE_INTERNAL_FORMAT: + *params = internalFormat; + break; + case GL_TEXTURE_RED_SIZE: + case GL_TEXTURE_GREEN_SIZE: + case GL_TEXTURE_BLUE_SIZE: + case GL_TEXTURE_ALPHA_SIZE: + if (_mesa_base_format_has_channel(baseFormat, pname)) + *params = _mesa_get_format_bits(texFormat, pname); + else + *params = 0; + break; + case GL_TEXTURE_INTENSITY_SIZE: + case GL_TEXTURE_LUMINANCE_SIZE: + if (_mesa_base_format_has_channel(baseFormat, pname)) { + *params = _mesa_get_format_bits(texFormat, pname); + if (*params == 0) { + /* intensity or luminance is probably stored as RGB[A] */ + *params = MIN2(_mesa_get_format_bits(texFormat, + GL_TEXTURE_RED_SIZE), + _mesa_get_format_bits(texFormat, + GL_TEXTURE_GREEN_SIZE)); + } + } else { + *params = 0; + } + break; + case GL_TEXTURE_DEPTH_SIZE_ARB: + case GL_TEXTURE_STENCIL_SIZE_EXT: + *params = _mesa_get_format_bits(texFormat, pname); + break; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: + /* Always illegal for GL_TEXTURE_BUFFER */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetTexLevelParameter[if]v(pname)"); + break; + + /* GL_ARB_texture_float */ + case GL_TEXTURE_RED_TYPE_ARB: + case GL_TEXTURE_GREEN_TYPE_ARB: + case GL_TEXTURE_BLUE_TYPE_ARB: + case GL_TEXTURE_ALPHA_TYPE_ARB: + case GL_TEXTURE_LUMINANCE_TYPE_ARB: + case GL_TEXTURE_INTENSITY_TYPE_ARB: + case GL_TEXTURE_DEPTH_TYPE_ARB: + if (!ctx->Extensions.ARB_texture_float) + goto invalid_pname; + if (_mesa_base_format_has_channel(baseFormat, pname)) + *params = _mesa_get_format_datatype(texFormat); + else + *params = GL_NONE; + break; + + default: + goto invalid_pname; + } + + /* no error if we get here */ + return; + +invalid_pname: + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname=%s)", + _mesa_lookup_enum_by_nr(pname)); +} + + +void GLAPIENTRY +_mesa_GetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ) +{ + GLint iparam; + _mesa_GetTexLevelParameteriv( target, level, pname, &iparam ); + *params = (GLfloat) iparam; +} + + +void GLAPIENTRY +_mesa_GetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ) +{ + const struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + GLint maxLevels; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxCombinedTextureImageUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetTexLevelParameteriv(current unit)"); + return; + } + + texUnit = _mesa_get_current_tex_unit(ctx); + + if (!legal_get_tex_level_parameter_target(ctx, target)) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(target=0x%x)", target); + return; + } + + maxLevels = _mesa_max_texture_levels(ctx, target); + assert(maxLevels != 0); + + if (level < 0 || level >= maxLevels) { + _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" ); + return; + } + + texObj = _mesa_select_tex_object(ctx, texUnit, target); + + if (target == GL_TEXTURE_BUFFER) + get_tex_level_parameter_buffer(ctx, texObj, pname, params); + else + get_tex_level_parameter_image(ctx, texObj, target, level, pname, params); +} + void GLAPIENTRY _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak index 30e2219b0..ee260cbfd 100644 --- a/mesalib/src/mesa/sources.mak +++ b/mesalib/src/mesa/sources.mak @@ -6,7 +6,8 @@ # this is part of MAIN_FILES MAIN_ES_FILES = \ $(BUILDDIR)main/api_exec_es1.c \ - $(BUILDDIR)main/api_exec_es2.c + $(BUILDDIR)main/api_exec_es2.c \ + $(SRCDIR)main/es1_conversion.c MAIN_FILES = \ $(SRCDIR)main/api_arrayelt.c \ diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c index 6e2efd960..df05e83c2 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_texture.c +++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c @@ -265,7 +265,7 @@ update_textures(struct st_context *st, { const GLuint old_max = *num_textures; GLbitfield samplers_used = prog->SamplersUsed; - GLuint unit; + GLuint unit, new_count; if (samplers_used == 0x0 && old_max == 0) return; @@ -294,9 +294,16 @@ update_textures(struct st_context *st, pipe_sampler_view_reference(&(sampler_views[unit]), sampler_view); } + /* Ex: if old_max = 3 and *num_textures = 1, we need to pass an + * array of views={X, NULL, NULL} to unref the old texture views + * at positions [1] and [2]. + */ + new_count = MAX2(*num_textures, old_max); + assert(new_count <= max_units); + cso_set_sampler_views(st->cso_context, shader_stage, - MIN2(*num_textures, max_units), + new_count, sampler_views); } diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 7735eee4f..2e14da211 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -163,7 +163,10 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe ) else st->internal_target = PIPE_TEXTURE_RECT; - for (i = 0; i < 3; i++) { + /* Vertex element objects used for drawing rectangles for glBitmap, + * glDrawPixels, glClear, etc. + */ + for (i = 0; i < Elements(st->velems_util_draw); i++) { memset(&st->velems_util_draw[i], 0, sizeof(struct pipe_vertex_element)); st->velems_util_draw[i].src_offset = i * 4 * sizeof(float); st->velems_util_draw[i].instance_divisor = 0; |