Clean-up and re-org of the main GLSL object types.
Use the gl_shader struct as it should be. Renamed gl_linked_program to gl_shader_program. Store both shaders and programs in the same hash table and use the Type field to distinguish them.
This commit is contained in:
@@ -706,7 +706,6 @@ alloc_shared_state( GLcontext *ctx )
|
|||||||
|
|
||||||
#if FEATURE_ARB_shader_objects
|
#if FEATURE_ARB_shader_objects
|
||||||
ss->ShaderObjects = _mesa_NewHashTable();
|
ss->ShaderObjects = _mesa_NewHashTable();
|
||||||
ss->ProgramObjects = _mesa_NewHashTable();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ss->Default1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D);
|
ss->Default1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D);
|
||||||
@@ -785,8 +784,6 @@ alloc_shared_state( GLcontext *ctx )
|
|||||||
#if FEATURE_ARB_shader_objects
|
#if FEATURE_ARB_shader_objects
|
||||||
if (ss->ShaderObjects)
|
if (ss->ShaderObjects)
|
||||||
_mesa_DeleteHashTable (ss->ShaderObjects);
|
_mesa_DeleteHashTable (ss->ShaderObjects);
|
||||||
if (ss->ProgramObjects)
|
|
||||||
_mesa_DeleteHashTable (ss->ProgramObjects);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FEATURE_EXT_framebuffer_object
|
#if FEATURE_EXT_framebuffer_object
|
||||||
|
@@ -44,6 +44,12 @@
|
|||||||
#include "bitset.h"
|
#include "bitset.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special, internal token
|
||||||
|
*/
|
||||||
|
#define GL_SHADER_PROGRAM 0x9999
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Color channel data type.
|
* Color channel data type.
|
||||||
*/
|
*/
|
||||||
@@ -2044,13 +2050,13 @@ struct gl_query_state
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A GLSL shader object
|
* A GLSL shader object
|
||||||
* A collection of one or more gl_programs...
|
|
||||||
*/
|
*/
|
||||||
struct gl_shader
|
struct gl_shader
|
||||||
{
|
{
|
||||||
GLenum Type; /**< GL_FRAGMENT_SHADER || GL_VERTEX_SHADER */
|
GLenum Type; /**< GL_FRAGMENT_SHADER || GL_VERTEX_SHADER (first field!) */
|
||||||
GLuint Name; /**< AKA the handle */
|
GLuint Name; /**< AKA the handle */
|
||||||
GLchar *Source; /**< Source code string */
|
GLint RefCount;
|
||||||
|
const GLchar *Source; /**< Source code string */
|
||||||
GLboolean CompileStatus;
|
GLboolean CompileStatus;
|
||||||
GLboolean DeletePending;
|
GLboolean DeletePending;
|
||||||
GLuint NumPrograms; /**< size of Programs[] array */
|
GLuint NumPrograms; /**< size of Programs[] array */
|
||||||
@@ -2061,15 +2067,14 @@ struct gl_shader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This corresponds to a GLSL "program" and is basically a linked collection
|
* This corresponds to a GLSL "program" and is basically a linked collection
|
||||||
* of "shaders" (which are Mesa gl_programs).
|
* of "shaders".
|
||||||
* Yes, the terminology is a bit confusing.
|
|
||||||
*/
|
*/
|
||||||
struct gl_linked_program
|
struct gl_shader_program
|
||||||
{
|
{
|
||||||
GLenum Type;
|
GLenum Type; /**< Always GL_SHADER_PROGRAM (internal token) */
|
||||||
GLuint Name; /**< aka handle or ID */
|
GLuint Name; /**< aka handle or ID */
|
||||||
GLuint NumShaders; /**< total number of shaders in this program */
|
GLuint NumShaders; /**< total number of shaders in this program */
|
||||||
struct gl_program **Shaders; /**< List of the shaders */
|
struct gl_shader **Shaders; /**< List of the shaders */
|
||||||
struct gl_vertex_program *VertexProgram; /**< Linked vertex program */
|
struct gl_vertex_program *VertexProgram; /**< Linked vertex program */
|
||||||
struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */
|
struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */
|
||||||
struct gl_program_parameter_list *Uniforms; /**< Plus constants, etc */
|
struct gl_program_parameter_list *Uniforms; /**< Plus constants, etc */
|
||||||
@@ -2089,7 +2094,7 @@ struct gl_shader_state
|
|||||||
{
|
{
|
||||||
GLboolean _VertexShaderPresent;
|
GLboolean _VertexShaderPresent;
|
||||||
GLboolean _FragmentShaderPresent;
|
GLboolean _FragmentShaderPresent;
|
||||||
struct gl_linked_program *CurrentProgram;
|
struct gl_shader_program *CurrentProgram;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -2150,8 +2155,8 @@ struct gl_shared_state
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FEATURE_ARB_shader_objects
|
#if FEATURE_ARB_shader_objects
|
||||||
|
/** Table of both gl_shader and gl_shader_program objects */
|
||||||
struct _mesa_HashTable *ShaderObjects;
|
struct _mesa_HashTable *ShaderObjects;
|
||||||
struct _mesa_HashTable *ProgramObjects;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FEATURE_EXT_framebuffer_object
|
#if FEATURE_EXT_framebuffer_object
|
||||||
|
@@ -949,8 +949,7 @@ update_arrays( GLcontext *ctx )
|
|||||||
static void
|
static void
|
||||||
update_program(GLcontext *ctx)
|
update_program(GLcontext *ctx)
|
||||||
{
|
{
|
||||||
const struct gl_linked_program *linked = ctx->Shader.CurrentProgram;
|
const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
|
||||||
|
|
||||||
|
|
||||||
/* These _Enabled flags indicate if the program is enabled AND valid. */
|
/* These _Enabled flags indicate if the program is enabled AND valid. */
|
||||||
ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
|
ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
|
||||||
@@ -973,10 +972,10 @@ update_program(GLcontext *ctx)
|
|||||||
|
|
||||||
ctx->FragmentProgram._Current = NULL;
|
ctx->FragmentProgram._Current = NULL;
|
||||||
|
|
||||||
if (linked && linked->LinkStatus) {
|
if (shProg && shProg->LinkStatus) {
|
||||||
/* Use shader programs */
|
/* Use shader programs */
|
||||||
ctx->VertexProgram._Current = linked->VertexProgram;
|
ctx->VertexProgram._Current = shProg->VertexProgram;
|
||||||
ctx->FragmentProgram._Current = linked->FragmentProgram;
|
ctx->FragmentProgram._Current = shProg->FragmentProgram;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (ctx->VertexProgram._Enabled) {
|
if (ctx->VertexProgram._Enabled) {
|
||||||
|
@@ -78,39 +78,39 @@ copy_string(GLchar *dst, GLsizei maxLength, GLsizei *length, const GLchar *src)
|
|||||||
void
|
void
|
||||||
_mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader)
|
_mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked
|
struct gl_shader_program *shProg
|
||||||
= _mesa_lookup_linked_program(ctx, program);
|
= _mesa_lookup_shader_program(ctx, program);
|
||||||
struct gl_program *prog = _mesa_lookup_shader(ctx, shader);
|
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
|
||||||
const GLuint n = linked->NumShaders;
|
const GLuint n = shProg->NumShaders;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
if (!linked || !prog) {
|
if (!shProg || !sh) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
"glAttachShader(bad program or shader name)");
|
"glAttachShader(bad program or shader name)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (linked->Shaders[i] == prog) {
|
if (shProg->Shaders[i] == sh) {
|
||||||
/* already attached */
|
/* already attached */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* grow list */
|
/* grow list */
|
||||||
linked->Shaders = (struct gl_program **)
|
shProg->Shaders = (struct gl_shader **)
|
||||||
_mesa_realloc(linked->Shaders,
|
_mesa_realloc(shProg->Shaders,
|
||||||
n * sizeof(struct gl_program *),
|
n * sizeof(struct gl_shader *),
|
||||||
(n + 1) * sizeof(struct gl_program *));
|
(n + 1) * sizeof(struct gl_shader *));
|
||||||
if (!linked->Shaders) {
|
if (!shProg->Shaders) {
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAttachShader");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAttachShader");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* append */
|
/* append */
|
||||||
linked->Shaders[n] = prog;
|
shProg->Shaders[n] = sh;
|
||||||
prog->RefCount++;
|
sh->RefCount++;
|
||||||
linked->NumShaders++;
|
shProg->NumShaders++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -118,10 +118,10 @@ void
|
|||||||
_mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
|
_mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
|
||||||
const GLchar *name)
|
const GLchar *name)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked
|
struct gl_shader_program *shProg
|
||||||
= _mesa_lookup_linked_program(ctx, program);
|
= _mesa_lookup_shader_program(ctx, program);
|
||||||
|
|
||||||
if (!linked) {
|
if (!shProg) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glBindAttribLocation(program)");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glBindAttribLocation(program)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -141,26 +141,22 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
|
|||||||
GLuint
|
GLuint
|
||||||
_mesa_create_shader(GLcontext *ctx, GLenum type)
|
_mesa_create_shader(GLcontext *ctx, GLenum type)
|
||||||
{
|
{
|
||||||
struct gl_program *newProg;
|
struct gl_shader *sh;
|
||||||
GLuint name;
|
GLuint name;
|
||||||
|
|
||||||
name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
|
name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GL_FRAGMENT_SHADER_ARB:
|
case GL_FRAGMENT_SHADER:
|
||||||
/* alloc new gl_fragment_program */
|
case GL_VERTEX_SHADER:
|
||||||
newProg = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, name);
|
sh = _mesa_new_shader(ctx, name, type);
|
||||||
break;
|
|
||||||
case GL_VERTEX_SHADER_ARB:
|
|
||||||
/* alloc new gl_vertex_program */
|
|
||||||
newProg = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, name);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM, "CreateShader(type)");
|
_mesa_error(ctx, GL_INVALID_ENUM, "CreateShader(type)");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_mesa_HashInsert(ctx->Shared->ShaderObjects, name, newProg);
|
_mesa_HashInsert(ctx->Shared->ShaderObjects, name, sh);
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -170,12 +166,12 @@ GLuint
|
|||||||
_mesa_create_program(GLcontext *ctx)
|
_mesa_create_program(GLcontext *ctx)
|
||||||
{
|
{
|
||||||
GLuint name;
|
GLuint name;
|
||||||
struct gl_linked_program *linked;
|
struct gl_shader_program *shProg;
|
||||||
|
|
||||||
name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ProgramObjects, 1);
|
name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
|
||||||
linked = _mesa_new_linked_program(ctx, name);
|
shProg = _mesa_new_shader_program(ctx, name);
|
||||||
|
|
||||||
_mesa_HashInsert(ctx->Shared->ProgramObjects, name, linked);
|
_mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg);
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -184,17 +180,17 @@ _mesa_create_program(GLcontext *ctx)
|
|||||||
void
|
void
|
||||||
_mesa_delete_program2(GLcontext *ctx, GLuint name)
|
_mesa_delete_program2(GLcontext *ctx, GLuint name)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked;
|
struct gl_shader_program *shProg;
|
||||||
|
|
||||||
linked = _mesa_lookup_linked_program(ctx, name);
|
shProg = _mesa_lookup_shader_program(ctx, name);
|
||||||
if (!linked) {
|
if (!shProg) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteProgram(name)");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteProgram(name)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX refcounting! */
|
/* XXX refcounting! */
|
||||||
_mesa_HashRemove(ctx->Shared->ProgramObjects, name);
|
_mesa_HashRemove(ctx->Shared->ShaderObjects, name);
|
||||||
_mesa_delete_linked_program(ctx, linked);
|
_mesa_delete_shader_program(ctx, shProg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -212,38 +208,38 @@ _mesa_delete_shader(GLcontext *ctx, GLuint shader)
|
|||||||
void
|
void
|
||||||
_mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
|
_mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked
|
struct gl_shader_program *shProg
|
||||||
= _mesa_lookup_linked_program(ctx, program);
|
= _mesa_lookup_shader_program(ctx, program);
|
||||||
const GLuint n = linked->NumShaders;
|
const GLuint n = shProg->NumShaders;
|
||||||
GLuint i, j;
|
GLuint i, j;
|
||||||
|
|
||||||
if (!linked) {
|
if (!shProg) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
"glDetachShader(bad program or shader name)");
|
"glDetachShader(bad program or shader name)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (linked->Shaders[i]->Id == shader) {
|
if (shProg->Shaders[i]->Name == shader) {
|
||||||
struct gl_program **newList;
|
struct gl_shader **newList;
|
||||||
/* found it */
|
/* found it */
|
||||||
/* alloc new, smaller array */
|
/* alloc new, smaller array */
|
||||||
newList = (struct gl_program **)
|
newList = (struct gl_shader **)
|
||||||
_mesa_malloc((n - 1) * sizeof(struct gl_program *));
|
_mesa_malloc((n - 1) * sizeof(struct gl_shader *));
|
||||||
if (!newList) {
|
if (!newList) {
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDetachShader");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDetachShader");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
newList[j] = linked->Shaders[j];
|
newList[j] = shProg->Shaders[j];
|
||||||
}
|
}
|
||||||
while (++i < n)
|
while (++i < n)
|
||||||
newList[j++] = linked->Shaders[i];
|
newList[j++] = shProg->Shaders[i];
|
||||||
_mesa_free(linked->Shaders);
|
_mesa_free(shProg->Shaders);
|
||||||
|
|
||||||
/* XXX refcounting! */
|
/* XXX refcounting! */
|
||||||
|
|
||||||
linked->Shaders = newList;
|
shProg->Shaders = newList;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -262,23 +258,23 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
|
|||||||
static const GLenum vec_types[] = {
|
static const GLenum vec_types[] = {
|
||||||
GL_FLOAT, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4
|
GL_FLOAT, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4
|
||||||
};
|
};
|
||||||
struct gl_linked_program *linked
|
struct gl_shader_program *shProg
|
||||||
= _mesa_lookup_linked_program(ctx, program);
|
= _mesa_lookup_shader_program(ctx, program);
|
||||||
GLint sz;
|
GLint sz;
|
||||||
|
|
||||||
if (!linked) {
|
if (!shProg) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniform");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniform");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!linked->Attributes || index >= linked->Attributes->NumParameters) {
|
if (!shProg->Attributes || index >= shProg->Attributes->NumParameters) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_string(nameOut, maxLength, length,
|
copy_string(nameOut, maxLength, length,
|
||||||
linked->Attributes->Parameters[index].Name);
|
shProg->Attributes->Parameters[index].Name);
|
||||||
sz = linked->Attributes->Parameters[index].Size;
|
sz = shProg->Attributes->Parameters[index].Size;
|
||||||
if (size)
|
if (size)
|
||||||
*size = sz;
|
*size = sz;
|
||||||
if (type)
|
if (type)
|
||||||
@@ -297,23 +293,23 @@ _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
|
|||||||
static const GLenum vec_types[] = {
|
static const GLenum vec_types[] = {
|
||||||
GL_FLOAT, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4
|
GL_FLOAT, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4
|
||||||
};
|
};
|
||||||
struct gl_linked_program *linked
|
struct gl_shader_program *shProg
|
||||||
= _mesa_lookup_linked_program(ctx, program);
|
= _mesa_lookup_shader_program(ctx, program);
|
||||||
GLint sz;
|
GLint sz;
|
||||||
|
|
||||||
if (!linked) {
|
if (!shProg) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniform");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniform");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!linked->Uniforms || index >= linked->Uniforms->NumParameters) {
|
if (!shProg->Uniforms || index >= shProg->Uniforms->NumParameters) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_string(nameOut, maxLength, length,
|
copy_string(nameOut, maxLength, length,
|
||||||
linked->Uniforms->Parameters[index].Name);
|
shProg->Uniforms->Parameters[index].Name);
|
||||||
sz = linked->Uniforms->Parameters[index].Size;
|
sz = shProg->Uniforms->Parameters[index].Size;
|
||||||
if (size)
|
if (size)
|
||||||
*size = sz;
|
*size = sz;
|
||||||
if (type)
|
if (type)
|
||||||
@@ -328,12 +324,12 @@ void
|
|||||||
_mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
|
_mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
|
||||||
GLsizei *count, GLuint *obj)
|
GLsizei *count, GLuint *obj)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked
|
struct gl_shader_program *shProg
|
||||||
= _mesa_lookup_linked_program(ctx, program);
|
= _mesa_lookup_shader_program(ctx, program);
|
||||||
if (linked) {
|
if (shProg) {
|
||||||
GLuint i;
|
GLuint i;
|
||||||
for (i = 0; i < maxCount && i < linked->NumShaders; i++) {
|
for (i = 0; i < maxCount && i < shProg->NumShaders; i++) {
|
||||||
obj[i] = linked->Shaders[i]->Id;
|
obj[i] = shProg->Shaders[i]->Name;
|
||||||
}
|
}
|
||||||
if (count)
|
if (count)
|
||||||
*count = i;
|
*count = i;
|
||||||
@@ -348,15 +344,15 @@ GLint
|
|||||||
_mesa_get_attrib_location(GLcontext *ctx, GLuint program,
|
_mesa_get_attrib_location(GLcontext *ctx, GLuint program,
|
||||||
const GLchar *name)
|
const GLchar *name)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked
|
struct gl_shader_program *shProg
|
||||||
= _mesa_lookup_linked_program(ctx, program);
|
= _mesa_lookup_shader_program(ctx, program);
|
||||||
|
|
||||||
if (!linked) {
|
if (!shProg) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetAttribLocation");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetAttribLocation");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!linked->LinkStatus) {
|
if (!shProg->LinkStatus) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
"glGetAttribLocation(program not linked)");
|
"glGetAttribLocation(program not linked)");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -365,10 +361,10 @@ _mesa_get_attrib_location(GLcontext *ctx, GLuint program,
|
|||||||
if (!name)
|
if (!name)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (linked->Attributes) {
|
if (shProg->Attributes) {
|
||||||
GLuint i;
|
GLuint i;
|
||||||
for (i = 0; i < linked->Attributes->NumParameters; i++) {
|
for (i = 0; i < shProg->Attributes->NumParameters; i++) {
|
||||||
if (!strcmp(linked->Attributes->Parameters[i].Name, name)) {
|
if (!strcmp(shProg->Attributes->Parameters[i].Name, name)) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -405,41 +401,41 @@ void
|
|||||||
_mesa_get_programiv(GLcontext *ctx, GLuint program,
|
_mesa_get_programiv(GLcontext *ctx, GLuint program,
|
||||||
GLenum pname, GLint *params)
|
GLenum pname, GLint *params)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked
|
struct gl_shader_program *shProg
|
||||||
= _mesa_lookup_linked_program(ctx, program);
|
= _mesa_lookup_shader_program(ctx, program);
|
||||||
|
|
||||||
if (!linked) {
|
if (!shProg) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramiv(program)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramiv(program)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (pname) {
|
switch (pname) {
|
||||||
case GL_DELETE_STATUS:
|
case GL_DELETE_STATUS:
|
||||||
*params = linked->DeletePending;
|
*params = shProg->DeletePending;
|
||||||
break;
|
break;
|
||||||
case GL_LINK_STATUS:
|
case GL_LINK_STATUS:
|
||||||
*params = linked->LinkStatus;
|
*params = shProg->LinkStatus;
|
||||||
break;
|
break;
|
||||||
case GL_VALIDATE_STATUS:
|
case GL_VALIDATE_STATUS:
|
||||||
*params = linked->Validated;
|
*params = shProg->Validated;
|
||||||
break;
|
break;
|
||||||
case GL_INFO_LOG_LENGTH:
|
case GL_INFO_LOG_LENGTH:
|
||||||
*params = linked->InfoLog ? strlen(linked->InfoLog) : 0;
|
*params = shProg->InfoLog ? strlen(shProg->InfoLog) : 0;
|
||||||
break;
|
break;
|
||||||
case GL_ATTACHED_SHADERS:
|
case GL_ATTACHED_SHADERS:
|
||||||
*params = linked->NumShaders;
|
*params = shProg->NumShaders;
|
||||||
break;
|
break;
|
||||||
case GL_ACTIVE_ATTRIBUTES:
|
case GL_ACTIVE_ATTRIBUTES:
|
||||||
*params = linked->Uniforms ? linked->Uniforms->NumParameters : 0;
|
*params = shProg->Uniforms ? shProg->Uniforms->NumParameters : 0;
|
||||||
break;
|
break;
|
||||||
case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
|
case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
|
||||||
*params = _mesa_parameter_longest_name(linked->Attributes);
|
*params = _mesa_parameter_longest_name(shProg->Attributes);
|
||||||
break;
|
break;
|
||||||
case GL_ACTIVE_UNIFORMS:
|
case GL_ACTIVE_UNIFORMS:
|
||||||
*params = linked->Uniforms ? linked->Uniforms->NumParameters : 0;
|
*params = shProg->Uniforms ? shProg->Uniforms->NumParameters : 0;
|
||||||
break;
|
break;
|
||||||
case GL_ACTIVE_UNIFORM_MAX_LENGTH:
|
case GL_ACTIVE_UNIFORM_MAX_LENGTH:
|
||||||
*params = _mesa_parameter_longest_name(linked->Uniforms);
|
*params = _mesa_parameter_longest_name(shProg->Uniforms);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");
|
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");
|
||||||
@@ -451,16 +447,13 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program,
|
|||||||
void
|
void
|
||||||
_mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params)
|
_mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params)
|
||||||
{
|
{
|
||||||
#if 0
|
struct gl_shader *shader = _mesa_lookup_shader(ctx, name);
|
||||||
struct gl_program *shader = _mesa_lookup_shader(ctx, name);
|
|
||||||
|
|
||||||
if (!shader) {
|
if (!shader) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderiv(shader)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderiv(shader)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
struct gl_shader *shader;
|
|
||||||
#endif
|
|
||||||
switch (pname) {
|
switch (pname) {
|
||||||
case GL_SHADER_TYPE:
|
case GL_SHADER_TYPE:
|
||||||
*params = shader->Type;
|
*params = shader->Type;
|
||||||
@@ -488,14 +481,13 @@ void
|
|||||||
_mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
|
_mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
|
||||||
GLsizei *length, GLchar *infoLog)
|
GLsizei *length, GLchar *infoLog)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked
|
struct gl_shader_program *shProg
|
||||||
= _mesa_lookup_linked_program(ctx, program);
|
= _mesa_lookup_shader_program(ctx, program);
|
||||||
if (!linked) {
|
if (!shProg) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramInfoLog(program)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramInfoLog(program)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* XXX also test length, infoLog params for NULL? */
|
copy_string(infoLog, bufSize, length, shProg->InfoLog);
|
||||||
copy_string(linked->InfoLog, bufSize, length, infoLog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -503,14 +495,12 @@ void
|
|||||||
_mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
|
_mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
|
||||||
GLsizei *length, GLchar *infoLog)
|
GLsizei *length, GLchar *infoLog)
|
||||||
{
|
{
|
||||||
struct gl_program *shProg = _mesa_lookup_shader(ctx, shader);
|
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
|
||||||
if (!shProg) {
|
if (!sh) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderInfoLog(shader)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderInfoLog(shader)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
copy_string(infoLog, bufSize, length, sh->InfoLog);
|
||||||
copy_string(shProg->InfoLog, bufSize, length, infoLog);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -521,12 +511,12 @@ void
|
|||||||
_mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
|
_mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
|
||||||
GLsizei *length, GLchar *sourceOut)
|
GLsizei *length, GLchar *sourceOut)
|
||||||
{
|
{
|
||||||
struct gl_program *shProg = _mesa_lookup_shader(ctx, shader);
|
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
|
||||||
if (!shProg) {
|
if (!sh) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderSource(shader)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderSource(shader)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
copy_string((GLchar *) shProg->String, maxLength, length, sourceOut);
|
copy_string(sourceOut, maxLength, length, sh->Source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -537,13 +527,13 @@ void
|
|||||||
_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
|
_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
|
||||||
GLfloat *params)
|
GLfloat *params)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked
|
struct gl_shader_program *shProg
|
||||||
= _mesa_lookup_linked_program(ctx, program);
|
= _mesa_lookup_shader_program(ctx, program);
|
||||||
if (linked) {
|
if (shProg) {
|
||||||
GLuint i;
|
GLuint i;
|
||||||
if (location >= 0 && location < linked->Uniforms->NumParameters) {
|
if (location >= 0 && location < shProg->Uniforms->NumParameters) {
|
||||||
for (i = 0; i < linked->Uniforms->Parameters[location].Size; i++) {
|
for (i = 0; i < shProg->Uniforms->Parameters[location].Size; i++) {
|
||||||
params[i] = linked->Uniforms->ParameterValues[location][i];
|
params[i] = shProg->Uniforms->ParameterValues[location][i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -563,11 +553,11 @@ GLint
|
|||||||
_mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name)
|
_mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name)
|
||||||
{
|
{
|
||||||
if (ctx->Shader.CurrentProgram) {
|
if (ctx->Shader.CurrentProgram) {
|
||||||
const struct gl_linked_program *linked = ctx->Shader.CurrentProgram;
|
const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
|
||||||
GLuint loc;
|
GLuint loc;
|
||||||
for (loc = 0; loc < linked->Uniforms->NumParameters; loc++) {
|
for (loc = 0; loc < shProg->Uniforms->NumParameters; loc++) {
|
||||||
const struct gl_program_parameter *u
|
const struct gl_program_parameter *u
|
||||||
= linked->Uniforms->Parameters + loc;
|
= shProg->Uniforms->Parameters + loc;
|
||||||
if (u->Type == PROGRAM_UNIFORM && !strcmp(u->Name, name)) {
|
if (u->Type == PROGRAM_UNIFORM && !strcmp(u->Name, name)) {
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
@@ -581,15 +571,15 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name)
|
|||||||
GLboolean
|
GLboolean
|
||||||
_mesa_is_program(GLcontext *ctx, GLuint name)
|
_mesa_is_program(GLcontext *ctx, GLuint name)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked = _mesa_lookup_linked_program(ctx, name);
|
struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, name);
|
||||||
return linked ? GL_TRUE : GL_FALSE;
|
return shProg ? GL_TRUE : GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLboolean
|
GLboolean
|
||||||
_mesa_is_shader(GLcontext *ctx, GLuint name)
|
_mesa_is_shader(GLcontext *ctx, GLuint name)
|
||||||
{
|
{
|
||||||
struct gl_program *shader = _mesa_lookup_shader(ctx, name);
|
struct gl_shader *shader = _mesa_lookup_shader(ctx, name);
|
||||||
return shader ? GL_TRUE : GL_FALSE;
|
return shader ? GL_TRUE : GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -601,17 +591,17 @@ _mesa_is_shader(GLcontext *ctx, GLuint name)
|
|||||||
void
|
void
|
||||||
_mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
|
_mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
|
||||||
{
|
{
|
||||||
struct gl_program *shProg = _mesa_lookup_shader(ctx, shader);
|
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
|
||||||
if (!shProg) {
|
if (!sh) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glShaderSource(shaderObj)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glShaderSource(shaderObj)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free old shader source string and install new one */
|
/* free old shader source string and install new one */
|
||||||
if (shProg->String) {
|
if (sh->Source) {
|
||||||
_mesa_free(shProg->String);
|
_mesa_free((void *) sh->Source);
|
||||||
}
|
}
|
||||||
shProg->String = (GLubyte *) source;
|
sh->Source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -621,12 +611,12 @@ _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
|
|||||||
void
|
void
|
||||||
_mesa_compile_shader(GLcontext *ctx, GLuint shaderObj)
|
_mesa_compile_shader(GLcontext *ctx, GLuint shaderObj)
|
||||||
{
|
{
|
||||||
struct gl_program *prog = _mesa_lookup_shader(ctx, shaderObj);
|
struct gl_shader *sh = _mesa_lookup_shader(ctx, shaderObj);
|
||||||
slang_info_log info_log;
|
slang_info_log info_log;
|
||||||
slang_code_object obj;
|
slang_code_object obj;
|
||||||
slang_unit_type type;
|
slang_unit_type type;
|
||||||
|
|
||||||
if (!prog) {
|
if (!sh) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glCompileShader(shaderObj)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glCompileShader(shaderObj)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -634,24 +624,20 @@ _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj)
|
|||||||
slang_info_log_construct(&info_log);
|
slang_info_log_construct(&info_log);
|
||||||
_slang_code_object_ctr(&obj);
|
_slang_code_object_ctr(&obj);
|
||||||
|
|
||||||
if (prog->Target == GL_VERTEX_PROGRAM_ARB) {
|
if (sh->Type == GL_VERTEX_SHADER) {
|
||||||
type = slang_unit_vertex_shader;
|
type = slang_unit_vertex_shader;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB);
|
assert(sh->Type == GL_FRAGMENT_SHADER);
|
||||||
type = slang_unit_fragment_shader;
|
type = slang_unit_fragment_shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_slang_compile((const char*) prog->String, &obj,
|
if (_slang_compile(sh->Source, &obj, type, &info_log, sh)) {
|
||||||
type, &info_log, prog)) {
|
sh->CompileStatus = GL_TRUE;
|
||||||
/*
|
|
||||||
prog->CompileStatus = GL_TRUE;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/*
|
sh->CompileStatus = GL_FALSE;
|
||||||
prog->CompileStatus = GL_FALSE;
|
/* XXX temporary */
|
||||||
*/
|
|
||||||
_mesa_problem(ctx, "Program did not compile!");
|
_mesa_problem(ctx, "Program did not compile!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -663,15 +649,15 @@ _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj)
|
|||||||
void
|
void
|
||||||
_mesa_link_program(GLcontext *ctx, GLuint program)
|
_mesa_link_program(GLcontext *ctx, GLuint program)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked;
|
struct gl_shader_program *shProg;
|
||||||
|
|
||||||
linked = _mesa_lookup_linked_program(ctx, program);
|
shProg = _mesa_lookup_shader_program(ctx, program);
|
||||||
if (!linked) {
|
if (!shProg) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glLinkProgram(program)");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glLinkProgram(program)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_slang_link2(ctx, program, linked);
|
_slang_link2(ctx, program, shProg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -683,14 +669,14 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
|
|||||||
{
|
{
|
||||||
/* XXXX need to handle reference counting here! */
|
/* XXXX need to handle reference counting here! */
|
||||||
if (program) {
|
if (program) {
|
||||||
struct gl_linked_program *linked;
|
struct gl_shader_program *shProg;
|
||||||
linked = _mesa_lookup_linked_program(ctx, program);
|
shProg = _mesa_lookup_shader_program(ctx, program);
|
||||||
if (!linked) {
|
if (!shProg) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
"glUseProgramObjectARB(programObj)");
|
"glUseProgramObjectARB(programObj)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ctx->Shader.CurrentProgram = linked;
|
ctx->Shader.CurrentProgram = shProg;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* don't use a shader program */
|
/* don't use a shader program */
|
||||||
@@ -707,9 +693,9 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
|
|||||||
const GLvoid *values, GLenum type)
|
const GLvoid *values, GLenum type)
|
||||||
{
|
{
|
||||||
if (ctx->Shader.CurrentProgram) {
|
if (ctx->Shader.CurrentProgram) {
|
||||||
struct gl_linked_program *linked = ctx->Shader.CurrentProgram;
|
struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
|
||||||
if (location >= 0 && location < linked->Uniforms->NumParameters) {
|
if (location >= 0 && location < shProg->Uniforms->NumParameters) {
|
||||||
GLfloat *v = linked->Uniforms->ParameterValues[location];
|
GLfloat *v = shProg->Uniforms->ParameterValues[location];
|
||||||
const GLfloat *fValues = (const GLfloat *) values; /* XXX */
|
const GLfloat *fValues = (const GLfloat *) values; /* XXX */
|
||||||
GLint i;
|
GLint i;
|
||||||
if (type == GL_FLOAT_VEC4)
|
if (type == GL_FLOAT_VEC4)
|
||||||
@@ -791,14 +777,14 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
|
|||||||
void
|
void
|
||||||
_mesa_validate_program(GLcontext *ctx, GLuint program)
|
_mesa_validate_program(GLcontext *ctx, GLuint program)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked;
|
struct gl_shader_program *shProg;
|
||||||
linked = _mesa_lookup_linked_program(ctx, program);
|
shProg = _mesa_lookup_shader_program(ctx, program);
|
||||||
if (!linked) {
|
if (!shProg) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glValidateProgram(program)");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glValidateProgram(program)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* XXX temporary */
|
/* XXX temporary */
|
||||||
linked->Validated = GL_TRUE;
|
shProg->Validated = GL_TRUE;
|
||||||
|
|
||||||
/* From the GL spec:
|
/* From the GL spec:
|
||||||
any two active samplers in the current program object are of
|
any two active samplers in the current program object are of
|
||||||
@@ -821,78 +807,93 @@ _mesa_validate_program(GLcontext *ctx, GLuint program)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new GLSL program object.
|
* Allocate a new gl_shader_program object, initialize it.
|
||||||
*/
|
*/
|
||||||
struct gl_linked_program *
|
struct gl_shader_program *
|
||||||
_mesa_new_linked_program(GLcontext *ctx, GLuint name)
|
_mesa_new_shader_program(GLcontext *ctx, GLuint name)
|
||||||
{
|
{
|
||||||
struct gl_linked_program *linked;
|
struct gl_shader_program *shProg;
|
||||||
linked = CALLOC_STRUCT(gl_linked_program);
|
shProg = CALLOC_STRUCT(gl_shader_program);
|
||||||
if (linked) {
|
if (shProg) {
|
||||||
linked->Name = name;
|
shProg->Type = GL_SHADER_PROGRAM;
|
||||||
|
shProg->Name = name;
|
||||||
}
|
}
|
||||||
return linked;
|
return shProg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_free_linked_program_data(GLcontext *ctx,
|
_mesa_free_shader_program_data(GLcontext *ctx,
|
||||||
struct gl_linked_program *linked)
|
struct gl_shader_program *shProg)
|
||||||
{
|
{
|
||||||
if (linked->VertexProgram) {
|
assert(shProg->Type == GL_SHADER_PROGRAM);
|
||||||
if (linked->VertexProgram->Base.Parameters == linked->Uniforms) {
|
|
||||||
|
if (shProg->VertexProgram) {
|
||||||
|
if (shProg->VertexProgram->Base.Parameters == shProg->Uniforms) {
|
||||||
/* to prevent a double-free in the next call */
|
/* to prevent a double-free in the next call */
|
||||||
linked->VertexProgram->Base.Parameters = NULL;
|
shProg->VertexProgram->Base.Parameters = NULL;
|
||||||
}
|
}
|
||||||
_mesa_delete_program(ctx, &linked->VertexProgram->Base);
|
_mesa_delete_program(ctx, &shProg->VertexProgram->Base);
|
||||||
linked->VertexProgram = NULL;
|
shProg->VertexProgram = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linked->FragmentProgram) {
|
if (shProg->FragmentProgram) {
|
||||||
if (linked->FragmentProgram->Base.Parameters == linked->Uniforms) {
|
if (shProg->FragmentProgram->Base.Parameters == shProg->Uniforms) {
|
||||||
/* to prevent a double-free in the next call */
|
/* to prevent a double-free in the next call */
|
||||||
linked->FragmentProgram->Base.Parameters = NULL;
|
shProg->FragmentProgram->Base.Parameters = NULL;
|
||||||
}
|
}
|
||||||
_mesa_delete_program(ctx, &linked->FragmentProgram->Base);
|
_mesa_delete_program(ctx, &shProg->FragmentProgram->Base);
|
||||||
linked->FragmentProgram = NULL;
|
shProg->FragmentProgram = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (linked->Uniforms) {
|
if (shProg->Uniforms) {
|
||||||
_mesa_free_parameter_list(linked->Uniforms);
|
_mesa_free_parameter_list(shProg->Uniforms);
|
||||||
linked->Uniforms = NULL;
|
shProg->Uniforms = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linked->Varying) {
|
if (shProg->Varying) {
|
||||||
_mesa_free_parameter_list(linked->Varying);
|
_mesa_free_parameter_list(shProg->Varying);
|
||||||
linked->Varying = NULL;
|
shProg->Varying = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_delete_linked_program(GLcontext *ctx, struct gl_linked_program *linked)
|
_mesa_delete_shader_program(GLcontext *ctx, struct gl_shader_program *shProg)
|
||||||
{
|
{
|
||||||
_mesa_free_linked_program_data(ctx, linked);
|
_mesa_free_shader_program_data(ctx, shProg);
|
||||||
_mesa_free(linked);
|
_mesa_free(shProg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lookup a GLSL program object.
|
* Lookup a GLSL program object.
|
||||||
*/
|
*/
|
||||||
struct gl_linked_program *
|
struct gl_shader_program *
|
||||||
_mesa_lookup_linked_program(GLcontext *ctx, GLuint name)
|
_mesa_lookup_shader_program(GLcontext *ctx, GLuint name)
|
||||||
{
|
{
|
||||||
if (name)
|
struct gl_shader_program *shProg;
|
||||||
return (struct gl_linked_program *)
|
if (name) {
|
||||||
_mesa_HashLookup(ctx->Shared->ProgramObjects, name);
|
shProg = (struct gl_shader_program *)
|
||||||
else
|
_mesa_HashLookup(ctx->Shared->ShaderObjects, name);
|
||||||
|
/* Note that both gl_shader and gl_shader_program objects are kept
|
||||||
|
* in the same hash table. Check the object's type to be sure it's
|
||||||
|
* what we're expecting.
|
||||||
|
*/
|
||||||
|
if (shProg && shProg->Type != GL_SHADER_PROGRAM) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return shProg;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate a new gl_shader object, initialize it.
|
||||||
|
*/
|
||||||
struct gl_shader *
|
struct gl_shader *
|
||||||
_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type)
|
_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type)
|
||||||
{
|
{
|
||||||
@@ -900,8 +901,8 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type)
|
|||||||
assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER);
|
assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER);
|
||||||
shader = CALLOC_STRUCT(gl_shader);
|
shader = CALLOC_STRUCT(gl_shader);
|
||||||
if (shader) {
|
if (shader) {
|
||||||
shader->Name = name;
|
|
||||||
shader->Type = type;
|
shader->Type = type;
|
||||||
|
shader->Name = name;
|
||||||
}
|
}
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
@@ -910,13 +911,23 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type)
|
|||||||
/**
|
/**
|
||||||
* Lookup a GLSL shader object.
|
* Lookup a GLSL shader object.
|
||||||
*/
|
*/
|
||||||
struct gl_program *
|
struct gl_shader *
|
||||||
_mesa_lookup_shader(GLcontext *ctx, GLuint name)
|
_mesa_lookup_shader(GLcontext *ctx, GLuint name)
|
||||||
{
|
{
|
||||||
if (name)
|
if (name) {
|
||||||
return (struct gl_program *)
|
struct gl_shader *sh = (struct gl_shader *)
|
||||||
_mesa_HashLookup(ctx->Shared->ShaderObjects, name);
|
_mesa_HashLookup(ctx->Shared->ShaderObjects, name);
|
||||||
else
|
/* Note that both gl_shader and gl_shader_program objects are kept
|
||||||
|
* in the same hash table. Check the object's type to be sure it's
|
||||||
|
* what we're expecting.
|
||||||
|
*/
|
||||||
|
if (sh && sh->Type == GL_SHADER_PROGRAM) {
|
||||||
|
assert(sh->Type == GL_VERTEX_SHADER ||
|
||||||
|
sh->Type == GL_FRAGMENT_SHADER);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return sh;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,24 +38,24 @@
|
|||||||
extern void
|
extern void
|
||||||
_mesa_init_shader_state(GLcontext * ctx);
|
_mesa_init_shader_state(GLcontext * ctx);
|
||||||
|
|
||||||
extern struct gl_linked_program *
|
extern struct gl_shader_program *
|
||||||
_mesa_new_linked_program(GLcontext *ctx, GLuint name);
|
_mesa_new_shader_program(GLcontext *ctx, GLuint name);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_free_linked_program_data(GLcontext *ctx,
|
_mesa_free_shader_program_data(GLcontext *ctx,
|
||||||
struct gl_linked_program *linked);
|
struct gl_shader_program *shProg);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_delete_linked_program(GLcontext *ctx, struct gl_linked_program *linked);
|
_mesa_delete_shader_program(GLcontext *ctx, struct gl_shader_program *shProg);
|
||||||
|
|
||||||
extern struct gl_linked_program *
|
extern struct gl_shader_program *
|
||||||
_mesa_lookup_linked_program(GLcontext *ctx, GLuint name);
|
_mesa_lookup_shader_program(GLcontext *ctx, GLuint name);
|
||||||
|
|
||||||
|
|
||||||
extern struct gl_shader *
|
extern struct gl_shader *
|
||||||
_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
|
_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
|
||||||
|
|
||||||
extern struct gl_program *
|
extern struct gl_shader *
|
||||||
_mesa_lookup_shader(GLcontext *ctx, GLuint name);
|
_mesa_lookup_shader(GLcontext *ctx, GLuint name);
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2223,6 +2223,7 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
slang_create_uniforms(const slang_export_data_table *exports,
|
slang_create_uniforms(const slang_export_data_table *exports,
|
||||||
struct gl_program *program)
|
struct gl_program *program)
|
||||||
@@ -2237,16 +2238,34 @@ slang_create_uniforms(const slang_export_data_table *exports,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
GLboolean
|
GLboolean
|
||||||
_slang_compile(const char *source, slang_code_object * object,
|
_slang_compile(const char *source, slang_code_object * object,
|
||||||
slang_unit_type type, slang_info_log * infolog,
|
slang_unit_type type, slang_info_log * infolog,
|
||||||
struct gl_program *program)
|
struct gl_shader *shader)
|
||||||
{
|
{
|
||||||
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
struct gl_program *program;
|
||||||
GLboolean success;
|
GLboolean success;
|
||||||
grammar id = 0;
|
grammar id = 0;
|
||||||
|
|
||||||
|
/* XXX temporary hack */
|
||||||
|
if (!shader->Programs) {
|
||||||
|
GLenum progTarget;
|
||||||
|
if (shader->Type == GL_VERTEX_SHADER)
|
||||||
|
progTarget = GL_VERTEX_PROGRAM_ARB;
|
||||||
|
else
|
||||||
|
progTarget = GL_FRAGMENT_PROGRAM_ARB;
|
||||||
|
shader->Programs
|
||||||
|
= (struct gl_program **) malloc(sizeof(struct gl_program*));
|
||||||
|
shader->Programs[0] = _mesa_new_program(ctx, progTarget, 1);
|
||||||
|
shader->NumPrograms = 1;
|
||||||
|
}
|
||||||
|
program = shader->Programs[0];
|
||||||
|
assert(program);
|
||||||
|
|
||||||
_slang_code_object_dtr(object);
|
_slang_code_object_dtr(object);
|
||||||
_slang_code_object_ctr(object);
|
_slang_code_object_ctr(object);
|
||||||
|
|
||||||
@@ -2265,7 +2284,7 @@ _slang_compile(const char *source, slang_code_object * object,
|
|||||||
#if NEW_SLANG
|
#if NEW_SLANG
|
||||||
{
|
{
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
slang_create_uniforms(&object->expdata, program);
|
slang_create_uniforms(&object->expdata, shader);
|
||||||
_mesa_print_program(program);
|
_mesa_print_program(program);
|
||||||
_mesa_print_program_parameters(ctx, program);
|
_mesa_print_program_parameters(ctx, program);
|
||||||
}
|
}
|
||||||
|
@@ -109,7 +109,7 @@ int slang_info_log_warning (slang_info_log *, const char *, ...);
|
|||||||
void slang_info_log_memory (slang_info_log *);
|
void slang_info_log_memory (slang_info_log *);
|
||||||
|
|
||||||
extern GLboolean
|
extern GLboolean
|
||||||
_slang_compile (const char *, slang_code_object *, slang_unit_type, slang_info_log *, struct gl_program *program);
|
_slang_compile (const char *, slang_code_object *, slang_unit_type, slang_info_log *, struct gl_shader *shader);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -351,7 +351,7 @@ _slang_link (slang_program *, slang_code_object **, GLuint);
|
|||||||
|
|
||||||
extern void
|
extern void
|
||||||
_slang_link2(GLcontext *ctx, GLhandleARB h,
|
_slang_link2(GLcontext *ctx, GLhandleARB h,
|
||||||
struct gl_linked_program *linked);
|
struct gl_shader_program *shProg);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
|
|
||||||
static GLboolean
|
static GLboolean
|
||||||
link_varying_vars(struct gl_linked_program *linked, struct gl_program *prog)
|
link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog)
|
||||||
{
|
{
|
||||||
GLuint *map, i, firstVarying, newFile;
|
GLuint *map, i, firstVarying, newFile;
|
||||||
GLbitfield varsWritten, varsRead;
|
GLbitfield varsWritten, varsRead;
|
||||||
@@ -57,17 +57,17 @@ link_varying_vars(struct gl_linked_program *linked, struct gl_program *prog)
|
|||||||
const struct gl_program_parameter *var
|
const struct gl_program_parameter *var
|
||||||
= prog->Varying->Parameters + i;
|
= prog->Varying->Parameters + i;
|
||||||
|
|
||||||
GLint j = _mesa_lookup_parameter_index(linked->Varying, -1, var->Name);
|
GLint j = _mesa_lookup_parameter_index(shProg->Varying, -1, var->Name);
|
||||||
if (j >= 0) {
|
if (j >= 0) {
|
||||||
/* already in list, check size */
|
/* already in list, check size */
|
||||||
if (var->Size != linked->Varying->Parameters[j].Size) {
|
if (var->Size != shProg->Varying->Parameters[j].Size) {
|
||||||
/* error */
|
/* error */
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* not already in linked list */
|
/* not already in linked list */
|
||||||
j = _mesa_add_varying(linked->Varying, var->Name, var->Size);
|
j = _mesa_add_varying(shProg->Varying, var->Name, var->Size);
|
||||||
}
|
}
|
||||||
ASSERT(j >= 0);
|
ASSERT(j >= 0);
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ is_uniform(enum register_file file)
|
|||||||
|
|
||||||
|
|
||||||
static GLboolean
|
static GLboolean
|
||||||
link_uniform_vars(struct gl_linked_program *linked, struct gl_program *prog)
|
link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog)
|
||||||
{
|
{
|
||||||
GLuint *map, i;
|
GLuint *map, i;
|
||||||
|
|
||||||
@@ -161,12 +161,12 @@ link_uniform_vars(struct gl_linked_program *linked, struct gl_program *prog)
|
|||||||
assert(is_uniform(p->Type));
|
assert(is_uniform(p->Type));
|
||||||
|
|
||||||
if (p->Name) {
|
if (p->Name) {
|
||||||
j = _mesa_lookup_parameter_index(linked->Uniforms, -1, p->Name);
|
j = _mesa_lookup_parameter_index(shProg->Uniforms, -1, p->Name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GLuint swizzle;
|
GLuint swizzle;
|
||||||
ASSERT(p->Type == PROGRAM_CONSTANT);
|
ASSERT(p->Type == PROGRAM_CONSTANT);
|
||||||
if (_mesa_lookup_parameter_constant(linked->Uniforms, pVals,
|
if (_mesa_lookup_parameter_constant(shProg->Uniforms, pVals,
|
||||||
p->Size, &j, &swizzle)) {
|
p->Size, &j, &swizzle)) {
|
||||||
assert(j >= 0);
|
assert(j >= 0);
|
||||||
}
|
}
|
||||||
@@ -177,21 +177,21 @@ link_uniform_vars(struct gl_linked_program *linked, struct gl_program *prog)
|
|||||||
|
|
||||||
if (j >= 0) {
|
if (j >= 0) {
|
||||||
/* already in list, check size XXX check this */
|
/* already in list, check size XXX check this */
|
||||||
assert(p->Size == linked->Uniforms->Parameters[j].Size);
|
assert(p->Size == shProg->Uniforms->Parameters[j].Size);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* not already in linked list */
|
/* not already in linked list */
|
||||||
switch (p->Type) {
|
switch (p->Type) {
|
||||||
case PROGRAM_ENV_PARAM:
|
case PROGRAM_ENV_PARAM:
|
||||||
j = _mesa_add_named_parameter(linked->Uniforms, p->Name, pVals);
|
j = _mesa_add_named_parameter(shProg->Uniforms, p->Name, pVals);
|
||||||
case PROGRAM_CONSTANT:
|
case PROGRAM_CONSTANT:
|
||||||
j = _mesa_add_named_constant(linked->Uniforms, p->Name, pVals, p->Size);
|
j = _mesa_add_named_constant(shProg->Uniforms, p->Name, pVals, p->Size);
|
||||||
break;
|
break;
|
||||||
case PROGRAM_STATE_VAR:
|
case PROGRAM_STATE_VAR:
|
||||||
j = _mesa_add_state_reference(linked->Uniforms, (const GLint *) p->StateIndexes);
|
j = _mesa_add_state_reference(shProg->Uniforms, (const GLint *) p->StateIndexes);
|
||||||
break;
|
break;
|
||||||
case PROGRAM_UNIFORM:
|
case PROGRAM_UNIFORM:
|
||||||
j = _mesa_add_uniform(linked->Uniforms, p->Name, p->Size);
|
j = _mesa_add_uniform(shProg->Uniforms, p->Name, p->Size);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
@@ -287,41 +287,41 @@ slang_resolve_branches(struct gl_program *prog)
|
|||||||
void
|
void
|
||||||
_slang_link2(GLcontext *ctx,
|
_slang_link2(GLcontext *ctx,
|
||||||
GLhandleARB programObj,
|
GLhandleARB programObj,
|
||||||
struct gl_linked_program *linked)
|
struct gl_shader_program *shProg)
|
||||||
{
|
{
|
||||||
struct gl_vertex_program *vertProg;
|
struct gl_vertex_program *vertProg;
|
||||||
struct gl_fragment_program *fragProg;
|
struct gl_fragment_program *fragProg;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
_mesa_free_linked_program_data(ctx, linked);
|
_mesa_free_shader_program_data(ctx, shProg);
|
||||||
|
|
||||||
linked->Uniforms = _mesa_new_parameter_list();
|
shProg->Uniforms = _mesa_new_parameter_list();
|
||||||
linked->Varying = _mesa_new_parameter_list();
|
shProg->Varying = _mesa_new_parameter_list();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find attached vertex shader, fragment shader
|
* Find attached vertex shader, fragment shader
|
||||||
*/
|
*/
|
||||||
vertProg = NULL;
|
vertProg = NULL;
|
||||||
fragProg = NULL;
|
fragProg = NULL;
|
||||||
for (i = 0; i < linked->NumShaders; i++) {
|
for (i = 0; i < shProg->NumShaders; i++) {
|
||||||
if (linked->Shaders[i]->Target == GL_VERTEX_PROGRAM_ARB)
|
if (shProg->Shaders[i]->Type == GL_VERTEX_SHADER)
|
||||||
vertProg = (struct gl_vertex_program *) linked->Shaders[i];
|
vertProg = (struct gl_vertex_program *) shProg->Shaders[i]->Programs[0];
|
||||||
else if (linked->Shaders[i]->Target == GL_FRAGMENT_PROGRAM_ARB)
|
else if (shProg->Shaders[i]->Type == GL_FRAGMENT_SHADER)
|
||||||
fragProg = (struct gl_fragment_program *) linked->Shaders[i];
|
fragProg = (struct gl_fragment_program *) shProg->Shaders[i]->Programs[0];
|
||||||
else
|
else
|
||||||
_mesa_problem(ctx, "unexpected shader target in slang_link2()");
|
_mesa_problem(ctx, "unexpected shader target in slang_link2()");
|
||||||
}
|
}
|
||||||
if (!vertProg || !fragProg) {
|
if (!vertProg || !fragProg) {
|
||||||
/* XXX is it legal to have one but not the other?? */
|
/* XXX is it legal to have one but not the other?? */
|
||||||
/* XXX record error */
|
/* XXX record error */
|
||||||
linked->LinkStatus = GL_FALSE;
|
shProg->LinkStatus = GL_FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vertProg->Base.Varying || !fragProg->Base.Varying) {
|
if (!vertProg->Base.Varying || !fragProg->Base.Varying) {
|
||||||
/* temporary */
|
/* temporary */
|
||||||
_mesa_problem(ctx, "vertex/fragment program lacks varying list!");
|
_mesa_problem(ctx, "vertex/fragment program lacks varying list!");
|
||||||
linked->LinkStatus = GL_FALSE;
|
shProg->LinkStatus = GL_FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,25 +329,25 @@ _slang_link2(GLcontext *ctx,
|
|||||||
* Make copies of the vertex/fragment programs now since we'll be
|
* Make copies of the vertex/fragment programs now since we'll be
|
||||||
* changing src/dst registers after merging the uniforms and varying vars.
|
* changing src/dst registers after merging the uniforms and varying vars.
|
||||||
*/
|
*/
|
||||||
linked->VertexProgram = (struct gl_vertex_program *)
|
shProg->VertexProgram = (struct gl_vertex_program *)
|
||||||
_mesa_clone_program(ctx, &vertProg->Base);
|
_mesa_clone_program(ctx, &vertProg->Base);
|
||||||
linked->FragmentProgram = (struct gl_fragment_program *)
|
shProg->FragmentProgram = (struct gl_fragment_program *)
|
||||||
_mesa_clone_program(ctx, &fragProg->Base);
|
_mesa_clone_program(ctx, &fragProg->Base);
|
||||||
|
|
||||||
link_varying_vars(linked, &linked->VertexProgram->Base);
|
link_varying_vars(shProg, &shProg->VertexProgram->Base);
|
||||||
link_varying_vars(linked, &linked->FragmentProgram->Base);
|
link_varying_vars(shProg, &shProg->FragmentProgram->Base);
|
||||||
|
|
||||||
link_uniform_vars(linked, &linked->VertexProgram->Base);
|
link_uniform_vars(shProg, &shProg->VertexProgram->Base);
|
||||||
link_uniform_vars(linked, &linked->FragmentProgram->Base);
|
link_uniform_vars(shProg, &shProg->FragmentProgram->Base);
|
||||||
|
|
||||||
/* The vertex and fragment programs share a common set of uniforms now */
|
/* The vertex and fragment programs share a common set of uniforms now */
|
||||||
_mesa_free_parameter_list(linked->VertexProgram->Base.Parameters);
|
_mesa_free_parameter_list(shProg->VertexProgram->Base.Parameters);
|
||||||
_mesa_free_parameter_list(linked->FragmentProgram->Base.Parameters);
|
_mesa_free_parameter_list(shProg->FragmentProgram->Base.Parameters);
|
||||||
linked->VertexProgram->Base.Parameters = linked->Uniforms;
|
shProg->VertexProgram->Base.Parameters = shProg->Uniforms;
|
||||||
linked->FragmentProgram->Base.Parameters = linked->Uniforms;
|
shProg->FragmentProgram->Base.Parameters = shProg->Uniforms;
|
||||||
|
|
||||||
slang_resolve_branches(&linked->VertexProgram->Base);
|
slang_resolve_branches(&shProg->VertexProgram->Base);
|
||||||
slang_resolve_branches(&linked->FragmentProgram->Base);
|
slang_resolve_branches(&shProg->FragmentProgram->Base);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
printf("************** original fragment program\n");
|
printf("************** original fragment program\n");
|
||||||
@@ -356,8 +356,8 @@ _slang_link2(GLcontext *ctx,
|
|||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
printf("************** linked fragment prog\n");
|
printf("************** linked fragment prog\n");
|
||||||
_mesa_print_program(&linked->FragmentProgram->Base);
|
_mesa_print_program(&shProg->FragmentProgram->Base);
|
||||||
_mesa_print_program_parameters(ctx, &linked->FragmentProgram->Base);
|
_mesa_print_program_parameters(ctx, &shProg->FragmentProgram->Base);
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
printf("************** original vertex program\n");
|
printf("************** original vertex program\n");
|
||||||
@@ -366,10 +366,10 @@ _slang_link2(GLcontext *ctx,
|
|||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
printf("************** linked vertex prog\n");
|
printf("************** linked vertex prog\n");
|
||||||
_mesa_print_program(&linked->VertexProgram->Base);
|
_mesa_print_program(&shProg->VertexProgram->Base);
|
||||||
_mesa_print_program_parameters(ctx, &linked->VertexProgram->Base);
|
_mesa_print_program_parameters(ctx, &shProg->VertexProgram->Base);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
linked->LinkStatus = (linked->VertexProgram && linked->FragmentProgram);
|
shProg->LinkStatus = (shProg->VertexProgram && shProg->FragmentProgram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user