/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.3
*
- * Copyright (C) 1999-2005 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"),
#include "fbobject.h"
#include "texrender.h"
#endif
+#include "shader_api.h"
#include "arrayobj.h"
#include "driverfuncs.h"
driver->EndList = NULL;
driver->BeginCallList = NULL;
driver->EndCallList = NULL;
+
+
+ /* XXX temporary here */
+ _mesa_init_glsl_driver_functions(driver);
+}
+
+
+/**
+ * Plug in Mesa's GLSL functions.
+ */
+void
+_mesa_init_glsl_driver_functions(struct dd_function_table *driver)
+{
+ driver->AttachShader = _mesa_attach_shader;
+ driver->BindAttribLocation = _mesa_bind_attrib_location;
+ driver->CompileShader = _mesa_compile_shader;
+ driver->CreateProgram = _mesa_create_program;
+ driver->CreateShader = _mesa_create_shader;
+ driver->DeleteProgram2 = _mesa_delete_program2;
+ driver->DeleteShader = _mesa_delete_shader;
+ driver->DetachShader = _mesa_detach_shader;
+ driver->GetActiveAttrib = _mesa_get_active_attrib;
+ driver->GetActiveUniform = _mesa_get_active_uniform;
+ driver->GetAttachedShaders = _mesa_get_attached_shaders;
+ driver->GetAttribLocation = _mesa_get_attrib_location;
+ driver->GetHandle = _mesa_get_handle;
+ driver->GetProgramiv = _mesa_get_programiv;
+ driver->GetProgramInfoLog = _mesa_get_program_info_log;
+ driver->GetShaderiv = _mesa_get_shaderiv;
+ driver->GetShaderInfoLog = _mesa_get_shader_info_log;
+ driver->GetShaderSource = _mesa_get_shader_source;
+ driver->GetUniformfv = _mesa_get_uniformfv;
+ driver->GetUniformLocation = _mesa_get_uniform_location;
+ driver->IsProgram = _mesa_is_program;
+ driver->IsShader = _mesa_is_shader;
+ driver->LinkProgram = _mesa_link_program;
+ driver->ShaderSource = _mesa_shader_source;
+ driver->Uniform = _mesa_uniform;
+ driver->UniformMatrix = _mesa_uniform_matrix;
+ driver->UseProgram = _mesa_use_program;
+ driver->ValidateProgram = _mesa_validate_program;
}
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5.3
*
- * Copyright (C) 1999-2004 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"),
extern void
_mesa_init_driver_functions(struct dd_function_table *driver);
+
+extern void
+_mesa_init_glsl_driver_functions(struct dd_function_table *driver);
+
#endif
#include "math/m_xform.h"
#include "math/mathmod.h"
#endif
-#include "shaderobjects.h"
+#include "shaders.h"
#ifdef USE_SPARC_ASM
#include "sparc/sparc.h"
ss->ArrayObjects = _mesa_NewHashTable();
#if FEATURE_ARB_shader_objects
- ss->GL2Objects = _mesa_NewHashTable ();
ss->ShaderObjects = _mesa_NewHashTable();
ss->ProgramObjects = _mesa_NewHashTable();
#endif
_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
_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
_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 );
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
/*
* 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"),
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;
};
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;
};
#endif
#if FEATURE_ARB_shader_objects
- struct _mesa_HashTable *GL2Objects;
struct _mesa_HashTable *ShaderObjects;
struct _mesa_HashTable *ProgramObjects;
#endif
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
#include "texenvprogram.h"
#endif
#if FEATURE_ARB_shader_objects
-#include "shaderobjects.h"
+#include "shaders.h"
#endif
#include "debug.h"
#include "dispatch.h"
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. */
#include "texenvprogram.h"
#include "mtypes.h"
#include "math/m_xform.h"
-#include "shaderobjects.h"
+/*#include "shaderobjects.h"*/
main/rastpos.c \
main/rbadaptors.c \
main/renderbuffer.c \
+ main/shaders.c \
main/state.c \
main/stencil.c \
main/texcompress.c \
shader/programopt.c \
shader/shader_api.c \
-
-## shader/shaderobjects.c \
-## shader/shaderobjects_3dlabs.c
-
SLANG_SOURCES = \
shader/slang/slang_analyse.c \
shader/slang/slang_assemble.c \
rasterMask |= FRAGPROG_BIT;
}
- if (ctx->ShaderObjects._FragmentShaderPresent) {
+ if (ctx->Shader._FragmentShaderPresent) {
rasterMask |= FRAGPROG_BIT;
}
if (span->interpMask & SPAN_Z)
_swrast_span_interpolate_z (ctx, span);
- if (ctx->ShaderObjects.Linked && span->interpMask & SPAN_VARYING)
+ if (ctx->Shader.CurrentProgram && span->interpMask & SPAN_VARYING)
interpolate_varying(ctx, span);
/* Run fragment program/shader now */