diff options
author | Brian <[email protected]> | 2006-12-19 18:02:41 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2006-12-19 18:02:41 -0700 |
commit | 0bf5dbe002a64e198f55724cc1542602c012490f (patch) | |
tree | 06ef50fd181c0985562797197db244fadea893c5 /src/mesa/main | |
parent | 5b01c5e9d2c0283cc31981b6c85dc6392144b3db (diff) |
Overhaul of GLSL API functions, dispatching, etc.
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/context.c | 17 | ||||
-rw-r--r-- | src/mesa/main/dd.h | 52 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 22 | ||||
-rw-r--r-- | src/mesa/main/state.c | 4 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 2 |
5 files changed, 77 insertions, 20 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 4986b29ef0c..c5220b5b2eb 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -131,7 +131,7 @@ #include "math/m_xform.h" #include "math/mathmod.h" #endif -#include "shaderobjects.h" +#include "shaders.h" #ifdef USE_SPARC_ASM #include "sparc/sparc.h" @@ -705,7 +705,6 @@ alloc_shared_state( GLcontext *ctx ) ss->ArrayObjects = _mesa_NewHashTable(); #if FEATURE_ARB_shader_objects - ss->GL2Objects = _mesa_NewHashTable (); ss->ShaderObjects = _mesa_NewHashTable(); ss->ProgramObjects = _mesa_NewHashTable(); #endif @@ -784,11 +783,10 @@ alloc_shared_state( GLcontext *ctx ) _mesa_DeleteHashTable (ss->ArrayObjects); #if FEATURE_ARB_shader_objects - if (ss->GL2Objects) { - _mesa_DeleteHashTable (ss->GL2Objects); + if (ss->ShaderObjects) _mesa_DeleteHashTable (ss->ShaderObjects); + if (ss->ProgramObjects) _mesa_DeleteHashTable (ss->ProgramObjects); - } #endif #if FEATURE_EXT_framebuffer_object @@ -953,8 +951,11 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_DeleteHashTable(ss->ArrayObjects); #if FEATURE_ARB_shader_objects - _mesa_HashDeleteAll(ss->GL2Objects, delete_shaderobj_cb, ctx); - _mesa_DeleteHashTable(ss->GL2Objects); + /* XXX SLANG TO-DO */ + /* + struct _mesa_HashTable *ShaderObjects; + struct _mesa_HashTable *ProgramObjects; + */ #endif #if FEATURE_EXT_framebuffer_object @@ -1202,7 +1203,7 @@ init_attrib_groups( GLcontext *ctx ) _mesa_init_query( ctx ); _mesa_init_rastpos( ctx ); _mesa_init_scissor( ctx ); - _mesa_init_shaderobjects (ctx); + _mesa_init_shader_state( ctx ); _mesa_init_stencil( ctx ); _mesa_init_transform( ctx ); _mesa_init_varray( ctx ); diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 1de2542bee2..90c1f69c3d1 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -821,6 +821,58 @@ struct dd_function_table { void (*BindArrayObject)(GLcontext *ctx, struct gl_array_object *obj); /*@}*/ + /** + * \name GLSL-related functions (ARB extensions and OpenGL 2.x) + */ + /*@{*/ + void (*AttachShader)(GLcontext *ctx, GLuint program, GLuint shader); + void (*BindAttribLocation)(GLcontext *ctx, GLuint program, GLuint index, + const GLcharARB *name); + void (*CompileShader)(GLcontext *ctx, GLuint shader); + GLuint (*CreateShader)(GLcontext *ctx, GLenum type); + GLuint (*CreateProgram)(GLcontext *ctx); + void (*DeleteProgram2)(GLcontext *ctx, GLuint program); + void (*DeleteShader)(GLcontext *ctx, GLuint shader); + void (*DetachShader)(GLcontext *ctx, GLuint program, GLuint shader); + void (*GetActiveAttrib)(GLcontext *ctx, GLuint program, GLuint index, + GLsizei maxLength, GLsizei * length, GLint * size, + GLenum * type, GLcharARB * name); + void (*GetActiveUniform)(GLcontext *ctx, GLuint program, GLuint index, + GLsizei maxLength, GLsizei *length, GLint *size, + GLenum *type, GLcharARB *name); + void (*GetAttachedShaders)(GLcontext *ctx, GLuint program, GLsizei maxCount, + GLsizei *count, GLuint *obj); + GLint (*GetAttribLocation)(GLcontext *ctx, GLuint program, + const GLcharARB *name); + GLuint (*GetHandle)(GLcontext *ctx, GLenum pname); + void (*GetProgramiv)(GLcontext *ctx, GLuint program, + GLenum pname, GLint *params); + void (*GetProgramInfoLog)(GLcontext *ctx, GLuint program, GLsizei bufSize, + GLsizei *length, GLchar *infoLog); + void (*GetShaderiv)(GLcontext *ctx, GLuint shader, + GLenum pname, GLint *params); + void (*GetShaderInfoLog)(GLcontext *ctx, GLuint shader, GLsizei bufSize, + GLsizei *length, GLchar *infoLog); + void (*GetShaderSource)(GLcontext *ctx, GLuint shader, GLsizei maxLength, + GLsizei *length, GLcharARB *sourceOut); + void (*GetUniformfv)(GLcontext *ctx, GLuint program, GLint location, + GLfloat *params); + GLint (*GetUniformLocation)(GLcontext *ctx, GLuint program, + const GLcharARB *name); + GLboolean (*IsProgram)(GLcontext *ctx, GLuint name); + GLboolean (*IsShader)(GLcontext *ctx, GLuint name); + void (*LinkProgram)(GLcontext *ctx, GLuint program); + void (*ShaderSource)(GLcontext *ctx, GLuint shader, const GLchar *source); + void (*Uniform)(GLcontext *ctx, GLint location, GLsizei count, + const GLvoid *values, GLenum type); + void (*UniformMatrix)(GLcontext *ctx, GLint cols, GLint rows, + GLenum matrixType, GLint location, GLsizei count, + GLboolean transpose, const GLfloat *values); + void (*UseProgram)(GLcontext *ctx, GLuint program); + void (*ValidateProgram)(GLcontext *ctx, GLuint program); + /* XXX many more to come */ + /*@}*/ + /** * \name Support for multiple T&L engines diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 5ed95ccf656..4a8f7d22e30 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -7,9 +7,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul 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"), @@ -2052,8 +2052,10 @@ struct gl_shader GLuint Name; /**< AKA the handle */ GLchar *Source; /**< Source code string */ GLboolean CompileStatus; + GLboolean DeletePending; GLuint NumPrograms; /**< size of Programs[] array */ struct gl_program **Programs; /**< Post-compile assembly code */ + GLchar *InfoLog; }; @@ -2070,21 +2072,24 @@ struct gl_linked_program struct gl_program **Shaders; /**< List of the shaders */ struct gl_vertex_program *VertexProgram; /**< Linked vertex program */ struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */ - GLboolean LinkStatus; /**< GL_LINK_STATUS */ struct gl_program_parameter_list *Uniforms; /**< Plus constants, etc */ struct gl_program_parameter_list *Varying; + struct gl_program_parameter_list *Attributes; /**< Vertex attributes */ + GLboolean LinkStatus; /**< GL_LINK_STATUS */ + GLboolean Validated; + GLboolean DeletePending; + GLchar *InfoLog; }; /** - * Context state for vertex/fragment shaders. + * Context state for GLSL vertex/fragment shaders. */ -struct gl_shader_objects_state +struct gl_shader_state { - struct gl2_program_intf **CurrentProgram; GLboolean _VertexShaderPresent; GLboolean _FragmentShaderPresent; - struct gl_linked_program *Linked; /* XXX temporary here */ + struct gl_linked_program *CurrentProgram; }; @@ -2145,7 +2150,6 @@ struct gl_shared_state #endif #if FEATURE_ARB_shader_objects - struct _mesa_HashTable *GL2Objects; struct _mesa_HashTable *ShaderObjects; struct _mesa_HashTable *ProgramObjects; #endif @@ -2966,7 +2970,7 @@ struct __GLcontextRec struct gl_query_state Query; /**< GL_ARB_occlusion_query */ - struct gl_shader_objects_state ShaderObjects; /* GL_ARB_shader_objects */ + struct gl_shader_state Shader; /**< GLSL shader object state */ /*@}*/ #if FEATURE_EXT_framebuffer_object diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index e121f59258c..1d8666888ef 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -93,7 +93,7 @@ #include "texenvprogram.h" #endif #if FEATURE_ARB_shader_objects -#include "shaderobjects.h" +#include "shaders.h" #endif #include "debug.h" #include "dispatch.h" @@ -949,7 +949,7 @@ update_arrays( GLcontext *ctx ) static void update_program(GLcontext *ctx) { - const struct gl_linked_program *linked = ctx->ShaderObjects.Linked; + const struct gl_linked_program *linked = ctx->Shader.CurrentProgram; /* These _Enabled flags indicate if the program is enabled AND valid. */ diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index e379933a66e..e089de93104 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -41,7 +41,7 @@ #include "texenvprogram.h" #include "mtypes.h" #include "math/m_xform.h" -#include "shaderobjects.h" +/*#include "shaderobjects.h"*/ |