Browse Source

Add GLX protocol support for ARB_fragement_program,

ARB_fragment_program_shadow, ARB_vertex_program, NV_fragment_program,
NV_fragment_program_option, NV_fragment_program2, NV_vertex_program,
NV_vertex_program1_1, NV_vertex_program2, NV_vertex_program2_option,
NV_vertex_program3, and ATI_text_fragment_shader.
tags/before_upgrade_03_01_05
Ian Romanick 20 years ago
parent
commit
40af76bbaa

+ 1
- 0
src/glx/x11/Makefile View File

@@ -33,6 +33,7 @@ C_SOURCES = \
indirect_window_pos.c \
indirect_transpose_matrix.c \
indirect_vertex_array.c \
indirect_vertex_program.c \
pixel.c \
pixelstore.c \
render2.c \

+ 12
- 1
src/glx/x11/glxextensions.c View File

@@ -112,7 +112,8 @@ static const struct extension_info known_glx_extensions[] = {

static const struct extension_info known_gl_extensions[] = {
{ GL(ARB_depth_texture), VER(1,4), Y, N, N, N },
{ GL(ARB_fragment_program), VER(0,0), N, N, N, N },
{ GL(ARB_fragment_program), VER(0,0), Y, N, N, N },
{ GL(ARB_fragment_program_shadow), VER(0,0), Y, N, N, N },
{ GL(ARB_imaging), VER(0,0), Y, N, N, N },
{ GL(ARB_multisample), VER(1,3), Y, N, N, N },
{ GL(ARB_multitexture), VER(1,3), Y, N, N, N },
@@ -133,6 +134,7 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(ARB_texture_rectangle), VER(0,0), Y, N, N, N },
{ GL(ARB_transpose_matrix), VER(1,3), Y, N, Y, N },
{ GL(ARB_vertex_buffer_object), VER(1,5), N, N, N, N },
{ GL(ARB_vertex_program), VER(0,0), Y, N, N, N },
{ GL(ARB_window_pos), VER(1,4), Y, N, N, N },
{ GL(EXT_abgr), VER(0,0), Y, N, N, N },
{ GL(EXT_bgra), VER(1,2), Y, N, N, N },
@@ -182,6 +184,7 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(3DFX_texture_compression_FXT1), VER(0,0), Y, N, N, N },
{ GL(APPLE_packed_pixels), VER(1,2), Y, N, N, N },
{ GL(APPLE_ycbcr_422), VER(0,0), Y, N, N, N },
{ GL(ATI_text_fragment_shader), VER(0,0), Y, N, N, N },
{ GL(ATI_texture_env_combine3), VER(0,0), Y, N, N, N },
{ GL(ATI_texture_float), VER(0,0), Y, N, N, N },
{ GL(ATI_texture_mirror_once), VER(0,0), Y, N, N, N },
@@ -201,6 +204,9 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(NV_copy_depth_to_color), VER(0,0), Y, N, N, N },
{ GL(NV_depth_clamp), VER(0,0), Y, N, N, N },
{ GL(NV_fog_distance), VER(0,0), Y, N, N, N },
{ GL(NV_fragment_program), VER(0,0), Y, N, N, N },
{ GL(NV_fragment_program_option), VER(0,0), Y, N, N, N },
{ GL(NV_fragment_program2), VER(0,0), Y, N, N, N },
{ GL(NV_light_max_exponent), VER(0,0), Y, N, N, N },
{ GL(NV_multisample_filter_hint), VER(0,0), Y, N, N, N },
{ GL(NV_point_sprite), VER(0,0), Y, N, N, N },
@@ -208,6 +214,11 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(NV_texture_compression_vtc), VER(0,0), Y, N, N, N },
{ GL(NV_texture_env_combine4), VER(0,0), Y, N, N, N },
{ GL(NV_texture_rectangle), VER(0,0), Y, N, N, N },
{ GL(NV_vertex_program), VER(0,0), Y, N, N, N },
{ GL(NV_vertex_program1_1), VER(0,0), Y, N, N, N },
{ GL(NV_vertex_program2), VER(0,0), Y, N, N, N },
{ GL(NV_vertex_program2_option), VER(0,0), Y, N, N, N },
{ GL(NV_vertex_program3), VER(0,0), Y, N, N, N },
{ GL(OES_read_format), VER(0,0), Y, N, N, N },
{ GL(OES_compressed_paletted_texture),VER(0,0), Y, N, N, N },
{ GL(SGI_color_matrix), VER(0,0), Y, N, N, N },

+ 10
- 0
src/glx/x11/glxextensions.h View File

@@ -75,6 +75,7 @@ enum {
enum {
GL_ARB_depth_texture_bit = 0,
GL_ARB_fragment_program_bit,
GL_ARB_fragment_program_shadow_bit,
GL_ARB_imaging_bit,
GL_ARB_multisample_bit,
GL_ARB_multitexture_bit,
@@ -142,6 +143,7 @@ enum {
GL_3DFX_texture_compression_FXT1_bit,
GL_APPLE_packed_pixels_bit,
GL_APPLE_ycbcr_422_bit,
GL_ATI_text_fragment_shader_bit,
GL_ATI_texture_env_combine3_bit,
GL_ATI_texture_float_bit,
GL_ATI_texture_mirror_once_bit,
@@ -158,12 +160,20 @@ enum {
GL_NV_copy_depth_to_color_bit,
GL_NV_depth_clamp_bit,
GL_NV_fog_distance_bit,
GL_NV_fragment_program_bit,
GL_NV_fragment_program_option_bit,
GL_NV_fragment_program2_bit,
GL_NV_light_max_exponent_bit,
GL_NV_multisample_filter_hint_bit,
GL_NV_point_sprite_bit,
GL_NV_texgen_reflection_bit,
GL_NV_texture_compression_vtc_bit,
GL_NV_texture_env_combine4_bit,
GL_NV_vertex_program_bit,
GL_NV_vertex_program1_1_bit,
GL_NV_vertex_program2_bit,
GL_NV_vertex_program2_option_bit,
GL_NV_vertex_program3_bit,
GL_OES_compressed_paletted_texture_bit,
GL_OES_read_format_bit,
GL_SGI_color_matrix_bit,

+ 1714
- 16
src/glx/x11/indirect.c
File diff suppressed because it is too large
View File


+ 126
- 0
src/glx/x11/indirect.h View File

@@ -541,11 +541,137 @@ extern HIDDEN void __indirect_glSecondaryColor3uivEXT(const GLuint * v);
extern HIDDEN void __indirect_glSecondaryColor3usEXT(GLushort red, GLushort green, GLushort blue);
extern HIDDEN void __indirect_glSecondaryColor3usvEXT(const GLushort * v);
extern HIDDEN void __indirect_glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
extern HIDDEN GLboolean __indirect_glAreProgramsResidentNV(GLsizei n, const GLuint * ids, GLboolean * residences);
extern HIDDEN void __indirect_glBindProgramNV(GLenum target, GLuint id);
extern HIDDEN void __indirect_glDeleteProgramsNV(GLsizei n, const GLuint * ids);
extern HIDDEN void __indirect_glExecuteProgramNV(GLenum target, GLuint id, const GLfloat * params);
extern HIDDEN void __indirect_glGenProgramsNV(GLsizei n, GLuint * ids);
extern HIDDEN void __indirect_glGetProgramParameterdvNV(GLenum target, GLuint index, GLenum pname, GLdouble * params);
extern HIDDEN void __indirect_glGetProgramParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat * params);
extern HIDDEN void __indirect_glGetProgramivNV(GLuint id, GLenum pname, GLint * params);
extern HIDDEN void __indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte * program);
extern HIDDEN void __indirect_glGetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint * params);
extern HIDDEN void __indirect_glGetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble * params);
extern HIDDEN void __indirect_glGetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat * params);
extern HIDDEN void __indirect_glGetVertexAttribivARB(GLuint index, GLenum pname, GLint * params);
extern HIDDEN void __indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid ** pointer);
extern HIDDEN GLboolean __indirect_glIsProgramNV(GLuint id);
extern HIDDEN void __indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte * program);
extern HIDDEN void __indirect_glProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern HIDDEN void __indirect_glProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble * params);
extern HIDDEN void __indirect_glProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern HIDDEN void __indirect_glProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat * params);
extern HIDDEN void __indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble * params);
extern HIDDEN void __indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLuint num, const GLfloat * params);
extern HIDDEN void __indirect_glRequestResidentProgramsNV(GLsizei n, const GLuint * ids);
extern HIDDEN void __indirect_glTrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform);
extern HIDDEN void __indirect_glVertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
extern HIDDEN void __indirect_glVertexAttrib1dARB(GLuint index, GLdouble x);
extern HIDDEN void __indirect_glVertexAttrib1dvARB(GLuint index, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttrib1fARB(GLuint index, GLfloat x);
extern HIDDEN void __indirect_glVertexAttrib1fvARB(GLuint index, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttrib1sARB(GLuint index, GLshort x);
extern HIDDEN void __indirect_glVertexAttrib1svARB(GLuint index, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y);
extern HIDDEN void __indirect_glVertexAttrib2dvARB(GLuint index, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y);
extern HIDDEN void __indirect_glVertexAttrib2fvARB(GLuint index, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttrib2sARB(GLuint index, GLshort x, GLshort y);
extern HIDDEN void __indirect_glVertexAttrib2svARB(GLuint index, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z);
extern HIDDEN void __indirect_glVertexAttrib3dvARB(GLuint index, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z);
extern HIDDEN void __indirect_glVertexAttrib3fvARB(GLuint index, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z);
extern HIDDEN void __indirect_glVertexAttrib3svARB(GLuint index, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern HIDDEN void __indirect_glVertexAttrib4dvARB(GLuint index, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern HIDDEN void __indirect_glVertexAttrib4fvARB(GLuint index, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
extern HIDDEN void __indirect_glVertexAttrib4svARB(GLuint index, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
extern HIDDEN void __indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte * v);
extern HIDDEN void __indirect_glVertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttribs1svNV(GLuint index, GLsizei n, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttribs2svNV(GLuint index, GLsizei n, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttribs3svNV(GLuint index, GLsizei n, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte * v);
extern HIDDEN void __indirect_glPointParameteriNV(GLenum pname, GLint params);
extern HIDDEN void __indirect_glPointParameterivNV(GLenum pname, const GLint * params);
extern HIDDEN void __indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount);
extern HIDDEN void __indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount);
extern HIDDEN void __indirect_glActiveStencilFaceEXT(GLenum face);
extern HIDDEN void __indirect_glVertexAttrib4ivARB(GLuint index, const GLint * v);
extern HIDDEN void __indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte * v);
extern HIDDEN void __indirect_glVertexAttrib4usvARB(GLuint index, const GLushort * v);
extern HIDDEN void __indirect_glVertexAttrib4uivARB(GLuint index, const GLuint * v);
extern HIDDEN void __indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte * v);
extern HIDDEN void __indirect_glVertexAttrib4NsvARB(GLuint index, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttrib4NivARB(GLuint index, const GLint * v);
extern HIDDEN void __indirect_glVertexAttrib4NusvARB(GLuint index, const GLushort * v);
extern HIDDEN void __indirect_glVertexAttrib4NuivARB(GLuint index, const GLuint * v);
extern HIDDEN void __indirect_glVertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer);
extern HIDDEN void __indirect_glEnableVertexAttribArrayARB(GLuint index);
extern HIDDEN void __indirect_glDisableVertexAttribArrayARB(GLuint index);
extern HIDDEN void __indirect_glProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid * string);
extern HIDDEN void __indirect_glProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern HIDDEN void __indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
extern HIDDEN void __indirect_glProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern HIDDEN void __indirect_glProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat * params);
extern HIDDEN void __indirect_glProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern HIDDEN void __indirect_glProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
extern HIDDEN void __indirect_glProgramLocalParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern HIDDEN void __indirect_glProgramLocalParameter4fvARB(GLenum target, GLuint index, const GLfloat * params);
extern HIDDEN void __indirect_glGetProgramEnvParameterdvARB(GLenum target, GLuint index, GLdouble * params);
extern HIDDEN void __indirect_glGetProgramEnvParameterfvARB(GLenum target, GLuint index, GLfloat * params);
extern HIDDEN void __indirect_glGetProgramLocalParameterdvARB(GLenum target, GLuint index, GLdouble * params);
extern HIDDEN void __indirect_glGetProgramLocalParameterfvARB(GLenum target, GLuint index, GLfloat * params);
extern HIDDEN void __indirect_glGetProgramivARB(GLenum target, GLenum pname, GLint * params);
extern HIDDEN void __indirect_glGetProgramStringARB(GLenum target, GLenum pname, GLvoid * string);
extern HIDDEN void __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern HIDDEN void __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern HIDDEN void __indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v);
extern HIDDEN void __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v);
extern HIDDEN void __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params);
extern HIDDEN void __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params);
extern HIDDEN void __indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble * params);
extern HIDDEN void __indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat * params);
extern HIDDEN void __indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params);
extern HIDDEN void __indirect_glVertexAttrib1dNV(GLuint index, GLdouble x);
extern HIDDEN void __indirect_glVertexAttrib1dvNV(GLuint index, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttrib1fNV(GLuint index, GLfloat x);
extern HIDDEN void __indirect_glVertexAttrib1fvNV(GLuint index, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttrib1sNV(GLuint index, GLshort x);
extern HIDDEN void __indirect_glVertexAttrib1svNV(GLuint index, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y);
extern HIDDEN void __indirect_glVertexAttrib2dvNV(GLuint index, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y);
extern HIDDEN void __indirect_glVertexAttrib2fvNV(GLuint index, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttrib2sNV(GLuint index, GLshort x, GLshort y);
extern HIDDEN void __indirect_glVertexAttrib2svNV(GLuint index, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z);
extern HIDDEN void __indirect_glVertexAttrib3dvNV(GLuint index, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z);
extern HIDDEN void __indirect_glVertexAttrib3fvNV(GLuint index, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z);
extern HIDDEN void __indirect_glVertexAttrib3svNV(GLuint index, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern HIDDEN void __indirect_glVertexAttrib4dvNV(GLuint index, const GLdouble * v);
extern HIDDEN void __indirect_glVertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern HIDDEN void __indirect_glVertexAttrib4fvNV(GLuint index, const GLfloat * v);
extern HIDDEN void __indirect_glVertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
extern HIDDEN void __indirect_glVertexAttrib4svNV(GLuint index, const GLshort * v);
extern HIDDEN void __indirect_glVertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
extern HIDDEN void __indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte * v);

# undef HIDDEN
# undef FASTCALL

+ 150
- 0
src/glx/x11/indirect_init.c View File

@@ -589,6 +589,85 @@ __GLapi * __glXNewIndirectAPI( void )
glAPI->SecondaryColor3usvEXT = __indirect_glSecondaryColor3usvEXT;
glAPI->SecondaryColorPointerEXT = __indirect_glSecondaryColorPointerEXT;

/* GL_NV_vertex_program */

glAPI->AreProgramsResidentNV = __indirect_glAreProgramsResidentNV;
glAPI->BindProgramNV = __indirect_glBindProgramNV;
glAPI->DeleteProgramsNV = __indirect_glDeleteProgramsNV;
glAPI->ExecuteProgramNV = __indirect_glExecuteProgramNV;
glAPI->GenProgramsNV = __indirect_glGenProgramsNV;
glAPI->GetProgramParameterdvNV = __indirect_glGetProgramParameterdvNV;
glAPI->GetProgramParameterfvNV = __indirect_glGetProgramParameterfvNV;
glAPI->GetProgramivNV = __indirect_glGetProgramivNV;
glAPI->GetProgramStringNV = __indirect_glGetProgramStringNV;
glAPI->GetTrackMatrixivNV = __indirect_glGetTrackMatrixivNV;

/* GL_ARB_vertex_program */

glAPI->GetVertexAttribdvARB = __indirect_glGetVertexAttribdvARB;
glAPI->GetVertexAttribfvARB = __indirect_glGetVertexAttribfvARB;
glAPI->GetVertexAttribivARB = __indirect_glGetVertexAttribivARB;

/* GL_NV_vertex_program */

glAPI->GetVertexAttribPointervNV = __indirect_glGetVertexAttribPointervNV;
glAPI->IsProgramNV = __indirect_glIsProgramNV;
glAPI->LoadProgramNV = __indirect_glLoadProgramNV;
glAPI->ProgramParameter4dNV = __indirect_glProgramParameter4dNV;
glAPI->ProgramParameter4dvNV = __indirect_glProgramParameter4dvNV;
glAPI->ProgramParameter4fNV = __indirect_glProgramParameter4fNV;
glAPI->ProgramParameter4fvNV = __indirect_glProgramParameter4fvNV;
glAPI->ProgramParameters4dvNV = __indirect_glProgramParameters4dvNV;
glAPI->ProgramParameters4fvNV = __indirect_glProgramParameters4fvNV;
glAPI->RequestResidentProgramsNV = __indirect_glRequestResidentProgramsNV;
glAPI->TrackMatrixNV = __indirect_glTrackMatrixNV;
glAPI->VertexAttribPointerNV = __indirect_glVertexAttribPointerNV;

/* GL_ARB_vertex_program */

glAPI->VertexAttrib1dARB = __indirect_glVertexAttrib1dARB;
glAPI->VertexAttrib1dvARB = __indirect_glVertexAttrib1dvARB;
glAPI->VertexAttrib1fARB = __indirect_glVertexAttrib1fARB;
glAPI->VertexAttrib1fvARB = __indirect_glVertexAttrib1fvARB;
glAPI->VertexAttrib1sARB = __indirect_glVertexAttrib1sARB;
glAPI->VertexAttrib1svARB = __indirect_glVertexAttrib1svARB;
glAPI->VertexAttrib2dARB = __indirect_glVertexAttrib2dARB;
glAPI->VertexAttrib2dvARB = __indirect_glVertexAttrib2dvARB;
glAPI->VertexAttrib2fARB = __indirect_glVertexAttrib2fARB;
glAPI->VertexAttrib2fvARB = __indirect_glVertexAttrib2fvARB;
glAPI->VertexAttrib2sARB = __indirect_glVertexAttrib2sARB;
glAPI->VertexAttrib2svARB = __indirect_glVertexAttrib2svARB;
glAPI->VertexAttrib3dARB = __indirect_glVertexAttrib3dARB;
glAPI->VertexAttrib3dvARB = __indirect_glVertexAttrib3dvARB;
glAPI->VertexAttrib3fARB = __indirect_glVertexAttrib3fARB;
glAPI->VertexAttrib3fvARB = __indirect_glVertexAttrib3fvARB;
glAPI->VertexAttrib3sARB = __indirect_glVertexAttrib3sARB;
glAPI->VertexAttrib3svARB = __indirect_glVertexAttrib3svARB;
glAPI->VertexAttrib4dARB = __indirect_glVertexAttrib4dARB;
glAPI->VertexAttrib4dvARB = __indirect_glVertexAttrib4dvARB;
glAPI->VertexAttrib4fARB = __indirect_glVertexAttrib4fARB;
glAPI->VertexAttrib4fvARB = __indirect_glVertexAttrib4fvARB;
glAPI->VertexAttrib4sARB = __indirect_glVertexAttrib4sARB;
glAPI->VertexAttrib4svARB = __indirect_glVertexAttrib4svARB;
glAPI->VertexAttrib4NubARB = __indirect_glVertexAttrib4NubARB;
glAPI->VertexAttrib4NubvARB = __indirect_glVertexAttrib4NubvARB;

/* GL_NV_vertex_program */

glAPI->VertexAttribs1dvNV = __indirect_glVertexAttribs1dvNV;
glAPI->VertexAttribs1fvNV = __indirect_glVertexAttribs1fvNV;
glAPI->VertexAttribs1svNV = __indirect_glVertexAttribs1svNV;
glAPI->VertexAttribs2dvNV = __indirect_glVertexAttribs2dvNV;
glAPI->VertexAttribs2fvNV = __indirect_glVertexAttribs2fvNV;
glAPI->VertexAttribs2svNV = __indirect_glVertexAttribs2svNV;
glAPI->VertexAttribs3dvNV = __indirect_glVertexAttribs3dvNV;
glAPI->VertexAttribs3fvNV = __indirect_glVertexAttribs3fvNV;
glAPI->VertexAttribs3svNV = __indirect_glVertexAttribs3svNV;
glAPI->VertexAttribs4dvNV = __indirect_glVertexAttribs4dvNV;
glAPI->VertexAttribs4fvNV = __indirect_glVertexAttribs4fvNV;
glAPI->VertexAttribs4svNV = __indirect_glVertexAttribs4svNV;
glAPI->VertexAttribs4ubvNV = __indirect_glVertexAttribs4ubvNV;

/* GL_NV_point_sprite */

glAPI->PointParameteriNV = __indirect_glPointParameteriNV;
@@ -603,6 +682,77 @@ __GLapi * __glXNewIndirectAPI( void )

glAPI->ActiveStencilFaceEXT = __indirect_glActiveStencilFaceEXT;

/* GL_ARB_vertex_program */

glAPI->VertexAttrib4ivARB = __indirect_glVertexAttrib4ivARB;
glAPI->VertexAttrib4ubvARB = __indirect_glVertexAttrib4ubvARB;
glAPI->VertexAttrib4usvARB = __indirect_glVertexAttrib4usvARB;
glAPI->VertexAttrib4uivARB = __indirect_glVertexAttrib4uivARB;
glAPI->VertexAttrib4NbvARB = __indirect_glVertexAttrib4NbvARB;
glAPI->VertexAttrib4NsvARB = __indirect_glVertexAttrib4NsvARB;
glAPI->VertexAttrib4NivARB = __indirect_glVertexAttrib4NivARB;
glAPI->VertexAttrib4NusvARB = __indirect_glVertexAttrib4NusvARB;
glAPI->VertexAttrib4NuivARB = __indirect_glVertexAttrib4NuivARB;
glAPI->VertexAttribPointerARB = __indirect_glVertexAttribPointerARB;
glAPI->EnableVertexAttribArrayARB = __indirect_glEnableVertexAttribArrayARB;
glAPI->DisableVertexAttribArrayARB = __indirect_glDisableVertexAttribArrayARB;
glAPI->ProgramStringARB = __indirect_glProgramStringARB;
glAPI->ProgramEnvParameter4dARB = __indirect_glProgramEnvParameter4dARB;
glAPI->ProgramEnvParameter4dvARB = __indirect_glProgramEnvParameter4dvARB;
glAPI->ProgramEnvParameter4fARB = __indirect_glProgramEnvParameter4fARB;
glAPI->ProgramEnvParameter4fvARB = __indirect_glProgramEnvParameter4fvARB;
glAPI->ProgramLocalParameter4dARB = __indirect_glProgramLocalParameter4dARB;
glAPI->ProgramLocalParameter4dvARB = __indirect_glProgramLocalParameter4dvARB;
glAPI->ProgramLocalParameter4fARB = __indirect_glProgramLocalParameter4fARB;
glAPI->ProgramLocalParameter4fvARB = __indirect_glProgramLocalParameter4fvARB;
glAPI->GetProgramEnvParameterdvARB = __indirect_glGetProgramEnvParameterdvARB;
glAPI->GetProgramEnvParameterfvARB = __indirect_glGetProgramEnvParameterfvARB;
glAPI->GetProgramLocalParameterdvARB = __indirect_glGetProgramLocalParameterdvARB;
glAPI->GetProgramLocalParameterfvARB = __indirect_glGetProgramLocalParameterfvARB;
glAPI->GetProgramivARB = __indirect_glGetProgramivARB;
glAPI->GetProgramStringARB = __indirect_glGetProgramStringARB;

/* GL_NV_fragment_program */

glAPI->ProgramNamedParameter4fNV = __indirect_glProgramNamedParameter4fNV;
glAPI->ProgramNamedParameter4dNV = __indirect_glProgramNamedParameter4dNV;
glAPI->ProgramNamedParameter4fvNV = __indirect_glProgramNamedParameter4fvNV;
glAPI->ProgramNamedParameter4dvNV = __indirect_glProgramNamedParameter4dvNV;
glAPI->GetProgramNamedParameterfvNV = __indirect_glGetProgramNamedParameterfvNV;
glAPI->GetProgramNamedParameterdvNV = __indirect_glGetProgramNamedParameterdvNV;

/* GL_NV_vertex_program */

glAPI->GetVertexAttribdvNV = __indirect_glGetVertexAttribdvNV;
glAPI->GetVertexAttribfvNV = __indirect_glGetVertexAttribfvNV;
glAPI->GetVertexAttribivNV = __indirect_glGetVertexAttribivNV;
glAPI->VertexAttrib1dNV = __indirect_glVertexAttrib1dNV;
glAPI->VertexAttrib1dvNV = __indirect_glVertexAttrib1dvNV;
glAPI->VertexAttrib1fNV = __indirect_glVertexAttrib1fNV;
glAPI->VertexAttrib1fvNV = __indirect_glVertexAttrib1fvNV;
glAPI->VertexAttrib1sNV = __indirect_glVertexAttrib1sNV;
glAPI->VertexAttrib1svNV = __indirect_glVertexAttrib1svNV;
glAPI->VertexAttrib2dNV = __indirect_glVertexAttrib2dNV;
glAPI->VertexAttrib2dvNV = __indirect_glVertexAttrib2dvNV;
glAPI->VertexAttrib2fNV = __indirect_glVertexAttrib2fNV;
glAPI->VertexAttrib2fvNV = __indirect_glVertexAttrib2fvNV;
glAPI->VertexAttrib2sNV = __indirect_glVertexAttrib2sNV;
glAPI->VertexAttrib2svNV = __indirect_glVertexAttrib2svNV;
glAPI->VertexAttrib3dNV = __indirect_glVertexAttrib3dNV;
glAPI->VertexAttrib3dvNV = __indirect_glVertexAttrib3dvNV;
glAPI->VertexAttrib3fNV = __indirect_glVertexAttrib3fNV;
glAPI->VertexAttrib3fvNV = __indirect_glVertexAttrib3fvNV;
glAPI->VertexAttrib3sNV = __indirect_glVertexAttrib3sNV;
glAPI->VertexAttrib3svNV = __indirect_glVertexAttrib3svNV;
glAPI->VertexAttrib4dNV = __indirect_glVertexAttrib4dNV;
glAPI->VertexAttrib4dvNV = __indirect_glVertexAttrib4dvNV;
glAPI->VertexAttrib4fNV = __indirect_glVertexAttrib4fNV;
glAPI->VertexAttrib4fvNV = __indirect_glVertexAttrib4fvNV;
glAPI->VertexAttrib4sNV = __indirect_glVertexAttrib4sNV;
glAPI->VertexAttrib4svNV = __indirect_glVertexAttrib4svNV;
glAPI->VertexAttrib4ubNV = __indirect_glVertexAttrib4ubNV;
glAPI->VertexAttrib4ubvNV = __indirect_glVertexAttrib4ubvNV;

return glAPI;
}


+ 209
- 7
src/glx/x11/indirect_vertex_array.c View File

@@ -103,6 +103,12 @@ struct array_state {
*/
GLint count;

/**
* "Normalized" data is on the range [0,1] (unsigned) or [-1,1] (signed).
* This is used for mapping integral types to floating point types.
*/
GLboolean normalized;

/**
* Pre-calculated GLX protocol command header.
*/
@@ -296,6 +302,14 @@ struct array_state_vector {
*/
unsigned num_texture_units;

/**
* Number of generic vertex program attribs. If GL_ARB_vertex_program
* is not supported, this will be zero. Otherwise it will be the value
* queries by calling \c glGetProgramiv with \c GL_VERTEX_PROGRAM_ARB
* and \c GL_MAX_PROGRAM_ATTRIBS_ARB.
*/
unsigned num_vertex_program_attribs;

/**
* \n Methods for implementing various GL functions.
*
@@ -337,8 +351,8 @@ static GLubyte * emit_element_old( GLubyte * dst,
static struct array_state * get_array_entry(
const struct array_state_vector * arrays, GLenum key, unsigned index );
static void fill_array_info_cache( struct array_state_vector * arrays );
static GLboolean glx_validate_array_args(__GLXcontext *gc, GLenum mode,
GLsizei count);
static GLboolean validate_mode(__GLXcontext *gc, GLenum mode);
static GLboolean validate_count(__GLXcontext *gc, GLsizei count);


/**
@@ -380,6 +394,8 @@ __glXInitVertexArrayState( __GLXcontext * gc )
unsigned array_count;
unsigned texture_units = 1;
unsigned i;
unsigned j;
unsigned vertex_program_attribs;

GLboolean got_fog = GL_FALSE;
GLboolean got_secondary_color = GL_FALSE;
@@ -432,8 +448,14 @@ __glXInitVertexArrayState( __GLXcontext * gc )
texture_units = 1;
}

if ( __glExtensionBitIsEnabled( gc, GL_ARB_vertex_program_bit ) ) {
glGetProgramivARB( GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ATTRIBS_ARB,
& vertex_program_attribs );
}

arrays->num_texture_units = texture_units;
array_count += texture_units;
arrays->num_vertex_program_attribs = vertex_program_attribs;
array_count += texture_units + vertex_program_attribs;
arrays->num_arrays = array_count;
arrays->arrays = malloc( sizeof( struct array_state ) * array_count );
@@ -444,11 +466,13 @@ __glXInitVertexArrayState( __GLXcontext * gc )
arrays->arrays[0].data_type = GL_FLOAT;
arrays->arrays[0].count = 3;
arrays->arrays[0].key = GL_NORMAL_ARRAY;
arrays->arrays[0].normalized = GL_TRUE;
arrays->arrays[0].old_DrawArrays_possible = GL_TRUE;

arrays->arrays[1].data_type = GL_FLOAT;
arrays->arrays[1].count = 4;
arrays->arrays[1].key = GL_COLOR_ARRAY;
arrays->arrays[1].normalized = GL_TRUE;
arrays->arrays[1].old_DrawArrays_possible = GL_TRUE;

arrays->arrays[2].data_type = GL_FLOAT;
@@ -465,7 +489,7 @@ __glXInitVertexArrayState( __GLXcontext * gc )
arrays->arrays[4 + i].data_type = GL_FLOAT;
arrays->arrays[4 + i].count = 4;
arrays->arrays[4 + i].key = GL_TEXTURE_COORD_ARRAY;
arrays->arrays[4 + i].old_DrawArrays_possible = (i == 0);
arrays->arrays[4 + i].index = i;

@@ -487,10 +511,28 @@ __glXInitVertexArrayState( __GLXcontext * gc )
arrays->arrays[i].count = 3;
arrays->arrays[i].key = GL_SECONDARY_COLOR_ARRAY;
arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
arrays->arrays[i].normalized = GL_TRUE;
i++;
}


for ( j = 0 ; j < vertex_program_attribs ; j++ ) {
const unsigned idx = (vertex_program_attribs - (j + 1));


arrays->arrays[idx + i].data_type = GL_FLOAT;
arrays->arrays[idx + i].count = 4;
arrays->arrays[idx + i].key = GL_VERTEX_ATTRIB_ARRAY_POINTER;

arrays->arrays[idx + i].old_DrawArrays_possible = 0;
arrays->arrays[idx + i].index = idx;

arrays->arrays[idx + i].header[1] = idx;
}

i += vertex_program_attribs;


/* Vertex array *must* be last becuase of the way that
* emit_DrawArrays_none works.
*/
@@ -521,8 +563,7 @@ calculate_single_vertex_size_none( const struct array_state_vector * arrays )

for ( i = 0 ; i < arrays->num_arrays ; i++ ) {
if ( arrays->arrays[i].enabled ) {
single_vertex_size += __GLX_PAD(arrays->arrays[i].element_size)
+ arrays->arrays[i].header_size;
single_vertex_size += ((uint16_t *)arrays->arrays[i].header)[0];
}
}
@@ -545,6 +586,15 @@ emit_element_none( GLubyte * dst,
if ( arrays->arrays[i].enabled ) {
const size_t offset = index * arrays->arrays[i].true_stride;

/* The generic attributes can have more data than is in the
* elements. This is because a vertex array can be a 2 element,
* normalized, unsigned short, but the "closest" immediate mode
* protocol is for a 4Nus. Since the sizes are small, the
* performance impact on modern processors should be negligible.
*/
(void) memset( dst, 0,
((uint16_t *)arrays->arrays[i].header)[0] );

(void) memcpy( dst, arrays->arrays[i].header,
arrays->arrays[i].header_size );

@@ -1635,6 +1685,139 @@ void __indirect_glFogCoordPointerEXT( GLenum type, GLsizei stride,
}


void __indirect_glVertexAttribPointerARB(GLuint index, GLint size,
GLenum type, GLboolean normalized,
GLsizei stride,
const GLvoid * pointer)
{
static const uint16_t short_ops[5] = { 0, 4189, 4190, 4191, 4192 };
static const uint16_t float_ops[5] = { 0, 4193, 4194, 4195, 4196 };
static const uint16_t double_ops[5] = { 0, 4197, 4198, 4199, 4200 };

uint16_t opcode;
__GLXcontext *gc = __glXGetCurrentContext();
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
struct array_state_vector * arrays = state->array_state;
struct array_state * a;
unsigned true_immediate_count;
unsigned true_immediate_size;


if ( (size < 1) || (size > 4) || (stride < 0)
|| (index > arrays->num_vertex_program_attribs) ){
__glXSetError(gc, GL_INVALID_VALUE);
return;
}

if ( normalized && (type != GL_FLOAT) && (type != GL_DOUBLE)) {
switch( type ) {
case GL_BYTE: opcode = X_GLrop_VertexAttrib4NbvARB; break;
case GL_UNSIGNED_BYTE: opcode = X_GLrop_VertexAttrib4NubvARB; break;
case GL_SHORT: opcode = X_GLrop_VertexAttrib4NsvARB; break;
case GL_UNSIGNED_SHORT: opcode = X_GLrop_VertexAttrib4NusvARB; break;
case GL_INT: opcode = X_GLrop_VertexAttrib4NivARB; break;
case GL_UNSIGNED_INT: opcode = X_GLrop_VertexAttrib4NuivARB; break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
true_immediate_count = 4;
}
else {
switch( type ) {
case GL_BYTE:
opcode = X_GLrop_VertexAttrib4bvARB;
true_immediate_count = 4;
break;
case GL_UNSIGNED_BYTE:
opcode = X_GLrop_VertexAttrib4ubvARB;
true_immediate_count = 4;
break;
case GL_SHORT:
opcode = short_ops[size];
break;
case GL_UNSIGNED_SHORT:
opcode = X_GLrop_VertexAttrib4usvARB;
true_immediate_count = 4;
break;
case GL_INT:
opcode = X_GLrop_VertexAttrib4ivARB;
true_immediate_count = 4;
break;
case GL_UNSIGNED_INT:
opcode = X_GLrop_VertexAttrib4uivARB;
true_immediate_count = 4;
break;
case GL_FLOAT:
opcode = float_ops[size];
break;
case GL_DOUBLE:
opcode = double_ops[size];
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
}

a = get_array_entry( arrays, GL_VERTEX_ATTRIB_ARRAY_POINTER, index );
if ( a == NULL ) {
__glXSetError(gc, GL_INVALID_OPERATION);
return;
}

COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, 8, opcode );

true_immediate_size = __glXTypeSize(type) * true_immediate_count;
((uint16_t *) (a)->header)[0] = __GLX_PAD(a->header_size
+ true_immediate_size);

if ( a->enabled ) {
arrays->array_info_cache_valid = GL_FALSE;
}
}


/**
* I don't have 100% confidence that this is correct. The different rules
* about whether or not generic vertex attributes alias "classic" vertex
* attributes (i.e., attrib1 ?= primary color) between ARB_vertex_program,
* ARB_vertex_shader, and NV_vertex_program are a bit confusing. My
* feeling is that the client-side doesn't have to worry about it. The
* client just sends all the data to the server and lets the server deal
* with it.
*/
void __indirect_glVertexAttribPointerNV( GLuint index, GLint size,
GLenum type, GLsizei stride,
const GLvoid * pointer)
{
__GLXcontext *gc = __glXGetCurrentContext();
GLboolean normalized = GL_FALSE;


switch( type ) {
case GL_UNSIGNED_BYTE:
if ( size != 4 ) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
normalized = GL_TRUE;

case GL_SHORT:
case GL_FLOAT:
case GL_DOUBLE:
__indirect_glVertexAttribPointerARB(index, size, type,
normalized,
stride, pointer);
return;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
}


void __indirect_glClientActiveTextureARB(GLenum texture)
{
__GLXcontext * const gc = __glXGetCurrentContext();
@@ -1776,7 +1959,26 @@ __glXGetArrayPointer( const __GLXattribute * const state,


if ( a != NULL ) {
*dest = a->data;
*dest = (void *) (a->data);
}

return (a != NULL);
}


/**
*/
GLboolean
__glXGetArrayNormalized( const __GLXattribute * const state,
GLenum key, unsigned index, GLintptr * dest )
{
const struct array_state_vector * arrays = state->array_state;
const struct array_state * a = get_array_entry( (struct array_state_vector *) arrays,
key, index );


if ( a != NULL ) {
*dest = (GLintptr) a->normalized;
}

return (a != NULL);

+ 2
- 0
src/glx/x11/indirect_vertex_array.h View File

@@ -46,6 +46,8 @@ extern GLboolean __glXGetArrayStride( const __GLXattribute * const state,
GLenum key, unsigned index, GLintptr * dest );
extern GLboolean __glXGetArrayPointer( const __GLXattribute * const state,
GLenum key, unsigned index, void ** dest );
extern GLboolean __glXGetArrayNormalized( const __GLXattribute * const state,
GLenum key, unsigned index, GLintptr * dest );

extern void __glXPushArrayState( __GLXattribute * state );
extern void __glXPopArrayState( __GLXattribute * state );

+ 272
- 0
src/glx/x11/indirect_vertex_program.c View File

@@ -0,0 +1,272 @@
/*
* (C) Copyright IBM Corporation 2005
* All Rights Reserved.
*
* 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, sub license,
* 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* IBM,
* AND/OR THEIR SUPPLIERS 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 <inttypes.h>
#include <GL/gl.h>
#include "indirect.h"
#include "glxclient.h"
#include "indirect_vertex_array.h"
#include <GL/glxproto.h>

void do_vertex_attrib_enable( GLuint index, GLboolean val )
{
__GLXcontext *gc = __glXGetCurrentContext();
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);

if ( ! __glXSetArrayEnable( state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
index, val ) ) {
__glXSetError(gc, GL_INVALID_ENUM);
}
}


void __indirect_glEnableVertexAttribArrayARB( GLuint index )
{
do_vertex_attrib_enable( index, GL_TRUE );
}


void __indirect_glDisableVertexAttribArrayARB( GLuint index )
{
do_vertex_attrib_enable( index, GL_FALSE );
}


static void
get_parameter( unsigned opcode, unsigned size, GLenum target, GLuint index,
GLfloat * params )
{
__GLXcontext * const gc = __glXGetCurrentContext();
Display * const dpy = gc->currentDpy;
const GLuint cmdlen = 12;

if (__builtin_expect(dpy != NULL, 1)) {
GLubyte const * pc = __glXSetupVendorRequest(gc,
X_GLXVendorPrivateWithReply,
opcode, cmdlen);

*((GLenum *)(pc + 0)) = target;
*((GLuint *)(pc + 4)) = index;
*((GLuint *)(pc + 8)) = 0;

(void) __glXReadReply(dpy, size, params, GL_FALSE);
UnlockDisplay(dpy); SyncHandle();
}
return;
}


void __indirect_glGetProgramEnvParameterfvARB( GLenum target, GLuint index,
GLfloat * params )
{
get_parameter( 1296, 4, target, index, params );
}


void __indirect_glGetProgramEnvParameterdvARB( GLenum target, GLuint index,
GLdouble * params )
{
get_parameter( 1297, 8, target, index, params );
}


void __indirect_glGetProgramLocalParameterfvARB( GLenum target, GLuint index,
GLfloat * params )
{
get_parameter( 1305, 4, target, index, params );
}


void __indirect_glGetProgramLocalParameterdvARB( GLenum target, GLuint index,
GLdouble * params )
{
get_parameter( 1306, 8, target, index, params );
}


void __indirect_glGetVertexAttribPointervNV( GLuint index, GLenum pname,
GLvoid ** pointer )
{
__GLXcontext * const gc = __glXGetCurrentContext();
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
if ( pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB ) {
__glXSetError( gc, GL_INVALID_ENUM );
}
if ( ! __glXGetArrayPointer( state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
index, pointer ) ) {
__glXSetError( gc, GL_INVALID_VALUE );
}
}


/**
* Get the selected attribute from the vertex array state vector.
*
* \returns
* On success \c GL_TRUE is returned. Otherwise, \c GL_FALSE is returned.
*/
static GLboolean
get_attrib_array_data( __GLXattribute * state, GLuint index, GLenum cap,
GLintptr * data )
{
GLboolean retval = GL_FALSE;
const GLenum attrib = GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB;

switch( cap ) {
case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
retval = __glXGetArrayEnable( state, attrib, index, data );
break;

case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
retval = __glXGetArraySize( state, attrib, index, data );
break;

case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
retval = __glXGetArrayStride( state, attrib, index, data );
break;

case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
retval = __glXGetArrayType( state, attrib, index, data );
break;

case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
retval = __glXGetArrayNormalized( state, attrib, index, data );
break;
}

return retval;
}


static void get_vertex_attrib( __GLXcontext * gc, unsigned vop,
GLuint index, GLenum pname,
xReply * reply )
{
Display * const dpy = gc->currentDpy;
GLubyte * const pc = __glXSetupVendorRequest(gc,
X_GLXVendorPrivateWithReply,
vop, 8);
*((uint32_t *)(pc + 0)) = index;
*((uint32_t *)(pc + 4)) = pname;

(void) _XReply( dpy, reply, 0, False );
}


void __indirect_glGetVertexAttribivARB( GLuint index, GLenum pname,
GLint * params )
{
__GLXcontext * const gc = __glXGetCurrentContext();
Display * const dpy = gc->currentDpy;
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
xGLXSingleReply reply;


get_vertex_attrib( gc, 1303, index, pname, (xReply *) & reply );

if ( reply.size != 0 ) {
if ( ! get_attrib_array_data( state, index, pname, params ) ) {
if (reply.size == 1) {
*params = (GLint) reply.pad3;
}
else {
_XRead(dpy, (void *) params, 4 * reply.size);
}
}
}

UnlockDisplay(dpy);
SyncHandle();
}


void __indirect_glGetVertexAttribfvARB( GLuint index, GLenum pname,
GLfloat * params )
{
__GLXcontext * const gc = __glXGetCurrentContext();
Display * const dpy = gc->currentDpy;
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
xGLXSingleReply reply;


get_vertex_attrib( gc, 1302, index, pname, (xReply *) & reply );

if ( reply.size != 0 ) {
GLintptr data;


if ( get_attrib_array_data( state, index, pname, & data ) ) {
*params = (GLfloat) data;
}
else {
if (reply.size == 1) {
(void) memcpy( params, & reply.pad3, sizeof( GLfloat ) );
}
else {
_XRead(dpy, (void *) params, 4 * reply.size);
}
}
}

UnlockDisplay(dpy);
SyncHandle();
}


void __indirect_glGetVertexAttribdvARB( GLuint index, GLenum pname,
GLdouble * params )
{
__GLXcontext * const gc = __glXGetCurrentContext();
Display * const dpy = gc->currentDpy;
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
xGLXSingleReply reply;


get_vertex_attrib( gc, 1301, index, pname, (xReply *) & reply );

if ( reply.size != 0 ) {
GLintptr data;


if ( get_attrib_array_data( state, index, pname, & data ) ) {
*params = (GLdouble) data;
}
else {
if (reply.size == 1) {
(void) memcpy( params, & reply.pad3, sizeof( GLdouble ) );
}
else {
_XRead(dpy, (void *) params, 8 * reply.size);
}
}
}

UnlockDisplay(dpy);
SyncHandle();
}

+ 481
- 333
src/mesa/glapi/gl_API.xml
File diff suppressed because it is too large
View File


Loading…
Cancel
Save