From aff8e204d205b5d424d2c39a5d9e004caaa1eab1 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 13 Dec 2006 14:48:36 -0700 Subject: Checkpoint new GLSL compiler back-end to produce fp/vp-style assembly instructions. --- src/mesa/shader/slang/slang_link.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/mesa/shader/slang/slang_link.h') diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index 433964223a5..af45c6657e4 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -316,6 +316,9 @@ enum SLANG_COMMON_CODE_MAX }; +/** + * XXX promote this to mtypes.h? + */ typedef struct { slang_active_variables active_uniforms; @@ -345,6 +348,11 @@ _slang_program_rst (slang_program *); extern GLboolean _slang_link (slang_program *, slang_code_object **, GLuint); + +extern void +_slang_link2(GLcontext *ctx, GLhandleARB h, + struct gl_linked_program *linked); + #ifdef __cplusplus } #endif -- cgit v1.2.3 From 89f88058b9321d9aac50200f9e173a7302934c27 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 15 Dec 2006 10:08:24 -0700 Subject: use MAX_VARYING --- src/mesa/shader/slang/slang_link.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/shader/slang/slang_link.h') diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index af45c6657e4..e96dd51ed47 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -181,9 +181,9 @@ typedef struct typedef struct { - slang_varying_binding bindings[MAX_VARYING_FLOATS]; + slang_varying_binding bindings[MAX_VARYING * 4]; GLuint binding_count; - slang_varying_slot slots[MAX_VARYING_FLOATS]; + slang_varying_slot slots[MAX_VARYING * 4]; GLuint slot_count; } slang_varying_bindings; /*@}*/ -- cgit v1.2.3 From 65a18442e5d846940714bb662f5b1bb47ab60c29 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 19 Dec 2006 18:46:56 -0700 Subject: 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. --- src/mesa/main/context.c | 3 - src/mesa/main/mtypes.h | 25 ++- src/mesa/main/state.c | 9 +- src/mesa/shader/shader_api.c | 385 +++++++++++++++++----------------- src/mesa/shader/shader_api.h | 16 +- src/mesa/shader/slang/slang_compile.c | 23 +- src/mesa/shader/slang/slang_compile.h | 2 +- src/mesa/shader/slang/slang_link.h | 2 +- src/mesa/shader/slang/slang_link2.c | 80 +++---- 9 files changed, 288 insertions(+), 257 deletions(-) (limited to 'src/mesa/shader/slang/slang_link.h') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index c5220b5b2eb..2196591ba26 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -706,7 +706,6 @@ alloc_shared_state( GLcontext *ctx ) #if FEATURE_ARB_shader_objects ss->ShaderObjects = _mesa_NewHashTable(); - ss->ProgramObjects = _mesa_NewHashTable(); #endif 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 (ss->ShaderObjects) _mesa_DeleteHashTable (ss->ShaderObjects); - if (ss->ProgramObjects) - _mesa_DeleteHashTable (ss->ProgramObjects); #endif #if FEATURE_EXT_framebuffer_object diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4a8f7d22e30..57f174a7d47 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -44,6 +44,12 @@ #include "bitset.h" +/** + * Special, internal token + */ +#define GL_SHADER_PROGRAM 0x9999 + + /** * Color channel data type. */ @@ -2044,13 +2050,13 @@ struct gl_query_state /** * A GLSL shader object - * A collection of one or more gl_programs... */ 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 */ - GLchar *Source; /**< Source code string */ + GLint RefCount; + const GLchar *Source; /**< Source code string */ GLboolean CompileStatus; GLboolean DeletePending; 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 - * of "shaders" (which are Mesa gl_programs). - * Yes, the terminology is a bit confusing. + * of "shaders". */ -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 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_fragment_program *FragmentProgram; /**< Linked fragment prog */ struct gl_program_parameter_list *Uniforms; /**< Plus constants, etc */ @@ -2089,7 +2094,7 @@ struct gl_shader_state { GLboolean _VertexShaderPresent; GLboolean _FragmentShaderPresent; - struct gl_linked_program *CurrentProgram; + struct gl_shader_program *CurrentProgram; }; @@ -2150,8 +2155,8 @@ struct gl_shared_state #endif #if FEATURE_ARB_shader_objects + /** Table of both gl_shader and gl_shader_program objects */ struct _mesa_HashTable *ShaderObjects; - struct _mesa_HashTable *ProgramObjects; #endif #if FEATURE_EXT_framebuffer_object diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 1d8666888ef..947d3136d5b 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -949,8 +949,7 @@ update_arrays( GLcontext *ctx ) static void 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. */ ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled @@ -973,10 +972,10 @@ update_program(GLcontext *ctx) ctx->FragmentProgram._Current = NULL; - if (linked && linked->LinkStatus) { + if (shProg && shProg->LinkStatus) { /* Use shader programs */ - ctx->VertexProgram._Current = linked->VertexProgram; - ctx->FragmentProgram._Current = linked->FragmentProgram; + ctx->VertexProgram._Current = shProg->VertexProgram; + ctx->FragmentProgram._Current = shProg->FragmentProgram; } else { if (ctx->VertexProgram._Enabled) { diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index ab2fd438c8c..e49feea3d86 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -78,39 +78,39 @@ copy_string(GLchar *dst, GLsizei maxLength, GLsizei *length, const GLchar *src) void _mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader) { - struct gl_linked_program *linked - = _mesa_lookup_linked_program(ctx, program); - struct gl_program *prog = _mesa_lookup_shader(ctx, shader); - const GLuint n = linked->NumShaders; + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); + struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); + const GLuint n = shProg->NumShaders; GLuint i; - if (!linked || !prog) { + if (!shProg || !sh) { _mesa_error(ctx, GL_INVALID_OPERATION, "glAttachShader(bad program or shader name)"); return; } for (i = 0; i < n; i++) { - if (linked->Shaders[i] == prog) { + if (shProg->Shaders[i] == sh) { /* already attached */ return; } } /* grow list */ - linked->Shaders = (struct gl_program **) - _mesa_realloc(linked->Shaders, - n * sizeof(struct gl_program *), - (n + 1) * sizeof(struct gl_program *)); - if (!linked->Shaders) { + shProg->Shaders = (struct gl_shader **) + _mesa_realloc(shProg->Shaders, + n * sizeof(struct gl_shader *), + (n + 1) * sizeof(struct gl_shader *)); + if (!shProg->Shaders) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glAttachShader"); return; } /* append */ - linked->Shaders[n] = prog; - prog->RefCount++; - linked->NumShaders++; + shProg->Shaders[n] = sh; + sh->RefCount++; + shProg->NumShaders++; } @@ -118,10 +118,10 @@ void _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, const GLchar *name) { - struct gl_linked_program *linked - = _mesa_lookup_linked_program(ctx, program); + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); - if (!linked) { + if (!shProg) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindAttribLocation(program)"); return; } @@ -141,26 +141,22 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, GLuint _mesa_create_shader(GLcontext *ctx, GLenum type) { - struct gl_program *newProg; + struct gl_shader *sh; GLuint name; name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1); switch (type) { - case GL_FRAGMENT_SHADER_ARB: - /* alloc new gl_fragment_program */ - newProg = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, name); - break; - case GL_VERTEX_SHADER_ARB: - /* alloc new gl_vertex_program */ - newProg = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, name); + case GL_FRAGMENT_SHADER: + case GL_VERTEX_SHADER: + sh = _mesa_new_shader(ctx, name, type); break; default: _mesa_error(ctx, GL_INVALID_ENUM, "CreateShader(type)"); return 0; } - _mesa_HashInsert(ctx->Shared->ShaderObjects, name, newProg); + _mesa_HashInsert(ctx->Shared->ShaderObjects, name, sh); return name; } @@ -170,12 +166,12 @@ GLuint _mesa_create_program(GLcontext *ctx) { GLuint name; - struct gl_linked_program *linked; + struct gl_shader_program *shProg; - name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ProgramObjects, 1); - linked = _mesa_new_linked_program(ctx, name); + name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1); + shProg = _mesa_new_shader_program(ctx, name); - _mesa_HashInsert(ctx->Shared->ProgramObjects, name, linked); + _mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg); return name; } @@ -184,17 +180,17 @@ _mesa_create_program(GLcontext *ctx) void _mesa_delete_program2(GLcontext *ctx, GLuint name) { - struct gl_linked_program *linked; + struct gl_shader_program *shProg; - linked = _mesa_lookup_linked_program(ctx, name); - if (!linked) { + shProg = _mesa_lookup_shader_program(ctx, name); + if (!shProg) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteProgram(name)"); return; } /* XXX refcounting! */ - _mesa_HashRemove(ctx->Shared->ProgramObjects, name); - _mesa_delete_linked_program(ctx, linked); + _mesa_HashRemove(ctx->Shared->ShaderObjects, name); + _mesa_delete_shader_program(ctx, shProg); } @@ -212,38 +208,38 @@ _mesa_delete_shader(GLcontext *ctx, GLuint shader) void _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader) { - struct gl_linked_program *linked - = _mesa_lookup_linked_program(ctx, program); - const GLuint n = linked->NumShaders; + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); + const GLuint n = shProg->NumShaders; GLuint i, j; - if (!linked) { + if (!shProg) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDetachShader(bad program or shader name)"); return; } for (i = 0; i < n; i++) { - if (linked->Shaders[i]->Id == shader) { - struct gl_program **newList; + if (shProg->Shaders[i]->Name == shader) { + struct gl_shader **newList; /* found it */ /* alloc new, smaller array */ - newList = (struct gl_program **) - _mesa_malloc((n - 1) * sizeof(struct gl_program *)); + newList = (struct gl_shader **) + _mesa_malloc((n - 1) * sizeof(struct gl_shader *)); if (!newList) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDetachShader"); return; } for (j = 0; j < i; j++) { - newList[j] = linked->Shaders[j]; + newList[j] = shProg->Shaders[j]; } while (++i < n) - newList[j++] = linked->Shaders[i]; - _mesa_free(linked->Shaders); + newList[j++] = shProg->Shaders[i]; + _mesa_free(shProg->Shaders); /* XXX refcounting! */ - linked->Shaders = newList; + shProg->Shaders = newList; return; } } @@ -262,23 +258,23 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index, static const GLenum vec_types[] = { GL_FLOAT, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4 }; - struct gl_linked_program *linked - = _mesa_lookup_linked_program(ctx, program); + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); GLint sz; - if (!linked) { + if (!shProg) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniform"); return; } - if (!linked->Attributes || index >= linked->Attributes->NumParameters) { + if (!shProg->Attributes || index >= shProg->Attributes->NumParameters) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)"); return; } copy_string(nameOut, maxLength, length, - linked->Attributes->Parameters[index].Name); - sz = linked->Attributes->Parameters[index].Size; + shProg->Attributes->Parameters[index].Name); + sz = shProg->Attributes->Parameters[index].Size; if (size) *size = sz; if (type) @@ -297,23 +293,23 @@ _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index, static const GLenum vec_types[] = { GL_FLOAT, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4 }; - struct gl_linked_program *linked - = _mesa_lookup_linked_program(ctx, program); + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); GLint sz; - if (!linked) { + if (!shProg) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniform"); return; } - if (!linked->Uniforms || index >= linked->Uniforms->NumParameters) { + if (!shProg->Uniforms || index >= shProg->Uniforms->NumParameters) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)"); return; } copy_string(nameOut, maxLength, length, - linked->Uniforms->Parameters[index].Name); - sz = linked->Uniforms->Parameters[index].Size; + shProg->Uniforms->Parameters[index].Name); + sz = shProg->Uniforms->Parameters[index].Size; if (size) *size = sz; if (type) @@ -328,12 +324,12 @@ void _mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj) { - struct gl_linked_program *linked - = _mesa_lookup_linked_program(ctx, program); - if (linked) { + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); + if (shProg) { GLuint i; - for (i = 0; i < maxCount && i < linked->NumShaders; i++) { - obj[i] = linked->Shaders[i]->Id; + for (i = 0; i < maxCount && i < shProg->NumShaders; i++) { + obj[i] = shProg->Shaders[i]->Name; } if (count) *count = i; @@ -348,15 +344,15 @@ GLint _mesa_get_attrib_location(GLcontext *ctx, GLuint program, const GLchar *name) { - struct gl_linked_program *linked - = _mesa_lookup_linked_program(ctx, program); + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); - if (!linked) { + if (!shProg) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetAttribLocation"); return -1; } - if (!linked->LinkStatus) { + if (!shProg->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetAttribLocation(program not linked)"); return -1; @@ -365,10 +361,10 @@ _mesa_get_attrib_location(GLcontext *ctx, GLuint program, if (!name) return -1; - if (linked->Attributes) { + if (shProg->Attributes) { GLuint i; - for (i = 0; i < linked->Attributes->NumParameters; i++) { - if (!strcmp(linked->Attributes->Parameters[i].Name, name)) { + for (i = 0; i < shProg->Attributes->NumParameters; i++) { + if (!strcmp(shProg->Attributes->Parameters[i].Name, name)) { return i; } } @@ -405,41 +401,41 @@ void _mesa_get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params) { - struct gl_linked_program *linked - = _mesa_lookup_linked_program(ctx, program); + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); - if (!linked) { + if (!shProg) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramiv(program)"); return; } switch (pname) { case GL_DELETE_STATUS: - *params = linked->DeletePending; + *params = shProg->DeletePending; break; case GL_LINK_STATUS: - *params = linked->LinkStatus; + *params = shProg->LinkStatus; break; case GL_VALIDATE_STATUS: - *params = linked->Validated; + *params = shProg->Validated; break; case GL_INFO_LOG_LENGTH: - *params = linked->InfoLog ? strlen(linked->InfoLog) : 0; + *params = shProg->InfoLog ? strlen(shProg->InfoLog) : 0; break; case GL_ATTACHED_SHADERS: - *params = linked->NumShaders; + *params = shProg->NumShaders; break; case GL_ACTIVE_ATTRIBUTES: - *params = linked->Uniforms ? linked->Uniforms->NumParameters : 0; + *params = shProg->Uniforms ? shProg->Uniforms->NumParameters : 0; break; case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: - *params = _mesa_parameter_longest_name(linked->Attributes); + *params = _mesa_parameter_longest_name(shProg->Attributes); break; case GL_ACTIVE_UNIFORMS: - *params = linked->Uniforms ? linked->Uniforms->NumParameters : 0; + *params = shProg->Uniforms ? shProg->Uniforms->NumParameters : 0; break; case GL_ACTIVE_UNIFORM_MAX_LENGTH: - *params = _mesa_parameter_longest_name(linked->Uniforms); + *params = _mesa_parameter_longest_name(shProg->Uniforms); break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)"); @@ -451,16 +447,13 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program, void _mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params) { -#if 0 - struct gl_program *shader = _mesa_lookup_shader(ctx, name); + struct gl_shader *shader = _mesa_lookup_shader(ctx, name); if (!shader) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderiv(shader)"); return; } -#else - struct gl_shader *shader; -#endif + switch (pname) { case GL_SHADER_TYPE: *params = shader->Type; @@ -488,14 +481,13 @@ void _mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) { - struct gl_linked_program *linked - = _mesa_lookup_linked_program(ctx, program); - if (!linked) { + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); + if (!shProg) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramInfoLog(program)"); return; } - /* XXX also test length, infoLog params for NULL? */ - copy_string(linked->InfoLog, bufSize, length, infoLog); + copy_string(infoLog, bufSize, length, shProg->InfoLog); } @@ -503,14 +495,12 @@ void _mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) { - struct gl_program *shProg = _mesa_lookup_shader(ctx, shader); - if (!shProg) { + struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); + if (!sh) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderInfoLog(shader)"); return; } - /* - copy_string(shProg->InfoLog, bufSize, length, infoLog); - */ + copy_string(infoLog, bufSize, length, sh->InfoLog); } @@ -521,12 +511,12 @@ void _mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength, GLsizei *length, GLchar *sourceOut) { - struct gl_program *shProg = _mesa_lookup_shader(ctx, shader); - if (!shProg) { + struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); + if (!sh) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderSource(shader)"); 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, GLfloat *params) { - struct gl_linked_program *linked - = _mesa_lookup_linked_program(ctx, program); - if (linked) { + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); + if (shProg) { GLuint i; - if (location >= 0 && location < linked->Uniforms->NumParameters) { - for (i = 0; i < linked->Uniforms->Parameters[location].Size; i++) { - params[i] = linked->Uniforms->ParameterValues[location][i]; + if (location >= 0 && location < shProg->Uniforms->NumParameters) { + for (i = 0; i < shProg->Uniforms->Parameters[location].Size; i++) { + params[i] = shProg->Uniforms->ParameterValues[location][i]; } } else { @@ -563,11 +553,11 @@ GLint _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name) { if (ctx->Shader.CurrentProgram) { - const struct gl_linked_program *linked = ctx->Shader.CurrentProgram; + const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; GLuint loc; - for (loc = 0; loc < linked->Uniforms->NumParameters; loc++) { + for (loc = 0; loc < shProg->Uniforms->NumParameters; loc++) { const struct gl_program_parameter *u - = linked->Uniforms->Parameters + loc; + = shProg->Uniforms->Parameters + loc; if (u->Type == PROGRAM_UNIFORM && !strcmp(u->Name, name)) { return loc; } @@ -581,15 +571,15 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name) GLboolean _mesa_is_program(GLcontext *ctx, GLuint name) { - struct gl_linked_program *linked = _mesa_lookup_linked_program(ctx, name); - return linked ? GL_TRUE : GL_FALSE; + struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, name); + return shProg ? GL_TRUE : GL_FALSE; } GLboolean _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; } @@ -601,17 +591,17 @@ _mesa_is_shader(GLcontext *ctx, GLuint name) void _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source) { - struct gl_program *shProg = _mesa_lookup_shader(ctx, shader); - if (!shProg) { + struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); + if (!sh) { _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSource(shaderObj)"); return; } /* free old shader source string and install new one */ - if (shProg->String) { - _mesa_free(shProg->String); + if (sh->Source) { + _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 _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_code_object obj; slang_unit_type type; - if (!prog) { + if (!sh) { _mesa_error(ctx, GL_INVALID_VALUE, "glCompileShader(shaderObj)"); return; } @@ -634,24 +624,20 @@ _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj) slang_info_log_construct(&info_log); _slang_code_object_ctr(&obj); - if (prog->Target == GL_VERTEX_PROGRAM_ARB) { + if (sh->Type == GL_VERTEX_SHADER) { type = slang_unit_vertex_shader; } else { - assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB); + assert(sh->Type == GL_FRAGMENT_SHADER); type = slang_unit_fragment_shader; } - if (_slang_compile((const char*) prog->String, &obj, - type, &info_log, prog)) { - /* - prog->CompileStatus = GL_TRUE; - */ + if (_slang_compile(sh->Source, &obj, type, &info_log, sh)) { + sh->CompileStatus = GL_TRUE; } else { - /* - prog->CompileStatus = GL_FALSE; - */ + sh->CompileStatus = GL_FALSE; + /* XXX temporary */ _mesa_problem(ctx, "Program did not compile!"); } } @@ -663,15 +649,15 @@ _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj) void _mesa_link_program(GLcontext *ctx, GLuint program) { - struct gl_linked_program *linked; + struct gl_shader_program *shProg; - linked = _mesa_lookup_linked_program(ctx, program); - if (!linked) { + shProg = _mesa_lookup_shader_program(ctx, program); + if (!shProg) { _mesa_error(ctx, GL_INVALID_OPERATION, "glLinkProgram(program)"); 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! */ if (program) { - struct gl_linked_program *linked; - linked = _mesa_lookup_linked_program(ctx, program); - if (!linked) { + struct gl_shader_program *shProg; + shProg = _mesa_lookup_shader_program(ctx, program); + if (!shProg) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUseProgramObjectARB(programObj)"); return; } - ctx->Shader.CurrentProgram = linked; + ctx->Shader.CurrentProgram = shProg; } else { /* don't use a shader program */ @@ -707,9 +693,9 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, const GLvoid *values, GLenum type) { if (ctx->Shader.CurrentProgram) { - struct gl_linked_program *linked = ctx->Shader.CurrentProgram; - if (location >= 0 && location < linked->Uniforms->NumParameters) { - GLfloat *v = linked->Uniforms->ParameterValues[location]; + struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; + if (location >= 0 && location < shProg->Uniforms->NumParameters) { + GLfloat *v = shProg->Uniforms->ParameterValues[location]; const GLfloat *fValues = (const GLfloat *) values; /* XXX */ GLint i; if (type == GL_FLOAT_VEC4) @@ -791,14 +777,14 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, void _mesa_validate_program(GLcontext *ctx, GLuint program) { - struct gl_linked_program *linked; - linked = _mesa_lookup_linked_program(ctx, program); - if (!linked) { + struct gl_shader_program *shProg; + shProg = _mesa_lookup_shader_program(ctx, program); + if (!shProg) { _mesa_error(ctx, GL_INVALID_OPERATION, "glValidateProgram(program)"); return; } /* XXX temporary */ - linked->Validated = GL_TRUE; + shProg->Validated = GL_TRUE; /* From the GL spec: 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 * -_mesa_new_linked_program(GLcontext *ctx, GLuint name) +struct gl_shader_program * +_mesa_new_shader_program(GLcontext *ctx, GLuint name) { - struct gl_linked_program *linked; - linked = CALLOC_STRUCT(gl_linked_program); - if (linked) { - linked->Name = name; + struct gl_shader_program *shProg; + shProg = CALLOC_STRUCT(gl_shader_program); + if (shProg) { + shProg->Type = GL_SHADER_PROGRAM; + shProg->Name = name; } - return linked; + return shProg; } void -_mesa_free_linked_program_data(GLcontext *ctx, - struct gl_linked_program *linked) +_mesa_free_shader_program_data(GLcontext *ctx, + struct gl_shader_program *shProg) { - if (linked->VertexProgram) { - if (linked->VertexProgram->Base.Parameters == linked->Uniforms) { + assert(shProg->Type == GL_SHADER_PROGRAM); + + if (shProg->VertexProgram) { + if (shProg->VertexProgram->Base.Parameters == shProg->Uniforms) { /* 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); - linked->VertexProgram = NULL; + _mesa_delete_program(ctx, &shProg->VertexProgram->Base); + shProg->VertexProgram = NULL; } - if (linked->FragmentProgram) { - if (linked->FragmentProgram->Base.Parameters == linked->Uniforms) { + if (shProg->FragmentProgram) { + if (shProg->FragmentProgram->Base.Parameters == shProg->Uniforms) { /* 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); - linked->FragmentProgram = NULL; + _mesa_delete_program(ctx, &shProg->FragmentProgram->Base); + shProg->FragmentProgram = NULL; } - if (linked->Uniforms) { - _mesa_free_parameter_list(linked->Uniforms); - linked->Uniforms = NULL; + if (shProg->Uniforms) { + _mesa_free_parameter_list(shProg->Uniforms); + shProg->Uniforms = NULL; } - if (linked->Varying) { - _mesa_free_parameter_list(linked->Varying); - linked->Varying = NULL; + if (shProg->Varying) { + _mesa_free_parameter_list(shProg->Varying); + shProg->Varying = NULL; } } 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(linked); + _mesa_free_shader_program_data(ctx, shProg); + _mesa_free(shProg); } /** * Lookup a GLSL program object. */ -struct gl_linked_program * -_mesa_lookup_linked_program(GLcontext *ctx, GLuint name) +struct gl_shader_program * +_mesa_lookup_shader_program(GLcontext *ctx, GLuint name) { - if (name) - return (struct gl_linked_program *) - _mesa_HashLookup(ctx->Shared->ProgramObjects, name); - else - return NULL; + struct gl_shader_program *shProg; + if (name) { + shProg = (struct gl_shader_program *) + _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; } +/** + * Allocate a new gl_shader object, initialize it. + */ struct gl_shader * _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); shader = CALLOC_STRUCT(gl_shader); if (shader) { - shader->Name = name; shader->Type = type; + shader->Name = name; } return shader; } @@ -910,14 +911,24 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) /** * Lookup a GLSL shader object. */ -struct gl_program * +struct gl_shader * _mesa_lookup_shader(GLcontext *ctx, GLuint name) { - if (name) - return (struct gl_program *) + if (name) { + struct gl_shader *sh = (struct gl_shader *) _mesa_HashLookup(ctx->Shared->ShaderObjects, name); - else - return NULL; + /* 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; } diff --git a/src/mesa/shader/shader_api.h b/src/mesa/shader/shader_api.h index 723f92690d3..2f73bb88871 100644 --- a/src/mesa/shader/shader_api.h +++ b/src/mesa/shader/shader_api.h @@ -38,24 +38,24 @@ extern void _mesa_init_shader_state(GLcontext * ctx); -extern struct gl_linked_program * -_mesa_new_linked_program(GLcontext *ctx, GLuint name); +extern struct gl_shader_program * +_mesa_new_shader_program(GLcontext *ctx, GLuint name); extern void -_mesa_free_linked_program_data(GLcontext *ctx, - struct gl_linked_program *linked); +_mesa_free_shader_program_data(GLcontext *ctx, + struct gl_shader_program *shProg); 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 * -_mesa_lookup_linked_program(GLcontext *ctx, GLuint name); +extern struct gl_shader_program * +_mesa_lookup_shader_program(GLcontext *ctx, GLuint name); extern struct gl_shader * _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); -extern struct gl_program * +extern struct gl_shader * _mesa_lookup_shader(GLcontext *ctx, GLuint name); diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 6aed167e3fd..286e25d54bd 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -2223,6 +2223,7 @@ compile_object(grammar * id, const char *source, slang_code_object * object, } +#if 0 static void slang_create_uniforms(const slang_export_data_table *exports, struct gl_program *program) @@ -2237,16 +2238,34 @@ slang_create_uniforms(const slang_export_data_table *exports, } } } +#endif GLboolean _slang_compile(const char *source, slang_code_object * object, 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; 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_ctr(object); @@ -2265,7 +2284,7 @@ _slang_compile(const char *source, slang_code_object * object, #if NEW_SLANG { GET_CURRENT_CONTEXT(ctx); - slang_create_uniforms(&object->expdata, program); + slang_create_uniforms(&object->expdata, shader); _mesa_print_program(program); _mesa_print_program_parameters(ctx, program); } diff --git a/src/mesa/shader/slang/slang_compile.h b/src/mesa/shader/slang/slang_compile.h index a41c00a3f5e..8a72f43486a 100644 --- a/src/mesa/shader/slang/slang_compile.h +++ b/src/mesa/shader/slang/slang_compile.h @@ -109,7 +109,7 @@ int slang_info_log_warning (slang_info_log *, const char *, ...); void slang_info_log_memory (slang_info_log *); 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 } diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index e96dd51ed47..f56d717873b 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -351,7 +351,7 @@ _slang_link (slang_program *, slang_code_object **, GLuint); extern void _slang_link2(GLcontext *ctx, GLhandleARB h, - struct gl_linked_program *linked); + struct gl_shader_program *shProg); #ifdef __cplusplus } diff --git a/src/mesa/shader/slang/slang_link2.c b/src/mesa/shader/slang/slang_link2.c index 425ad7a87c1..fa29e42706e 100644 --- a/src/mesa/shader/slang/slang_link2.c +++ b/src/mesa/shader/slang/slang_link2.c @@ -43,7 +43,7 @@ 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; 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 = 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) { /* already in list, check size */ - if (var->Size != linked->Varying->Parameters[j].Size) { + if (var->Size != shProg->Varying->Parameters[j].Size) { /* error */ return GL_FALSE; } } else { /* 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); @@ -143,7 +143,7 @@ is_uniform(enum register_file file) 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; @@ -161,12 +161,12 @@ link_uniform_vars(struct gl_linked_program *linked, struct gl_program *prog) assert(is_uniform(p->Type)); if (p->Name) { - j = _mesa_lookup_parameter_index(linked->Uniforms, -1, p->Name); + j = _mesa_lookup_parameter_index(shProg->Uniforms, -1, p->Name); } else { GLuint swizzle; 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)) { assert(j >= 0); } @@ -177,21 +177,21 @@ link_uniform_vars(struct gl_linked_program *linked, struct gl_program *prog) if (j >= 0) { /* 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 { /* not already in linked list */ switch (p->Type) { 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: - 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; 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; case PROGRAM_UNIFORM: - j = _mesa_add_uniform(linked->Uniforms, p->Name, p->Size); + j = _mesa_add_uniform(shProg->Uniforms, p->Name, p->Size); break; default: abort(); @@ -287,41 +287,41 @@ slang_resolve_branches(struct gl_program *prog) void _slang_link2(GLcontext *ctx, GLhandleARB programObj, - struct gl_linked_program *linked) + struct gl_shader_program *shProg) { struct gl_vertex_program *vertProg; struct gl_fragment_program *fragProg; GLuint i; - _mesa_free_linked_program_data(ctx, linked); + _mesa_free_shader_program_data(ctx, shProg); - linked->Uniforms = _mesa_new_parameter_list(); - linked->Varying = _mesa_new_parameter_list(); + shProg->Uniforms = _mesa_new_parameter_list(); + shProg->Varying = _mesa_new_parameter_list(); /** * Find attached vertex shader, fragment shader */ vertProg = NULL; fragProg = NULL; - for (i = 0; i < linked->NumShaders; i++) { - if (linked->Shaders[i]->Target == GL_VERTEX_PROGRAM_ARB) - vertProg = (struct gl_vertex_program *) linked->Shaders[i]; - else if (linked->Shaders[i]->Target == GL_FRAGMENT_PROGRAM_ARB) - fragProg = (struct gl_fragment_program *) linked->Shaders[i]; + for (i = 0; i < shProg->NumShaders; i++) { + if (shProg->Shaders[i]->Type == GL_VERTEX_SHADER) + vertProg = (struct gl_vertex_program *) shProg->Shaders[i]->Programs[0]; + else if (shProg->Shaders[i]->Type == GL_FRAGMENT_SHADER) + fragProg = (struct gl_fragment_program *) shProg->Shaders[i]->Programs[0]; else _mesa_problem(ctx, "unexpected shader target in slang_link2()"); } if (!vertProg || !fragProg) { /* XXX is it legal to have one but not the other?? */ /* XXX record error */ - linked->LinkStatus = GL_FALSE; + shProg->LinkStatus = GL_FALSE; return; } if (!vertProg->Base.Varying || !fragProg->Base.Varying) { /* temporary */ _mesa_problem(ctx, "vertex/fragment program lacks varying list!"); - linked->LinkStatus = GL_FALSE; + shProg->LinkStatus = GL_FALSE; return; } @@ -329,25 +329,25 @@ _slang_link2(GLcontext *ctx, * Make copies of the vertex/fragment programs now since we'll be * 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); - linked->FragmentProgram = (struct gl_fragment_program *) + shProg->FragmentProgram = (struct gl_fragment_program *) _mesa_clone_program(ctx, &fragProg->Base); - link_varying_vars(linked, &linked->VertexProgram->Base); - link_varying_vars(linked, &linked->FragmentProgram->Base); + link_varying_vars(shProg, &shProg->VertexProgram->Base); + link_varying_vars(shProg, &shProg->FragmentProgram->Base); - link_uniform_vars(linked, &linked->VertexProgram->Base); - link_uniform_vars(linked, &linked->FragmentProgram->Base); + link_uniform_vars(shProg, &shProg->VertexProgram->Base); + link_uniform_vars(shProg, &shProg->FragmentProgram->Base); /* The vertex and fragment programs share a common set of uniforms now */ - _mesa_free_parameter_list(linked->VertexProgram->Base.Parameters); - _mesa_free_parameter_list(linked->FragmentProgram->Base.Parameters); - linked->VertexProgram->Base.Parameters = linked->Uniforms; - linked->FragmentProgram->Base.Parameters = linked->Uniforms; + _mesa_free_parameter_list(shProg->VertexProgram->Base.Parameters); + _mesa_free_parameter_list(shProg->FragmentProgram->Base.Parameters); + shProg->VertexProgram->Base.Parameters = shProg->Uniforms; + shProg->FragmentProgram->Base.Parameters = shProg->Uniforms; - slang_resolve_branches(&linked->VertexProgram->Base); - slang_resolve_branches(&linked->FragmentProgram->Base); + slang_resolve_branches(&shProg->VertexProgram->Base); + slang_resolve_branches(&shProg->FragmentProgram->Base); #if 1 printf("************** original fragment program\n"); @@ -356,8 +356,8 @@ _slang_link2(GLcontext *ctx, #endif #if 1 printf("************** linked fragment prog\n"); - _mesa_print_program(&linked->FragmentProgram->Base); - _mesa_print_program_parameters(ctx, &linked->FragmentProgram->Base); + _mesa_print_program(&shProg->FragmentProgram->Base); + _mesa_print_program_parameters(ctx, &shProg->FragmentProgram->Base); #endif #if 1 printf("************** original vertex program\n"); @@ -366,10 +366,10 @@ _slang_link2(GLcontext *ctx, #endif #if 1 printf("************** linked vertex prog\n"); - _mesa_print_program(&linked->VertexProgram->Base); - _mesa_print_program_parameters(ctx, &linked->VertexProgram->Base); + _mesa_print_program(&shProg->VertexProgram->Base); + _mesa_print_program_parameters(ctx, &shProg->VertexProgram->Base); #endif - linked->LinkStatus = (linked->VertexProgram && linked->FragmentProgram); + shProg->LinkStatus = (shProg->VertexProgram && shProg->FragmentProgram); } -- cgit v1.2.3 From 5cf7326132a37f11357b5cb31bcc9238fef5b54c Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 5 Jan 2007 16:02:45 -0700 Subject: Checkpoint glsl compiler work: sampler uniforms now implemented, linked properly. --- src/mesa/shader/shader_api.c | 9 +- .../shader/slang/library/slang_common_builtin.gc | 43 ++--- .../shader/slang/library/slang_common_builtin_gc.h | 179 ++++++++++----------- .../shader/slang/library/slang_fragment_builtin.gc | 26 +-- .../slang/library/slang_fragment_builtin_gc.h | 99 +++++------- src/mesa/shader/slang/slang_codegen.c | 92 ++++++++++- src/mesa/shader/slang/slang_codegen.h | 3 + src/mesa/shader/slang/slang_compile.c | 67 +------- src/mesa/shader/slang/slang_emit.c | 42 +++-- src/mesa/shader/slang/slang_ir.h | 1 - src/mesa/shader/slang/slang_link.h | 5 + src/mesa/shader/slang/slang_link2.c | 77 ++++++--- 12 files changed, 359 insertions(+), 284 deletions(-) (limited to 'src/mesa/shader/slang/slang_link.h') diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index d6dacdd6793..bd258f8737b 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -741,7 +741,8 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name) * We need to handle things like "e.c[0].b" as seen in the * GLSL orange book, page 189. */ - if (u->Type == PROGRAM_UNIFORM && !strcmp(u->Name, name)) { + if ((u->Type == PROGRAM_UNIFORM || + u->Type == PROGRAM_SAMPLER) && !strcmp(u->Name, name)) { return loc; } } @@ -925,6 +926,12 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, return; } } + + if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) { + _slang_resolve_samplers(shProg, &shProg->VertexProgram->Base); + _slang_resolve_samplers(shProg, &shProg->FragmentProgram->Base); + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + } } diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc index 44e059f5a0d..52f5b96d888 100644 --- a/src/mesa/shader/slang/library/slang_common_builtin.gc +++ b/src/mesa/shader/slang/library/slang_common_builtin.gc @@ -1611,36 +1611,43 @@ bvec4 not (const bvec4 v) -// -// 8.7 Texture Lookup Functions -// +//// Texture Lookup Functions (for both fragment and vertex shaders) -vec4 texture1D (sampler1D sampler, float coord) { - vec4 texel; - __asm vec4_tex1d texel, sampler, coord, 0.0; - return texel; +vec4 texture1D(const sampler1D sampler, const float coord) +{ + __asm vec4_tex1d __retVal, coord; // XXX sampler } -vec4 texture1DProj (sampler1D sampler, vec2 coord) { - return texture1D (sampler, coord.s / coord.t); +vec4 texture1DProj(const sampler1D sampler, const vec2 coord) +{ + float pcoord = coord.s / coord.t; + __asm vec4_tex1d __retVal, pcoord; // XXX sampler } -vec4 texture1DProj (sampler1D sampler, vec4 coord) { - return texture1D (sampler, coord.s / coord.q); +vec4 texture1DProj(const sampler1D sampler, const vec4 coord) +{ + float pcoord = coord.s / coord.q; + __asm vec4_tex1d __retVal, pcoord; // XXX sampler } + vec4 texture2D(const sampler2D sampler, const vec2 coord) { - __asm vec4_tex2d __retVal, coord; // XXX sampler + __asm vec4_tex2d __retVal, sampler, coord; // XXX sampler } -vec4 texture2DProj (sampler2D sampler, vec3 coord) { - return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p)); -} +//vec4 texture2DProj(const sampler2D sampler, const vec3 coord) +//{ +// vec2 pcoord = coord.st / coord.p; +// __asm vec4_tex2d __retVal, pcoord; // XXX sampler +//} + +//vec4 texture2DProj(const sampler2D sampler, const vec4 coord) +//{ +// vec2 pcoord = coord.st / coord.q; +// __asm vec4_tex2d __retVal, pcoord; // XXX sampler +//} -vec4 texture2DProj (sampler2D sampler, vec4 coord) { - return texture2D (sampler, vec2 (coord.s / coord.q, coord.t / coord.q)); -} vec4 texture3D (sampler3D sampler, vec3 coord) { vec4 texel; diff --git a/src/mesa/shader/slang/library/slang_common_builtin_gc.h b/src/mesa/shader/slang/library/slang_common_builtin_gc.h index 69c1960c737..e418f532139 100644 --- a/src/mesa/shader/slang/library/slang_common_builtin_gc.h +++ b/src/mesa/shader/slang/library/slang_common_builtin_gc.h @@ -670,100 +670,93 @@ 111,116,0,1,1,0,3,118,0,0,0,1,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,59, 120,121,122,0,0,18,118,0,0,17,48,0,48,0,0,0,0,0,1,0,4,0,110,111,116,0,1,1,0,4,118,0,0,0,1,4,118, 101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,17,48,0,48,0,0,0,0,0,1,0, -12,0,116,101,120,116,117,114,101,49,68,0,1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,9,99,111, -111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,116,101,120,49,100,0, -18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,17,48,0,48, -0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0, -1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100,0,0,0,1,8,58,116,101,120,116, -117,114,101,49,68,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18,99,111, -111,114,100,0,59,116,0,49,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,0, -0,16,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,116,101,120,116,117, -114,101,49,68,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111, -114,100,0,59,113,0,49,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,0,1,1,0,17,115,97,109,112, -108,101,114,0,0,1,1,0,10,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,50,100,0,18,95, -95,114,101,116,86,97,108,0,0,18,99,111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50, -68,80,114,111,106,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,8, -58,116,101,120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,0,18,99, -111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,112,0,49,0,18,99,111,111,114,100,0,59,116,0, -18,99,111,111,114,100,0,59,112,0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114, -111,106,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,116,101, -120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,0,18,99,111,111,114, -100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111, -111,114,100,0,59,113,0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,0,1,0,0,18,115,97, -109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4, -118,101,99,52,95,116,101,120,51,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0, -18,99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,116,101,120, -116,117,114,101,51,68,80,114,111,106,0,1,0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111, -114,100,0,0,0,1,8,58,116,101,120,116,117,114,101,51,68,0,18,115,97,109,112,108,101,114,0,0,58,118, -101,99,51,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111, -114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18,99, -111,111,114,100,0,59,113,0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,67,117,98,101,0,1,0, -0,19,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101, -108,0,0,0,4,118,101,99,52,95,116,101,120,99,117,98,101,0,18,116,101,120,101,108,0,0,18,115,97,109, -112,108,101,114,0,0,18,99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1, -0,12,0,115,104,97,100,111,119,49,68,0,1,0,0,20,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111, -114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,115,104,97,100,49,100,0,18, -116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,17,48,0,48,0,0, -0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,80,114,111,106,0,1,0,0,20, -115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,115,104,97,100,111,119,49, -68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0,59,115,0,18,99, -111,111,114,100,0,59,113,0,49,0,17,48,0,48,0,0,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111, -114,100,0,59,113,0,49,0,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,0,1,0,0,21,115,97,109,112, -108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101, -99,52,95,115,104,97,100,50,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18, -99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104,97,100, -111,119,50,68,80,114,111,106,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100, -0,0,0,1,8,58,115,104,97,100,111,119,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0, +12,0,116,101,120,116,117,114,101,49,68,0,1,1,0,16,115,97,109,112,108,101,114,0,0,1,1,0,9,99,111, +111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18, +99,111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,1,0,16, +115,97,109,112,108,101,114,0,0,1,1,0,10,99,111,111,114,100,0,0,0,1,3,2,0,9,1,112,99,111,111,114, +100,0,2,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,116,0,49,0,0,4,118,101,99,52, +95,116,101,120,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,112,99,111,111,114,100,0,0,0,0,1,0, +12,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,1,0,16,115,97,109,112,108,101,114,0,0,1, +1,0,12,99,111,111,114,100,0,0,0,1,3,2,0,9,1,112,99,111,111,114,100,0,2,18,99,111,111,114,100,0,59, +115,0,18,99,111,111,114,100,0,59,113,0,49,0,0,4,118,101,99,52,95,116,101,120,49,100,0,18,95,95,114, +101,116,86,97,108,0,0,18,112,99,111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68, +0,1,1,0,17,115,97,109,112,108,101,114,0,0,1,1,0,10,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95, +116,101,120,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99, +111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,0,1,0,0,18,115,97,109,112,108, +101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99, +52,95,116,101,120,51,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111, +111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,116,101,120,116,117,114, +101,51,68,80,114,111,106,0,1,0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0, +0,1,8,58,116,101,120,116,117,114,101,51,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0, 18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59, 116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100, -0,59,113,0,49,0,0,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,9,120,0,0,0,1,3,2,0,9,1,97,0,0,0, -4,102,108,111,97,116,95,110,111,105,115,101,49,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110, -111,105,115,101,49,0,1,0,0,10,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111,105, -115,101,50,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,11,120,0, -0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111,105,115,101,51,0,18,97,0,0,18,120,0,0,0,8, -18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,12,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111, -97,116,95,110,111,105,115,101,52,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,10,0,110,111,105,115, -101,50,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58, -110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101, -50,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110, -111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0, -0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111, -105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0, -51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101, -50,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110, -111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51, -0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,9,120,0, -0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0, -18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,46,0, -0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111, +0,59,113,0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,67,117,98,101,0,1,0,0,19,115,97,109, +112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118, +101,99,52,95,116,101,120,99,117,98,101,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114, +0,0,18,99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104, +97,100,111,119,49,68,0,1,0,0,20,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1, +3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,115,104,97,100,49,100,0,18,116,101,120,101, +108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116, +101,120,101,108,0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,80,114,111,106,0,1,0,0,20,115,97,109, +112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,115,104,97,100,111,119,49,68,0,18,115, +97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114, +100,0,59,113,0,49,0,17,48,0,48,0,0,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59, +113,0,49,0,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,0,1,0,0,21,115,97,109,112,108,101,114,0, +0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,115, +104,97,100,50,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114, +100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,80, +114,111,106,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,115, +104,97,100,111,119,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114, +100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111, +111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0, +0,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,9,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97, +116,95,110,111,105,115,101,49,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101, +49,0,1,0,0,10,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111,105,115,101,50,0,18, +97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,11,120,0,0,0,1,3,2,0,9,1, +97,0,0,0,4,102,108,111,97,116,95,110,111,105,115,101,51,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0, +9,0,110,111,105,115,101,49,0,1,0,0,12,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110, +111,105,115,101,52,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0, +9,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115, +101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,10, +120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101, +49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,0,0,0,0,1,0, +10,0,110,111,105,115,101,50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49, +0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17, +55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,12, +120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101, +49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17, +50,0,55,55,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,9,120,0,0,0,1,8,58,118, +101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,49, +57,0,51,52,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,46,0,0,0,0,0,0,1,0, +11,0,110,111,105,115,101,51,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49, +0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17, +55,0,54,54,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,53,0,52,55, +0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,11,120,0,0,0, +1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18, +120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0, +58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0, +17,49,49,0,48,52,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,12,120,0,0,0,1,8, +58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0, +58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0, +0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49, +55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111, +105,115,101,52,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115,101,49,0,18,120,0,0,0, +0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,58,110,111,105,115,101,49,0, +18,120,0,17,53,0,52,55,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,50,51,0,53,52,0,0,46,0, +0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111, 105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0, 51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0, -17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0, -0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105, -115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51, -0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,53,0,52,55,0,0,0,17,49, -55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0, -12,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115, -101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0, -0,17,50,0,55,55,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0, -52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,0,0,0, -1,0,12,0,110,111,105,115,101,52,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115,101, -49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,58,110,111, -105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,50,51, -0,53,52,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99, -52,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99, -50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58, -118,101,99,50,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0, -18,120,0,58,118,101,99,50,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,0,46,0,0,0,0,0,0,1,0,12, -0,110,111,105,115,101,52,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115,101,49,0, -18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17, -55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99, -51,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,0,58,110,111,105, -115,101,49,0,18,120,0,58,118,101,99,51,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0, -57,49,0,0,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,12,120,0,0,0,1,8,58,118,101, -99,52,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101, -99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0, -0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0, -0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0, -58,118,101,99,52,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,17,51,55,0, -52,56,0,0,0,0,46,0,0,0,0,0,0,0 +17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118, +101,99,50,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111,105, +115,101,52,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0, +58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0, +17,51,0,50,51,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,53,0,52, +55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18, +120,0,58,118,101,99,51,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,0,46, +0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111, +105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0, +51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,0,58,110,111,105, +115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48, +52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0, +17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,17,51,55,0,52,56,0,0,0,0,46,0, +0,0,0,0,0,0 diff --git a/src/mesa/shader/slang/library/slang_fragment_builtin.gc b/src/mesa/shader/slang/library/slang_fragment_builtin.gc index 373b42de1d5..474535bfb1a 100644 --- a/src/mesa/shader/slang/library/slang_fragment_builtin.gc +++ b/src/mesa/shader/slang/library/slang_fragment_builtin.gc @@ -60,19 +60,19 @@ vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias) { return texture1D (sampler, coord.s / coord.q, bias); } -vec4 texture2D (sampler2D sampler, vec2 coord, float bias) { - vec4 texel; - __asm vec4_tex2d texel, sampler, coord, bias; - return texel; -} - -vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias) { - return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p), bias); -} - -vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias) { - return texture2D (sampler, vec2 (coord.s / coord.q, coord.t / coord.q), bias); -} +//vec4 texture2D (sampler2D sampler, vec2 coord, float bias) { +// vec4 texel; +// __asm vec4_tex2d texel, sampler, coord, bias; +// return texel; +//} + +//vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias) { +// return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p), bias); +//} + +//vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias) { +// return texture2D (sampler, vec2 (coord.s / coord.q, coord.t / coord.q), bias); +//} vec4 texture3D (sampler3D sampler, vec3 coord, float bias) { vec4 texel; diff --git a/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h b/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h index b7f1d3816c1..69b90fb9da9 100644 --- a/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h +++ b/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h @@ -20,60 +20,47 @@ 1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0, 0,1,8,58,116,101,120,116,117,114,101,49,68,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114, 100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0,116,101, -120,116,117,114,101,50,68,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100,0, +120,116,117,114,101,51,68,0,1,0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0, 0,1,0,0,9,98,105,97,115,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,116,101, -120,50,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0, -0,18,98,105,97,115,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68, -80,114,111,106,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9, -98,105,97,115,0,0,0,1,8,58,116,101,120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0,0, -58,118,101,99,50,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,112,0,49,0,18,99, -111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,112,0,49,0,0,0,18,98,105,97,115,0,0,0,0,0,1, -0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,0,0,17,115,97,109,112,108,101,114,0,0, -1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,116,101,120,116,117,114,101,50, -68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,0,18,99,111,111,114,100,0,59,115,0,18,99, -111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0, -49,0,0,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,0,1,0,0,18,115,97, -109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,3,2,0,12,1, -116,101,120,101,108,0,0,0,4,118,101,99,52,95,116,101,120,51,100,0,18,116,101,120,101,108,0,0,18, -115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,18,98,105,97,115,0,0,0,8,18,116,101,120, -101,108,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,80,114,111,106,0,1,0,0,18,115,97,109,112, -108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,116,101,120,116, -117,114,101,51,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0, -59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111,111,114, -100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,18, -98,105,97,115,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,67,117,98,101,0,1,0,0,19,115,97,109, -112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,3,2,0,12,1,116, -101,120,101,108,0,0,0,4,118,101,99,52,95,116,101,120,99,117,98,101,0,18,116,101,120,101,108,0,0,18, -115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,18,98,105,97,115,0,0,0,8,18,116,101,120, -101,108,0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,0,1,0,0,20,115,97,109,112,108,101,114,0,0,1,0, -0,11,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4, -118,101,99,52,95,115,104,97,100,49,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114, -0,0,18,99,111,111,114,100,0,0,18,98,105,97,115,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115, -104,97,100,111,119,49,68,80,114,111,106,0,1,0,0,20,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111, -111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,115,104,97,100,111,119,49,68,0,18,115,97,109, -112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59, -113,0,49,0,17,48,0,48,0,0,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0, -0,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,0,1,0,0,21,115,97,109,112,108, -101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,3,2,0,12,1,116,101,120, -101,108,0,0,0,4,118,101,99,52,95,115,104,97,100,50,100,0,18,116,101,120,101,108,0,0,18,115,97,109, -112,108,101,114,0,0,18,99,111,111,114,100,0,0,18,98,105,97,115,0,0,0,8,18,116,101,120,101,108,0,0, -0,1,0,12,0,115,104,97,100,111,119,50,68,80,114,111,106,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1, -0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,115,104,97,100,111,119,50,68,0,18, -115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111, -114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18, -99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,18,98,105,97,115,0,0,0,0,0, -1,0,9,0,100,70,100,120,0,1,0,0,9,112,0,0,0,1,8,17,48,0,48,48,49,0,0,0,0,1,0,10,0,100,70,100,120,0, -1,0,0,10,112,0,0,0,1,8,58,118,101,99,50,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,11,0,100,70,100,120,0,1, -0,0,11,112,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,12,0,100,70,100,120,0,1,0, -0,12,112,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,9,0,100,70,100,121,0,1,0,0, -9,112,0,0,0,1,8,17,48,0,48,48,49,0,0,0,0,1,0,10,0,100,70,100,121,0,1,0,0,10,112,0,0,0,1,8,58,118, -101,99,50,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,11,0,100,70,100,121,0,1,0,0,11,112,0,0,0,1,8,58,118, -101,99,51,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,12,0,100,70,100,121,0,1,0,0,12,112,0,0,0,1,8,58,118, -101,99,52,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,9,0,102,119,105,100,116,104,0,1,0,0,9,112,0,0,0,1,8, -58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0, -0,0,0,46,0,0,1,0,10,0,102,119,105,100,116,104,0,1,0,0,10,112,0,0,0,1,8,58,97,98,115,0,58,100,70, -100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,11,0,102, -119,105,100,116,104,0,1,0,0,11,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0, -58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,12,0,102,119,105,100,116,104,0,1,0, -0,12,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70, -100,121,0,18,112,0,0,0,0,0,46,0,0,0 +120,51,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0, +0,18,98,105,97,115,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68, +80,114,111,106,0,1,0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9, +98,105,97,115,0,0,0,1,8,58,116,101,120,116,117,114,101,51,68,0,18,115,97,109,112,108,101,114,0,0, +58,118,101,99,51,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99, +111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0, +18,99,111,111,114,100,0,59,113,0,49,0,0,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0,116,101,120,116,117, +114,101,67,117,98,101,0,1,0,0,19,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1, +0,0,9,98,105,97,115,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,116,101,120,99, +117,98,101,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0, +0,18,98,105,97,115,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,0,1, +0,0,20,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0, +1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,115,104,97,100,49,100,0,18,116,101,120, +101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,18,98,105,97,115,0,0,0,8, +18,116,101,120,101,108,0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,80,114,111,106,0,1,0,0,20,115, +97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,115, +104,97,100,111,119,49,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114, +100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,17,48,0,48,0,0,0,18,99,111,111,114,100,0,59, +112,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0,115,104,97,100, +111,119,50,68,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,98, +105,97,115,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,115,104,97,100,50,100,0, +18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,18,98,105, +97,115,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,80,114,111,106,0, +1,0,0,21,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0, +0,1,8,58,115,104,97,100,111,119,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99, +111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116,0, +18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59, +113,0,49,0,0,0,18,98,105,97,115,0,0,0,0,0,1,0,9,0,100,70,100,120,0,1,0,0,9,112,0,0,0,1,8,17,48,0, +48,48,49,0,0,0,0,1,0,10,0,100,70,100,120,0,1,0,0,10,112,0,0,0,1,8,58,118,101,99,50,0,17,48,0,48,48, +49,0,0,0,0,0,0,1,0,11,0,100,70,100,120,0,1,0,0,11,112,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,48, +49,0,0,0,0,0,0,1,0,12,0,100,70,100,120,0,1,0,0,12,112,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,48, +49,0,0,0,0,0,0,1,0,9,0,100,70,100,121,0,1,0,0,9,112,0,0,0,1,8,17,48,0,48,48,49,0,0,0,0,1,0,10,0, +100,70,100,121,0,1,0,0,10,112,0,0,0,1,8,58,118,101,99,50,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,11,0, +100,70,100,121,0,1,0,0,11,112,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,12,0, +100,70,100,121,0,1,0,0,12,112,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,9,0, +102,119,105,100,116,104,0,1,0,0,9,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0, +0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,10,0,102,119,105,100,116,104,0,1, +0,0,10,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70, +100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,11,0,102,119,105,100,116,104,0,1,0,0,11,112,0,0,0,1,8,58,97, +98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0, +46,0,0,1,0,12,0,102,119,105,100,116,104,0,1,0,0,12,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120, +0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,0 diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 3b96ec0a887..90d17122b66 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -92,7 +92,9 @@ static slang_asm_info AsmInfo[] = { { "float_divide", IR_DIV, 1, 2 }, { "float_power", IR_POW, 1, 2 }, /* texture / sampler */ - { "vec4_tex2d", IR_TEX, 1, 1 }, + { "vec4_tex1d", IR_TEX, 1, 1 }, + { "vec4_texb1d", IR_TEXB, 1, 3 }, + { "vec4_tex2d", IR_TEX, 1, 2 }, { "vec4_texb2d", IR_TEXB, 1, 3 }, /* unary op */ { "int_to_float", IR_I_TO_F, 1, 1 }, @@ -196,7 +198,7 @@ new_var(slang_assemble_ctx *A, slang_operation *oper, oper->var = v; n->Swizzle = swizzle; n->Var = v; - slang_resolve_storage(A->codegen/**NULL**/, n, A->program); + slang_resolve_storage(A->codegen, n, A->program); return n; } @@ -801,10 +803,6 @@ _slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper, free(n0); } - if (info->Opcode == IR_TEX || info->Opcode == IR_TEXB) { - n->TexTarget = TEXTURE_2D_INDEX; - } - return n; } @@ -1568,8 +1566,10 @@ _slang_codegen_function(slang_assemble_ctx * A, slang_function * fun) slang_print_function(fun, 1); #endif - A->program->Parameters = _mesa_new_parameter_list(); - A->program->Varying = _mesa_new_parameter_list(); + /* should have been allocated earlier: */ + assert(A->program->Parameters ); + assert(A->program->Varying); + A->codegen = _slang_new_codegen_context(); /*printf("** Begin Simplify\n");*/ @@ -1608,3 +1608,79 @@ _slang_codegen_function(slang_assemble_ctx * A, slang_function * fun) } +static GLint +sampler_to_texture_index(const slang_type_specifier_type type) +{ + switch (type) { + case slang_spec_sampler1D: + return TEXTURE_1D_INDEX; + case slang_spec_sampler2D: + return TEXTURE_2D_INDEX; + case slang_spec_sampler3D: + return TEXTURE_3D_INDEX; + case slang_spec_samplerCube: + return TEXTURE_CUBE_INDEX; + case slang_spec_sampler1DShadow: + return TEXTURE_1D_INDEX; /* XXX fix */ + case slang_spec_sampler2DShadow: + return TEXTURE_2D_INDEX; /* XXX fix */ + default: + return -1; + } +} + + + +static GLint +slang_alloc_sampler(struct gl_program *prog, const char *name) +{ + GLint i = _mesa_add_sampler(prog->Parameters, name); + return i; +} + + +/** + * Called by compiler when a global variable has been parsed/compiled. + * Here we examine the variable's type to determine what kind of register + * storage will be used. + * + * A uniform such as "gl_Position" will become the register specification + * (PROGRAM_OUTPUT, VERT_RESULT_HPOS). Or, uniform "gl_FogFragCoord" + * will be (PROGRAM_INPUT, FRAG_ATTRIB_FOGC). + * + * Samplers are interesting. For "uniform sampler2D tex;" we'll specify + * (PROGRAM_SAMPLER, index) where index is resolved at link-time to an + * actual texture unit (as specified by the user calling glUniform1i()). + */ +void +_slang_codegen_global_variable(slang_variable *var, struct gl_program *prog) +{ + GLint texIndex; + slang_ir_storage *store = NULL; + + texIndex = sampler_to_texture_index(var->type.specifier.type); + + if (texIndex != -1) { + /* Texture sampler: + * store->File = PROGRAM_SAMPLER + * store->Index = sampler uniform location + * store->Size = texture type index (1D, 2D, 3D, cube, etc) + */ + GLint samplerUniform = slang_alloc_sampler(prog, (char *) var->a_name); + store = _slang_new_ir_storage(PROGRAM_SAMPLER, samplerUniform, texIndex); + printf("SAMPLER "); + } + else if (var->type.qualifier == slang_qual_uniform) { + printf("UNIFORM "); + } + + printf("CODEGEN VAR %s\n", (char*) var->a_name); + + assert(!var->aux); +#if 1 + var->aux = store; +#endif + /** + XXX allocate variable storage (aux), at least the register file. + */ +} diff --git a/src/mesa/shader/slang/slang_codegen.h b/src/mesa/shader/slang/slang_codegen.h index 042737b2b5c..ef2ccd4ebf1 100644 --- a/src/mesa/shader/slang/slang_codegen.h +++ b/src/mesa/shader/slang/slang_codegen.h @@ -35,5 +35,8 @@ extern struct slang_ir_node_ * _slang_codegen_function(slang_assemble_ctx *A , struct slang_function_ *fun); +extern void +_slang_codegen_global_variable(slang_variable *var, struct gl_program *prog); + #endif /* SLANG_CODEGEN_H */ diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index da77de709c3..711849d72f9 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -803,25 +803,7 @@ parse_child_operation(slang_parse_ctx * C, slang_output_ctx * O, slang_operation *ch; /* grow child array */ -#if 000 - oper->children = (slang_operation *) - slang_alloc_realloc(oper->children, - oper->num_children * sizeof(slang_operation), - (oper->num_children + 1) * sizeof(slang_operation)); - if (oper->children == NULL) { - slang_info_log_memory(C->L); - return 0; - } - - ch = &oper->children[oper->num_children]; - if (!slang_operation_construct(ch)) { - slang_info_log_memory(C->L); - return 0; - } - oper->num_children++; -#else ch = slang_operation_grow(&oper->num_children, &oper->children); -#endif if (statement) return parse_statement(C, O, ch); return parse_expression(C, O, ch); @@ -860,44 +842,6 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O, /* local variable declaration, individual declarators are stored as * children identifiers */ -#if 000 - oper->type = slang_oper_variable_decl; - { - const unsigned int first_var = O->vars->num_variables; - - /* parse the declaration, note that there can be zero or more - * than one declarators - */ - if (!parse_declaration(C, O)) - return 0; - if (first_var < O->vars->num_variables) { - const unsigned int num_vars = O->vars->num_variables - first_var; - unsigned int i; - - oper->children = (slang_operation *) - slang_alloc_malloc(num_vars * sizeof(slang_operation)); - if (oper->children == NULL) { - slang_info_log_memory(C->L); - return 0; - } - for (oper->num_children = 0; oper->num_children < num_vars; - oper->num_children++) { - if (!slang_operation_construct - (&oper->children[oper->num_children])) { - slang_info_log_memory(C->L); - return 0; - } - } - for (i = first_var; i < O->vars->num_variables; i++) { - slang_operation *o = &oper->children[i - first_var]; - o->type = slang_oper_identifier; - o->locals->outer_scope = O->vars; - o->a_id = O->vars->variables[i].a_name; - } - } - } -#else - oper->type = slang_oper_block_no_new_scope; { const unsigned int first_var = O->vars->num_variables; @@ -925,9 +869,6 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O, } } } - - -#endif break; case OP_ASM: /* the __asm statement, parse the mnemonic and all its arguments @@ -1776,6 +1717,11 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, return 0; } +#if 1 + if (C->global_scope && O->program) + _slang_codegen_global_variable(var, O->program); +#endif + /* allocate global address space for a variable with a known size */ if (C->global_scope && !(var->type.specifier.type == slang_spec_array @@ -2309,6 +2255,9 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) = (struct gl_program **) malloc(sizeof(struct gl_program*)); shader->Programs[0] = _mesa_new_program(ctx, progTarget, 1); shader->NumPrograms = 1; + + shader->Programs[0]->Parameters = _mesa_new_parameter_list(); + shader->Programs[0]->Varying = _mesa_new_parameter_list(); } slang_info_log_construct(&info_log); diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index a3d970694f9..3f1f1373c61 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -184,6 +184,7 @@ storage_string(const slang_ir_storage *st) "UNIFORM", "WRITE_ONLY", "ADDRESS", + "SAMPLER", "UNDEFINED" }; static char s[100]; @@ -194,10 +195,8 @@ storage_string(const slang_ir_storage *st) sprintf(s, "%s[%d..%d]", files[st->File], st->Index, st->Index + st->Size - 1); #endif - if (st->File == 1000) - sprintf(s, "sampler"); - else - sprintf(s, "%s[%d]", files[st->File], st->Index); + assert(st->File < sizeof(files) / sizeof(files[0])); + sprintf(s, "%s[%d]", files[st->File], st->Index); return s; } @@ -680,10 +679,12 @@ slang_resolve_storage(slang_gen_context *gc, slang_ir_node *n, assert(n->Var); if (is_sampler_type(&n->Var->type)) { /* i.e. "uniform sampler2D tex;" */ -#define PROGRAM_SAMPLER 1000 n->Store->File = PROGRAM_SAMPLER; n->Store->Size = 1; /* never used */ n->Store->Index = alloc_sampler(gc); + n->Store->Index = slang_alloc_uniform(prog, (char *) n->Var->a_name, 1); + printf("********** Alloc sampler uniform %d\n", n->Store->Index); + abort(); /* this is a locally-declared sampler */ } else if (n->Store->Index < 0) { /* XXX assert this? */ assert(gc); @@ -701,12 +702,18 @@ slang_resolve_storage(slang_gen_context *gc, slang_ir_node *n, return; } + /* + assert(!is_sampler_type(&n->Var->type)); + */ + if (n->Opcode == IR_VAR && n->Store->File == PROGRAM_UNDEFINED) { /* try to determine the storage for this variable */ GLint i; assert(n->Var); + /*if (is_sampler(*/ + if (n->Store->Size < 0) { /* determine var/storage size now */ n->Store->Size = sizeof_type(&n->Var->type); @@ -766,14 +773,7 @@ slang_resolve_storage(slang_gen_context *gc, slang_ir_node *n, else if (n->Var->type.qualifier == slang_qual_varying) { i = slang_alloc_varying(prog, (char *) n->Var->a_name); if (i >= 0) { -#ifdef OLD_LINK - if (prog->Target == GL_VERTEX_PROGRAM_ARB) - n->Store->File = PROGRAM_OUTPUT; - else - n->Store->File = PROGRAM_INPUT; -#else n->Store->File = PROGRAM_VARYING; -#endif n->Store->Index = i; return; } @@ -1023,14 +1023,24 @@ emit_tex(slang_gen_context *gc, slang_ir_node *n, struct gl_program *prog) inst = new_instruction(prog, OPCODE_TXB); } + if (!n->Store) + slang_alloc_temp_storage(gc, n, 4); + storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask); - storage_to_src_reg(&inst->SrcReg[0], n->Children[0]->Store, - n->Children[0]->Swizzle); + /* Child[1] is the coord */ + storage_to_src_reg(&inst->SrcReg[0], n->Children[1]->Store, + n->Children[1]->Swizzle); - inst->TexSrcTarget = n->TexTarget; - inst->TexSrcUnit = 0; /* XXX temp */ + /* Child[0] is the sampler (a uniform which'll indicate the texture unit) */ + assert(n->Children[0]->Store); + assert(n->Children[0]->Store->Size >= TEXTURE_1D_INDEX); + inst->Sampler = n->Children[0]->Store->Index; /* i.e. uniform's index */ + inst->TexSrcTarget = n->Children[0]->Store->Size; + inst->TexSrcUnit = 27; /* Dummy value; the TexSrcUnit will be computed at + * link time, using the sampler uniform's value. + */ return inst; } diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h index b43ff1db618..0613121b989 100644 --- a/src/mesa/shader/slang/slang_ir.h +++ b/src/mesa/shader/slang/slang_ir.h @@ -112,7 +112,6 @@ typedef struct slang_ir_node_ GLfloat Value[4]; /**< If Opcode == IR_FLOAT */ slang_variable *Var; slang_ir_storage *Store; - GLuint TexTarget; /**< If Opcode == IR_TEX or IR_TEXB */ } slang_ir_node; diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index f56d717873b..2fc5525000f 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -353,6 +353,11 @@ extern void _slang_link2(GLcontext *ctx, GLhandleARB h, struct gl_shader_program *shProg); +extern void +_slang_resolve_samplers(struct gl_shader_program *shProg, + struct gl_program *prog); + + #ifdef __cplusplus } #endif diff --git a/src/mesa/shader/slang/slang_link2.c b/src/mesa/shader/slang/slang_link2.c index 33813fecc4a..8b59d7f76a9 100644 --- a/src/mesa/shader/slang/slang_link2.c +++ b/src/mesa/shader/slang/slang_link2.c @@ -138,6 +138,7 @@ is_uniform(enum register_file file) file == PROGRAM_STATE_VAR || file == PROGRAM_NAMED_PARAM || file == PROGRAM_CONSTANT || + file == PROGRAM_SAMPLER || file == PROGRAM_UNIFORM); } @@ -148,7 +149,8 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) GLuint *map, i; #if 0 - _mesa_print_parameter_list(prog->Parameters); + printf("================ pre link uniforms ===============\n"); + _mesa_print_parameter_list(shProg->Uniforms); #endif map = (GLuint *) malloc(prog->Parameters->NumParameters * sizeof(GLuint)); @@ -201,6 +203,9 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) case PROGRAM_UNIFORM: j = _mesa_add_uniform(shProg->Uniforms, p->Name, p->Size); break; + case PROGRAM_SAMPLER: + j = _mesa_add_sampler(shProg->Uniforms, p->Name); + break; default: abort(); } @@ -218,6 +223,11 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) } +#if 0 + printf("================ post link uniforms ===============\n"); + _mesa_print_parameter_list(shProg->Uniforms); +#endif + #if 0 { GLuint i; @@ -244,7 +254,14 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) inst->SrcReg[j].Index = map[ inst->SrcReg[j].Index ]; } } - /* XXX update program OutputsWritten, InputsRead */ + + if (inst->Opcode == OPCODE_TEX || + inst->Opcode == OPCODE_TXB || + inst->Opcode == OPCODE_TXB) { + printf("====== remap sampler from %d to %d\n", + inst->Sampler, map[ inst->Sampler ]); + inst->Sampler = map[ inst->Sampler ]; + } } free(map); @@ -257,7 +274,7 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) * XXX Temporary */ static void -slang_resolve_branches(struct gl_program *prog) +_slang_resolve_branches(struct gl_program *prog) { struct target { const char *Name; @@ -293,22 +310,47 @@ slang_resolve_branches(struct gl_program *prog) } +/** + * Scan program for texture instructions, lookup sampler/uniform's value + * to determine which texture unit to use. + * Also, update the program's TexturesUsed[] array. + */ +void +_slang_resolve_samplers(struct gl_shader_program *shProg, + struct gl_program *prog) +{ + GLuint i; + + for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) + prog->TexturesUsed[i] = 0; + + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + if (inst->Opcode == OPCODE_TEX || + inst->Opcode == OPCODE_TXB || + inst->Opcode == OPCODE_TXB) { + GLint sampleUnit = (GLint) shProg->Uniforms->ParameterValues[inst->Sampler][0]; + assert(sampleUnit < MAX_TEXTURE_IMAGE_UNITS); + inst->TexSrcUnit = sampleUnit; + + prog->TexturesUsed[inst->TexSrcUnit] |= (1 << inst->TexSrcTarget); + } + } +} + + /** * Scan program instructions to update the program's InputsRead and * OutputsWritten fields. - * Also, update the program's TexturesUsed[] array. */ static void -slang_update_inputs_outputs(struct gl_program *prog) +_slang_update_inputs_outputs(struct gl_program *prog) { GLuint i, j; prog->InputsRead = 0x0; prog->OutputsWritten = 0x0; - for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) - prog->TexturesUsed[i] = 0; - for (i = 0; i < prog->NumInstructions; i++) { const struct prog_instruction *inst = prog->Instructions + i; const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); @@ -320,12 +362,6 @@ slang_update_inputs_outputs(struct gl_program *prog) if (inst->DstReg.File == PROGRAM_OUTPUT) { prog->OutputsWritten |= 1 << inst->DstReg.Index; } - - if (inst->Opcode == OPCODE_TEX || - inst->Opcode == OPCODE_TXB || - inst->Opcode == OPCODE_TXP) { - prog->TexturesUsed[inst->TexSrcUnit] |= (1 << inst->TexSrcTarget); - } } } @@ -425,11 +461,14 @@ _slang_link2(GLcontext *ctx, shProg->VertexProgram->Base.Parameters = shProg->Uniforms; shProg->FragmentProgram->Base.Parameters = shProg->Uniforms; - slang_resolve_branches(&shProg->VertexProgram->Base); - slang_resolve_branches(&shProg->FragmentProgram->Base); - - slang_update_inputs_outputs(&shProg->VertexProgram->Base); - slang_update_inputs_outputs(&shProg->FragmentProgram->Base); + _slang_resolve_branches(&shProg->VertexProgram->Base); + _slang_resolve_branches(&shProg->FragmentProgram->Base); +#if 1 + _slang_resolve_samplers(shProg, &shProg->VertexProgram->Base); + _slang_resolve_samplers(shProg, &shProg->FragmentProgram->Base); +#endif + _slang_update_inputs_outputs(&shProg->VertexProgram->Base); + _slang_update_inputs_outputs(&shProg->FragmentProgram->Base); #if 1 printf("************** original fragment program\n"); -- cgit v1.2.3 From 3209c3ed0d82c158eed1020759aacf51ba1c1ad5 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 9 Jan 2007 17:49:24 -0700 Subject: Implement vertex attribute binding. Users can set explicit binding with glBindAttribLocation(), otherwise the linker will allocate generic attribute slots. --- src/mesa/main/mtypes.h | 12 +-- src/mesa/shader/prog_parameter.c | 28 +++++++ src/mesa/shader/prog_parameter.h | 4 + src/mesa/shader/prog_statevars.h | 2 + src/mesa/shader/program.c | 2 + src/mesa/shader/shader_api.c | 39 ++++++---- src/mesa/shader/slang/slang_codegen.c | 24 ++++-- src/mesa/shader/slang/slang_compile.c | 1 + src/mesa/shader/slang/slang_link.h | 3 + src/mesa/shader/slang/slang_link2.c | 138 +++++++++++++++++++++++++++++----- 10 files changed, 209 insertions(+), 44 deletions(-) (limited to 'src/mesa/shader/slang/slang_link.h') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b6c72055e16..cbb1fd47eb2 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1844,16 +1844,16 @@ struct gl_program_parameter_list; struct gl_program { GLuint Id; - GLubyte *String; /**< Null-terminated program text */ + GLubyte *String; /**< Null-terminated program text */ GLint RefCount; - GLenum Target; - GLenum Format; /**< String encoding format */ + GLenum Target; /**< GL_VERTEX/FRAGMENT_PROGRAM_ARB, GL_FRAGMENT_PROGRAM_NV */ + GLenum Format; /**< String encoding format */ GLboolean Resident; struct prog_instruction *Instructions; - GLbitfield InputsRead; /* Bitmask of which input regs are read */ - GLbitfield OutputsWritten; /* Bitmask of which output regs are written to */ + GLbitfield InputsRead; /**< Bitmask of which input regs are read */ + GLbitfield OutputsWritten; /**< Bitmask of which output regs are written to */ GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */ /** Named parameters, constants, etc. from program text */ @@ -1863,6 +1863,8 @@ struct gl_program /** Vertex/fragment shader varying vars */ struct gl_program_parameter_list *Varying; + /** Vertex program user-defined attributes */ + struct gl_program_parameter_list *Attributes; /** Logical counts */ /*@{*/ diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index d09cc659376..e543871ab79 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -239,6 +239,9 @@ _mesa_add_sampler(struct gl_program_parameter_list *paramList, } +/** + * Add parameter representing a varying variable. + */ GLint _mesa_add_varying(struct gl_program_parameter_list *paramList, const char *name, GLuint size) @@ -256,6 +259,31 @@ _mesa_add_varying(struct gl_program_parameter_list *paramList, } +/** + * Add parameter representing a vertex program attribute. + */ +GLint +_mesa_add_attribute(struct gl_program_parameter_list *paramList, + const char *name, GLint attrib) +{ + GLint size = 4; /* XXX ok? */ + GLint i = _mesa_lookup_parameter_index(paramList, -1, name); + if (i >= 0) { + /* replace */ + ASSERT(paramList->Parameters[i].StateIndexes[0] == STATE_USER_ATTRIB); + paramList->Parameters[i].StateIndexes[1] = attrib; + } + else { + /* add */ + i = _mesa_add_parameter(paramList, name, NULL, size, PROGRAM_INPUT); + if (i >= 0) { + paramList->Parameters[i].StateIndexes[0] = STATE_USER_ATTRIB; + paramList->Parameters[i].StateIndexes[1] = attrib; + } + } + return i; +} + #if 0 /* not used yet */ diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h index 0db2bcd314f..ab4d7300188 100644 --- a/src/mesa/shader/prog_parameter.h +++ b/src/mesa/shader/prog_parameter.h @@ -107,6 +107,10 @@ extern GLint _mesa_add_varying(struct gl_program_parameter_list *paramList, const char *name, GLuint size); +extern GLint +_mesa_add_attribute(struct gl_program_parameter_list *paramList, + const char *name, GLint attrib); + extern GLint _mesa_add_state_reference(struct gl_program_parameter_list *paramList, const GLint *stateTokens); diff --git a/src/mesa/shader/prog_statevars.h b/src/mesa/shader/prog_statevars.h index 17e38054bb3..da672c9ec88 100644 --- a/src/mesa/shader/prog_statevars.h +++ b/src/mesa/shader/prog_statevars.h @@ -96,6 +96,8 @@ typedef enum gl_state_index_ { STATE_NORMAL_SCALE, STATE_TEXRECT_SCALE, STATE_POSITION_NORMALIZED, /* normalized light position */ + STATE_USER_ATTRIB, /** shader vertex attrib: user-specified */ + STATE_AUTO_ATTRIB, /** shader vertex attrib: linker-specified */ STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */ } gl_state_index; diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 1b26b6c9321..7a319496730 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -365,6 +365,8 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog) memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams)); if (prog->Varying) clone->Varying = _mesa_clone_parameter_list(prog->Varying); + if (prog->Attributes) + clone->Attributes = _mesa_clone_parameter_list(prog->Attributes); memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams)); clone->NumInstructions = prog->NumInstructions; clone->NumTemporaries = prog->NumTemporaries; diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index bd258f8737b..d1b0e21b949 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -40,6 +40,8 @@ #include "hash.h" #include "program.h" #include "prog_parameter.h" +#include "prog_print.h" +#include "prog_statevars.h" #include "shader_api.h" #include "slang_compile.h" @@ -59,6 +61,7 @@ _mesa_new_shader_program(GLcontext *ctx, GLuint name) shProg->Type = GL_SHADER_PROGRAM; shProg->Name = name; shProg->RefCount = 1; + shProg->Attributes = _mesa_new_parameter_list(); } return shProg; } @@ -275,6 +278,8 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, { struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); + GLint i; + GLint oldIndex; if (!shProg) { _mesa_error(ctx, GL_INVALID_VALUE, "glBindAttribLocation(program)"); @@ -290,15 +295,21 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, return; } -#if 0 /* XXXX */ - if (name == NULL || index >= MAX_VERTEX_ATTRIBS) - _mesa_error(ctx, GL_INVALID_VALUE, "glBindAttribLocationARB"); - else if (IS_NAME_WITH_GL_PREFIX(name)) - _mesa_error(ctx, GL_INVALID_OPERATION, "glBindAttribLocationARB"); - else - (**pro).OverrideAttribBinding(pro, index, name); - RELEASE_PROGRAM(pro); -#endif + oldIndex = _mesa_get_attrib_location(ctx, program, name); + + /* this will replace the current value if it's already in the list */ + i = _mesa_add_attribute(shProg->Attributes, name, index); + if (i < 0) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindAttribLocation"); + } + + if (shProg->VertexProgram && oldIndex >= 0) { + _slang_remap_attribute(&shProg->VertexProgram->Base, oldIndex, index); + } + + printf("===== post BindAttrib:\n"); + _mesa_print_program(&shProg->VertexProgram->Base); + } @@ -541,11 +552,9 @@ _mesa_get_attrib_location(GLcontext *ctx, GLuint program, return -1; if (shProg->Attributes) { - GLuint i; - for (i = 0; i < shProg->Attributes->NumParameters; i++) { - if (!strcmp(shProg->Attributes->Parameters[i].Name, name)) { - return i; - } + GLint i = _mesa_lookup_parameter_index(shProg->Attributes, -1, name); + if (i >= 0) { + return shProg->Attributes->Parameters[i].StateIndexes[1]; } } return -1; @@ -605,7 +614,7 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program, *params = shProg->NumShaders; break; case GL_ACTIVE_ATTRIBUTES: - *params = shProg->Uniforms ? shProg->Uniforms->NumParameters : 0; + *params = shProg->Attributes ? shProg->Attributes->NumParameters : 0; break; case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: *params = _mesa_parameter_longest_name(shProg->Attributes); diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 79261ee29a6..cc70d1de2a2 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -540,7 +540,8 @@ _slang_codegen_global_variable(slang_variable *var, struct gl_program *prog, } else if (var->type.qualifier == slang_qual_const) { if (prog) { - abort(); + /* user-defined constant */ + abort(); /* XXX fix */ } else { /* pre-defined global constant, like gl_MaxLights */ @@ -550,11 +551,22 @@ _slang_codegen_global_variable(slang_variable *var, struct gl_program *prog, if (dbg) printf("CONST "); } else if (var->type.qualifier == slang_qual_attribute) { - /* Vertex attribute */ - GLint index = _slang_input_index(varName, GL_VERTEX_PROGRAM_ARB); - GLint size = 4; /* XXX? */ - assert(index >= 0); - store = _slang_new_ir_storage(PROGRAM_INPUT, index, size); + if (prog) { + /* user-defined vertex attribute */ + const GLint size = _slang_sizeof_type_specifier(&var->type.specifier); + GLint index = _mesa_add_parameter(prog->Attributes, varName, + NULL, size, PROGRAM_INPUT); + assert(index >= 0); + store = _slang_new_ir_storage(PROGRAM_INPUT, + VERT_ATTRIB_GENERIC0 + index, size); + } + else { + /* pre-defined vertex attrib */ + GLint index = _slang_input_index(varName, GL_VERTEX_PROGRAM_ARB); + GLint size = 4; /* XXX? */ + assert(index >= 0); + store = _slang_new_ir_storage(PROGRAM_INPUT, index, size); + } if (dbg) printf("ATTRIB "); } else if (var->type.qualifier == slang_qual_fixedinput) { diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index efb23255f94..314c32f7077 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -2260,6 +2260,7 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) shader->Programs[0]->Parameters = _mesa_new_parameter_list(); shader->Programs[0]->Varying = _mesa_new_parameter_list(); + shader->Programs[0]->Attributes = _mesa_new_parameter_list(); } slang_info_log_construct(&info_log); diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index 2fc5525000f..d9819289cac 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -357,6 +357,9 @@ extern void _slang_resolve_samplers(struct gl_shader_program *shProg, struct gl_program *prog); +extern void +_slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, GLuint newAttrib); + #ifdef __cplusplus } diff --git a/src/mesa/shader/slang/slang_link2.c b/src/mesa/shader/slang/slang_link2.c index 3a5bce00995..0965f3e4c4e 100644 --- a/src/mesa/shader/slang/slang_link2.c +++ b/src/mesa/shader/slang/slang_link2.c @@ -36,6 +36,7 @@ #include "prog_instruction.h" #include "prog_parameter.h" #include "prog_print.h" +#include "prog_statevars.h" #include "shader_api.h" #include "slang_link.h" @@ -311,31 +312,71 @@ _slang_resolve_branches(struct gl_program *prog) /** - * Scan program for texture instructions, lookup sampler/uniform's value - * to determine which texture unit to use. - * Also, update the program's TexturesUsed[] array. + * Resolve binding of generic vertex attributes. + * For example, if the vertex shader declared "attribute vec4 foobar" we'll + * allocate a generic vertex attribute for "foobar" and plug that value into + * the vertex program instructions. */ -void -_slang_resolve_samplers(struct gl_shader_program *shProg, - struct gl_program *prog) +static GLboolean +_slang_resolve_attributes(struct gl_shader_program *shProg, + struct gl_program *prog) { - GLuint i; + GLuint i, j; + GLbitfield usedAttributes; - for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) - prog->TexturesUsed[i] = 0; + assert(prog->Target == GL_VERTEX_PROGRAM_ARB); + + /* Build a bitmask indicating which attribute indexes have been + * explicitly bound by the user with glBindAttributeLocation(). + */ + usedAttributes = 0x0; + for (i = 0; i < shProg->Attributes->NumParameters; i++) { + GLint attr = shProg->Attributes->Parameters[i].StateIndexes[1]; + usedAttributes |= attr; + } + + if (!shProg->Attributes) + shProg->Attributes = _mesa_new_parameter_list(); + /* + * Scan program for generic attribute references + */ for (i = 0; i < prog->NumInstructions; i++) { struct prog_instruction *inst = prog->Instructions + i; - if (inst->Opcode == OPCODE_TEX || - inst->Opcode == OPCODE_TXB || - inst->Opcode == OPCODE_TXP) { - GLint sampleUnit = (GLint) shProg->Uniforms->ParameterValues[inst->Sampler][0]; - assert(sampleUnit < MAX_TEXTURE_IMAGE_UNITS); - inst->TexSrcUnit = sampleUnit; + for (j = 0; j < 3; j++) { + if (inst->SrcReg[j].File == PROGRAM_INPUT && + inst->SrcReg[j].Index >= VERT_ATTRIB_GENERIC0) { + /* this is a generic attrib */ + const GLint k = inst->SrcReg[j].Index - VERT_ATTRIB_GENERIC0; + const char *name = prog->Attributes->Parameters[k].Name; + /* See if this attrib name is in the program's attribute list + * (i.e. was bound by the user). + */ + GLint index = _mesa_lookup_parameter_index(shProg->Attributes, + -1, name); + GLint attr; + if (index >= 0) { + /* found, user must have specified a binding */ + attr = shProg->Attributes->Parameters[index].StateIndexes[1]; + } + else { + /* not found, choose our own attribute number */ + for (attr = 0; attr < MAX_VERTEX_ATTRIBS; attr++) { + if (((1 << attr) & usedAttributes) == 0) + break; + } + if (attr == MAX_VERTEX_ATTRIBS) { + /* too many! XXX record error log */ + return GL_FALSE; + } + _mesa_add_attribute(shProg->Attributes, name, attr); + } - prog->TexturesUsed[inst->TexSrcUnit] |= (1 << inst->TexSrcTarget); + inst->SrcReg[j].Index = VERT_ATTRIB_GENERIC0 + attr; + } } } + return GL_TRUE; } @@ -366,6 +407,65 @@ _slang_update_inputs_outputs(struct gl_program *prog) } +/** + * Scan a vertex program looking for instances of + * (PROGRAM_INPUT, VERT_ATTRIB_GENERIC0 + oldAttrib) and replace with + * (PROGRAM_INPUT, VERT_ATTRIB_GENERIC0 + newAttrib). + * This is used when the user calls glBindAttribLocation on an already linked + * shader program. + */ +void +_slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, GLuint newAttrib) +{ + GLuint i, j; + + assert(prog->Target == GL_VERTEX_PROGRAM_ARB); + + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + for (j = 0; j < 3; j++) { + if (inst->SrcReg[j].File == PROGRAM_INPUT) { + if (inst->SrcReg[j].Index == VERT_ATTRIB_GENERIC0 + oldAttrib) { + inst->SrcReg[j].Index = VERT_ATTRIB_GENERIC0 + newAttrib; + } + } + } + } + + _slang_update_inputs_outputs(prog); +} + + + +/** + * Scan program for texture instructions, lookup sampler/uniform's value + * to determine which texture unit to use. + * Also, update the program's TexturesUsed[] array. + */ +void +_slang_resolve_samplers(struct gl_shader_program *shProg, + struct gl_program *prog) +{ + GLuint i; + + for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) + prog->TexturesUsed[i] = 0; + + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + if (inst->Opcode == OPCODE_TEX || + inst->Opcode == OPCODE_TXB || + inst->Opcode == OPCODE_TXP) { + GLint sampleUnit = (GLint) shProg->Uniforms->ParameterValues[inst->Sampler][0]; + assert(sampleUnit < MAX_TEXTURE_IMAGE_UNITS); + inst->TexSrcUnit = sampleUnit; + + prog->TexturesUsed[inst->TexSrcUnit] |= (1 << inst->TexSrcTarget); + } + } +} + + /** cast wrapper */ static struct gl_vertex_program * @@ -463,10 +563,12 @@ _slang_link2(GLcontext *ctx, _slang_resolve_branches(&shProg->VertexProgram->Base); _slang_resolve_branches(&shProg->FragmentProgram->Base); -#if 1 + _slang_resolve_samplers(shProg, &shProg->VertexProgram->Base); _slang_resolve_samplers(shProg, &shProg->FragmentProgram->Base); -#endif + + _slang_resolve_attributes(shProg, &shProg->VertexProgram->Base); + _slang_update_inputs_outputs(&shProg->VertexProgram->Base); _slang_update_inputs_outputs(&shProg->FragmentProgram->Base); -- cgit v1.2.3 From d265bdf81aac9467119f5cbb6c84a0c4df8282d1 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 2 Feb 2007 13:49:07 -0700 Subject: Remove all dependencies on the old slang interpreter/executor. --- src/mesa/shader/slang/slang_assemble.c | 8 +++---- src/mesa/shader/slang/slang_assemble.h | 1 - src/mesa/shader/slang/slang_assemble_assignment.c | 2 +- src/mesa/shader/slang/slang_assemble_constructor.c | 8 +++---- src/mesa/shader/slang/slang_compile.c | 28 +--------------------- src/mesa/shader/slang/slang_compile.h | 3 +-- src/mesa/shader/slang/slang_compile_function.c | 1 - src/mesa/shader/slang/slang_link.c | 2 -- src/mesa/shader/slang/slang_link.h | 1 - src/mesa/shader/slang/slang_storage.c | 13 +++++----- src/mesa/shader/slang/slang_storage.h | 2 -- 11 files changed, 17 insertions(+), 52 deletions(-) (limited to 'src/mesa/shader/slang/slang_link.h') diff --git a/src/mesa/shader/slang/slang_assemble.c b/src/mesa/shader/slang/slang_assemble.c index 27249078b37..e3b65a12383 100644 --- a/src/mesa/shader/slang/slang_assemble.c +++ b/src/mesa/shader/slang/slang_assemble.c @@ -185,7 +185,7 @@ sizeof_variable(const slang_assemble_ctx * A, slang_type_specifier * spec, if (!slang_storage_aggregate_construct(&agg)) return GL_FALSE; if (!_slang_aggregate_variable(&agg, spec, array_len, A->space.funcs, - A->space.structs, A->space.vars, A->mach, + A->space.structs, A->space.vars, A->file, A->atoms)) { slang_storage_aggregate_destruct(&agg); return GL_FALSE; @@ -551,7 +551,7 @@ _slang_dereference(slang_assemble_ctx * A, slang_operation * op) if (!slang_storage_aggregate_construct(&agg)) goto end1; if (!_slang_aggregate_variable(&agg, &ti.spec, ti.array_len, A->space.funcs, - A->space.structs, A->space.vars, A->mach, + A->space.structs, A->space.vars, A->file, A->atoms)) goto end; @@ -871,7 +871,7 @@ equality(slang_assemble_ctx * A, slang_operation * op, GLboolean equal) goto end1; if (!_slang_aggregate_variable(&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars, - A->mach, A->file, A->atoms)) + A->file, A->atoms)) goto end; /* compute the size of the agregate - there are two such aggregates @@ -1094,7 +1094,7 @@ handle_field(slang_assemble_ctx * A, slang_assembly_typeinfo * tia, if (!_slang_aggregate_variable(&agg, &field->type.specifier, field->array_len, A->space.funcs, A->space.structs, A->space.vars, - A->mach, A->file, A->atoms)) { + A->file, A->atoms)) { slang_storage_aggregate_destruct(&agg); RETURN_NIL(); } diff --git a/src/mesa/shader/slang/slang_assemble.h b/src/mesa/shader/slang/slang_assemble.h index 4f1512afca7..7e380b3c334 100644 --- a/src/mesa/shader/slang/slang_assemble.h +++ b/src/mesa/shader/slang/slang_assemble.h @@ -247,7 +247,6 @@ typedef struct slang_assembly_name_space_ typedef struct slang_assemble_ctx_ { slang_assembly_file *file; - struct slang_machine_ *mach; slang_atom_pool *atoms; slang_assembly_name_space space; slang_assembly_flow_control flow; diff --git a/src/mesa/shader/slang/slang_assemble_assignment.c b/src/mesa/shader/slang/slang_assemble_assignment.c index bfce04ec885..93a1ef3a081 100644 --- a/src/mesa/shader/slang/slang_assemble_assignment.c +++ b/src/mesa/shader/slang/slang_assemble_assignment.c @@ -164,7 +164,7 @@ _slang_assemble_assignment(slang_assemble_ctx * A, const slang_operation * op) goto end1; if (!_slang_aggregate_variable(&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars, - A->mach, A->file, A->atoms)) + A->file, A->atoms)) goto end; index = 0; diff --git a/src/mesa/shader/slang/slang_assemble_constructor.c b/src/mesa/shader/slang/slang_assemble_constructor.c index e045f2f6d2e..63407580caf 100644 --- a/src/mesa/shader/slang/slang_assemble_constructor.c +++ b/src/mesa/shader/slang/slang_assemble_constructor.c @@ -182,7 +182,7 @@ sizeof_argument(slang_assemble_ctx * A, GLuint * size, slang_operation * op) goto end1; if (!_slang_aggregate_variable(&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars, - A->mach, A->file, A->atoms)) + A->file, A->atoms)) goto end; *size = _slang_sizeof_aggregate(&agg); @@ -214,7 +214,7 @@ constructor_aggregate(slang_assemble_ctx * A, goto end1; if (!_slang_aggregate_variable(&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars, - A->mach, A->file, A->atoms)) + A->file, A->atoms)) goto end2; if (!slang_storage_aggregate_construct(&flat_agg)) @@ -276,7 +276,7 @@ _slang_assemble_constructor(slang_assemble_ctx * A, const slang_operation * op) goto end1; if (!_slang_aggregate_variable(&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars, - A->mach, A->file, A->atoms)) + A->file, A->atoms)) goto end2; /* calculate size of the constructor */ @@ -316,7 +316,7 @@ _slang_assemble_constructor(slang_assemble_ctx * A, const slang_operation * op) goto end1; if (!_slang_aggregate_variable(&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars, - A->mach, A->file, A->atoms)) + A->file, A->atoms)) goto end2; /* calculate size of the constructor */ diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 4203c3cc6f2..8148c65a55d 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -103,7 +103,6 @@ _slang_code_object_ctr(slang_code_object * self) #if 01 _slang_assembly_file_ctr(&self->assembly); #endif - slang_machine_ctr(&self->machine); self->varpool.next_addr = 0; slang_atom_pool_construct(&self->atompool); slang_export_data_table_ctr(&self->expdata); @@ -123,7 +122,6 @@ _slang_code_object_dtr(slang_code_object * self) #if 01 slang_assembly_file_destruct(&self->assembly); #endif - slang_machine_dtr(&self->machine); slang_atom_pool_destruct(&self->atompool); slang_export_data_table_dtr(&self->expdata); slang_export_code_table_ctr(&self->expcode); @@ -252,7 +250,6 @@ typedef struct slang_output_ctx_ slang_struct_scope *structs; slang_assembly_file *assembly; slang_var_pool *global_pool; - slang_machine *machine; struct gl_program *program; slang_var_table *vartable; } slang_output_ctx; @@ -386,7 +383,7 @@ calculate_var_size(slang_parse_ctx * C, slang_output_ctx * O, if (!slang_storage_aggregate_construct(&agg)) return GL_FALSE; if (!_slang_aggregate_variable(&agg, &var->type.specifier, var->array_len, - O->funs, O->structs, O->vars, O->machine, + O->funs, O->structs, O->vars, O->assembly, C->atoms)) { slang_storage_aggregate_destruct(&agg); return GL_FALSE; @@ -1556,7 +1553,6 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var) #if 01 slang_assembly_file_restore_point point; #endif - slang_machine mach; slang_assembly_local_info save_local = A->local; slang_operation op_id, op_assign; GLboolean result; @@ -1567,10 +1563,6 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var) return GL_FALSE; #endif - /* setup the machine */ - mach = *A->mach; - mach.ip = A->file->count; - /* allocate local storage for expression */ A->local.ret_size = 0; A->local.addr_tmp = 0; @@ -1635,12 +1627,6 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var) if (!slang_assembly_file_push(A->file, slang_asm_exit)) return GL_FALSE; - /* execute the expression */ -#if 0 - if (!_slang_execute2(A->file, &mach)) - return GL_FALSE; -#endif - #if 01 /* restore the old assembly */ if (!slang_assembly_file_restore_point_load(A->file, &point)) @@ -1648,10 +1634,6 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var) #endif A->local = save_local; - /* now we copy the contents of the initialized variable back to the original machine */ - _mesa_memcpy((GLubyte *) A->mach->mem + var->address, - (GLubyte *) mach.mem + var->address, var->size); - return GL_TRUE; } @@ -1743,7 +1725,6 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, slang_assemble_ctx A; A.file = O->assembly; - A.mach = O->machine; A.atoms = C->atoms; A.space.funcs = O->funs; A.space.structs = O->structs; @@ -1773,7 +1754,6 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, slang_assemble_ctx A; A.file = O->assembly; - A.mach = O->machine; A.atoms = C->atoms; A.space.funcs = O->funs; A.space.structs = O->structs; @@ -1781,10 +1761,6 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, if (!initialize_global(&A, var)) return 0; } - else { - _mesa_memset((GLubyte *) (O->machine->mem) + var->address, 0, - var->size); - } } return 1; } @@ -1909,7 +1885,6 @@ parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition, slang_assemble_ctx A; A.file = O->assembly; - A.mach = O->machine; A.atoms = C->atoms; A.space.funcs = O->funs; A.space.structs = O->structs; @@ -2003,7 +1978,6 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, o.vars = &unit->vars; o.assembly = &unit->object->assembly; o.global_pool = &unit->object->varpool; - o.machine = &unit->object->machine; o.program = program; o.vartable = _slang_new_var_table(maxRegs); _slang_push_var_table(o.vartable); diff --git a/src/mesa/shader/slang/slang_compile.h b/src/mesa/shader/slang/slang_compile.h index a8311e85465..450119d650d 100644 --- a/src/mesa/shader/slang/slang_compile.h +++ b/src/mesa/shader/slang/slang_compile.h @@ -28,7 +28,7 @@ #include "imports.h" #include "mtypes.h" #include "slang_export.h" -#include "slang_execute.h" +#include "slang_assemble.h" #include "slang_compile_variable.h" #include "slang_compile_struct.h" #include "slang_compile_operation.h" @@ -82,7 +82,6 @@ typedef struct slang_code_object_ slang_code_unit builtin[SLANG_BUILTIN_TOTAL]; slang_code_unit unit; slang_assembly_file assembly; - slang_machine machine; slang_var_pool varpool; slang_atom_pool atompool; slang_export_data_table expdata; diff --git a/src/mesa/shader/slang/slang_compile_function.c b/src/mesa/shader/slang/slang_compile_function.c index 3642b12e92a..c9b33f3b2fa 100644 --- a/src/mesa/shader/slang/slang_compile_function.c +++ b/src/mesa/shader/slang/slang_compile_function.c @@ -246,7 +246,6 @@ _slang_build_export_code_table(slang_export_code_table * tbl, return GL_FALSE; A.file = &unit->object->assembly; - A.mach = &unit->object->machine; A.atoms = &unit->object->atompool; A.space.funcs = &unit->funs; A.space.structs = &unit->structs; diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 008b7ab3699..8894f78088d 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -646,7 +646,6 @@ _slang_program_ctr (slang_program *self) self->common_fixed_entries[i][j] = ~0; for (j = 0; j < SLANG_COMMON_CODE_MAX; j++) self->code[i][j] = ~0; - self->machines[i] = NULL; self->assemblies[i] = NULL; } for (i = 0; i < SLANG_VERTEX_FIXED_MAX; i++) @@ -859,7 +858,6 @@ _slang_link (slang_program *prog, slang_code_object **objects, GLuint count) return GL_FALSE; resolve_common_fixed (prog->common_fixed_entries[index], &objects[i]->expdata); resolve_common_code (prog->code[index], &objects[i]->expcode); - prog->machines[index] = &objects[i]->machine; prog->assemblies[index] = &objects[i]->assembly; } diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index d9819289cac..8c7d0c01cf5 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -332,7 +332,6 @@ typedef struct GLuint vertex_fixed_entries[SLANG_VERTEX_FIXED_MAX]; GLuint fragment_fixed_entries[SLANG_FRAGMENT_FIXED_MAX]; GLuint code[SLANG_SHADER_MAX][SLANG_COMMON_CODE_MAX]; - slang_machine *machines[SLANG_SHADER_MAX]; slang_assembly_file *assemblies[SLANG_SHADER_MAX]; } slang_program; diff --git a/src/mesa/shader/slang/slang_storage.c b/src/mesa/shader/slang/slang_storage.c index 81969757660..899c36cbd3c 100644 --- a/src/mesa/shader/slang/slang_storage.c +++ b/src/mesa/shader/slang/slang_storage.c @@ -135,7 +135,7 @@ static GLboolean aggregate_variables(slang_storage_aggregate * agg, slang_variable_scope * vars, slang_function_scope * funcs, slang_struct_scope * structs, - slang_variable_scope * globals, slang_machine * mach, + slang_variable_scope * globals, slang_assembly_file * file, slang_atom_pool * atoms) { GLuint i; @@ -143,7 +143,7 @@ aggregate_variables(slang_storage_aggregate * agg, for (i = 0; i < vars->num_variables; i++) if (!_slang_aggregate_variable(agg, &vars->variables[i]->type.specifier, vars->variables[i]->array_len, funcs, - structs, globals, mach, file, atoms)) + structs, globals, file, atoms)) return GL_FALSE; return GL_TRUE; } @@ -153,7 +153,7 @@ _slang_aggregate_variable(slang_storage_aggregate * agg, slang_type_specifier * spec, GLuint array_len, slang_function_scope * funcs, slang_struct_scope * structs, - slang_variable_scope * vars, slang_machine * mach, + slang_variable_scope * vars, slang_assembly_file * file, slang_atom_pool * atoms) { switch (spec->type) { @@ -204,7 +204,7 @@ _slang_aggregate_variable(slang_storage_aggregate * agg, return aggregate_vector(agg, slang_stor_int, 1); case slang_spec_struct: return aggregate_variables(agg, spec->_struct->fields, funcs, structs, - vars, mach, file, atoms); + vars, file, atoms); case slang_spec_array: { slang_storage_array *arr; @@ -223,9 +223,8 @@ _slang_aggregate_variable(slang_storage_aggregate * agg, arr->aggregate = NULL; return GL_FALSE; } - if (!_slang_aggregate_variable - (arr->aggregate, spec->_array, 0, funcs, structs, vars, mach, - file, atoms)) + if (!_slang_aggregate_variable(arr->aggregate, spec->_array, 0, + funcs, structs, vars, file, atoms)) return GL_FALSE; arr->length = array_len; /* TODO: check if 0 < arr->length <= 65535 */ diff --git a/src/mesa/shader/slang/slang_storage.h b/src/mesa/shader/slang/slang_storage.h index 0137003a9d5..3fe60c78fec 100644 --- a/src/mesa/shader/slang/slang_storage.h +++ b/src/mesa/shader/slang/slang_storage.h @@ -27,7 +27,6 @@ #include "slang_compile.h" #include "slang_assemble.h" -#include "slang_execute.h" #if defined __cplusplus extern "C" { @@ -99,7 +98,6 @@ _slang_aggregate_variable(slang_storage_aggregate *agg, slang_function_scope *funcs, slang_struct_scope *structs, slang_variable_scope *vars, - slang_machine *mach, slang_assembly_file *file, slang_atom_pool *atoms); -- cgit v1.2.3 From d79fd748716f4d5becdbf482ff6f8c3fbc3e5c8b Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 2 Feb 2007 14:04:58 -0700 Subject: remove old linker stuff --- src/mesa/shader/slang/slang_link.h | 335 +------------------------------------ 1 file changed, 6 insertions(+), 329 deletions(-) (limited to 'src/mesa/shader/slang/slang_link.h') diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index 8c7d0c01cf5..edd4a097d5a 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 6.5.3 * - * Copyright (C) 2006 Brian Paul All Rights Reserved. + * Copyright (C) 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"), @@ -22,331 +22,11 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#if !defined SLANG_LINK_H -#define SLANG_LINK_H +#ifndef SLANG_LINK_H +#define SLANG_LINK_H 1 #include "slang_compile.h" -#if defined __cplusplus -extern "C" { -#endif - -enum -{ - SLANG_SHADER_VERTEX, - SLANG_SHADER_FRAGMENT, - SLANG_SHADER_MAX -}; - - -/** - * Active variables. - * - * Active uniforms/attribs can be queried by the application to get a - * list of uniforms/attribs actually used by shaders (uniforms) or - * vertex shader only (attribs). - */ -/*@{*/ -typedef struct -{ - slang_export_data_quant *quant; - GLchar *name; -} slang_active_variable; - -typedef struct -{ - slang_active_variable *table; - GLuint count; -} slang_active_variables; -/*@}*/ - - -/** - * Attrib binding override. - * - * The application can override GL attrib binding by specifying its - * preferred index assignment for a given attrib name. Those overrides - * are taken into account while linking the program. - */ -/*@{*/ -typedef struct -{ - GLuint index; - GLchar *name; -} slang_attrib_override; - -typedef struct -{ - slang_attrib_override *table; - GLuint count; -} slang_attrib_overrides; -/*@}*/ - - -extern GLboolean -_slang_attrib_overrides_add (slang_attrib_overrides *, GLuint, const GLchar *); - - -/** - * Uniform bindings. - * - * Each slang_uniform_binding holds an array of addresses to actual - * memory locations in those shader types that use that - * uniform. Uniform bindings are held in an array and accessed by - * array index which is seen to the application as a uniform location. - * - * When the application writes to a particular uniform, it specifies - * its location. This location is treated as an array index to - * slang_uniform_bindings::table and tested against - * slang_uniform_bindings::count limit. The result is a pointer to - * slang_uniform_binding. The type of data being written to uniform - * is tested against slang_uniform_binding::quant. If the types are - * compatible, the array slang_uniform_binding::address is iterated - * for each shader type and if the address is valid (i.e. the uniform - * is used by this shader type), the new uniform value is written at - * that address. - */ -/*@{*/ -typedef struct -{ - slang_export_data_quant *quant; - GLchar *name; - GLuint address[SLANG_SHADER_MAX]; -} slang_uniform_binding; - -typedef struct -{ - slang_uniform_binding *table; - GLuint count; -} slang_uniform_bindings; -/*@}*/ - - -/** - * Attrib bindings. - * - * There is a fixed number of vertex attrib vectors (attrib - * slots). The slang_attrib_slot::addr maps vertex attrib index to the - * actual memory location of the attrib in vertex shader. One vertex - * attrib can span over many attrib slots (this is the case for - * matrices). The slang_attrib_binding::first_slot_index holds the - * first slot index that the attrib is bound to. - */ -/*@{*/ -typedef struct -{ - slang_export_data_quant *quant; - GLchar *name; - GLuint first_slot_index; -} slang_attrib_binding; - -typedef struct -{ - GLuint addr; /**< memory location */ - GLuint fill; /**< 1..4, number of components used */ -} slang_attrib_slot; - -typedef struct -{ - slang_attrib_binding bindings[MAX_VERTEX_ATTRIBS]; - GLuint binding_count; - slang_attrib_slot slots[MAX_VERTEX_ATTRIBS]; -} slang_attrib_bindings; -/*@}*/ - - - -/** - * Varying bindings. - * - * There is a fixed number of varying floats (varying slots). The - * slang_varying_slot::vert_addr maps varying float index to the - * actual memory location of the output variable in vertex shader. - * The slang_varying_slot::frag_addr maps varying float index to the - * actual memory location of the input variable in fragment shader. - */ -/*@{*/ -typedef struct -{ - GLuint vert_addr; - GLuint frag_addr; -} slang_varying_slot; - -typedef struct -{ - slang_export_data_quant *quant; - GLchar *name; - GLuint first_slot_index; -} slang_varying_binding; - -typedef struct -{ - slang_varying_binding bindings[MAX_VARYING * 4]; - GLuint binding_count; - slang_varying_slot slots[MAX_VARYING * 4]; - GLuint slot_count; -} slang_varying_bindings; -/*@}*/ - - -/** - * Texture usage. - * - * A slang_texture_usage struct holds indirect information about - * texture image unit usage. The slang_texture_usages::table is - * derived from active uniform table by extracting only uniforms that - * are samplers. - * - * To collect current texture usage one must iterate the - * slang_texture_usages::table and read uniform at address - * slang_texture_usage::frag_address to get texture unit index. This - * index, coupled with texture access type (target) taken from - * slang_texture_usage::quant forms texture usage for that texture - * unit. - */ -/*@{*/ -typedef struct -{ - slang_export_data_quant *quant; - GLuint frag_address; -} slang_texture_usage; - -typedef struct -{ - slang_texture_usage *table; - GLuint count; -} slang_texture_usages; -/*@}*/ - - -extern GLvoid -_slang_texture_usages_ctr (slang_texture_usages *); - -extern GLvoid -_slang_texture_usages_dtr (slang_texture_usages *); - -enum -{ - SLANG_COMMON_FIXED_MODELVIEWMATRIX, - SLANG_COMMON_FIXED_PROJECTIONMATRIX, - SLANG_COMMON_FIXED_MODELVIEWPROJECTIONMATRIX, - SLANG_COMMON_FIXED_TEXTUREMATRIX, - SLANG_COMMON_FIXED_NORMALMATRIX, - SLANG_COMMON_FIXED_MODELVIEWMATRIXINVERSE, - SLANG_COMMON_FIXED_PROJECTIONMATRIXINVERSE, - SLANG_COMMON_FIXED_MODELVIEWPROJECTIONMATRIXINVERSE, - SLANG_COMMON_FIXED_TEXTUREMATRIXINVERSE, - SLANG_COMMON_FIXED_MODELVIEWMATRIXTRANSPOSE, - SLANG_COMMON_FIXED_PROJECTIONMATRIXTRANSPOSE, - SLANG_COMMON_FIXED_MODELVIEWPROJECTIONMATRIXTRANSPOSE, - SLANG_COMMON_FIXED_TEXTUREMATRIXTRANSPOSE, - SLANG_COMMON_FIXED_MODELVIEWMATRIXINVERSETRANSPOSE, - SLANG_COMMON_FIXED_PROJECTIONMATRIXINVERSETRANSPOSE, - SLANG_COMMON_FIXED_MODELVIEWPROJECTIONMATRIXINVERSETRANSPOSE, - SLANG_COMMON_FIXED_TEXTUREMATRIXINVERSETRANSPOSE, - SLANG_COMMON_FIXED_NORMALSCALE, - SLANG_COMMON_FIXED_DEPTHRANGE, - SLANG_COMMON_FIXED_CLIPPLANE, - SLANG_COMMON_FIXED_POINT, - SLANG_COMMON_FIXED_FRONTMATERIAL, - SLANG_COMMON_FIXED_BACKMATERIAL, - SLANG_COMMON_FIXED_LIGHTSOURCE, - SLANG_COMMON_FIXED_LIGHTMODEL, - SLANG_COMMON_FIXED_FRONTLIGHTMODELPRODUCT, - SLANG_COMMON_FIXED_BACKLIGHTMODELPRODUCT, - SLANG_COMMON_FIXED_FRONTLIGHTPRODUCT, - SLANG_COMMON_FIXED_BACKLIGHTPRODUCT, - SLANG_COMMON_FIXED_TEXTUREENVCOLOR, - SLANG_COMMON_FIXED_EYEPLANES, - SLANG_COMMON_FIXED_EYEPLANET, - SLANG_COMMON_FIXED_EYEPLANER, - SLANG_COMMON_FIXED_EYEPLANEQ, - SLANG_COMMON_FIXED_OBJECTPLANES, - SLANG_COMMON_FIXED_OBJECTPLANET, - SLANG_COMMON_FIXED_OBJECTPLANER, - SLANG_COMMON_FIXED_OBJECTPLANEQ, - SLANG_COMMON_FIXED_FOG, - SLANG_COMMON_FIXED_MAX -}; - -enum -{ - SLANG_VERTEX_FIXED_POSITION, - SLANG_VERTEX_FIXED_POINTSIZE, - SLANG_VERTEX_FIXED_CLIPVERTEX, - SLANG_VERTEX_FIXED_COLOR, - SLANG_VERTEX_FIXED_SECONDARYCOLOR, - SLANG_VERTEX_FIXED_NORMAL, - SLANG_VERTEX_FIXED_VERTEX, - SLANG_VERTEX_FIXED_MULTITEXCOORD0, - SLANG_VERTEX_FIXED_MULTITEXCOORD1, - SLANG_VERTEX_FIXED_MULTITEXCOORD2, - SLANG_VERTEX_FIXED_MULTITEXCOORD3, - SLANG_VERTEX_FIXED_MULTITEXCOORD4, - SLANG_VERTEX_FIXED_MULTITEXCOORD5, - SLANG_VERTEX_FIXED_MULTITEXCOORD6, - SLANG_VERTEX_FIXED_MULTITEXCOORD7, - SLANG_VERTEX_FIXED_FOGCOORD, - SLANG_VERTEX_FIXED_FRONTCOLOR, - SLANG_VERTEX_FIXED_BACKCOLOR, - SLANG_VERTEX_FIXED_FRONTSECONDARYCOLOR, - SLANG_VERTEX_FIXED_BACKSECONDARYCOLOR, - SLANG_VERTEX_FIXED_TEXCOORD, - SLANG_VERTEX_FIXED_FOGFRAGCOORD, - SLANG_VERTEX_FIXED_MAX -}; - -enum -{ - SLANG_FRAGMENT_FIXED_FRAGCOORD, - SLANG_FRAGMENT_FIXED_FRONTFACING, - SLANG_FRAGMENT_FIXED_FRAGCOLOR, - SLANG_FRAGMENT_FIXED_FRAGDATA, - SLANG_FRAGMENT_FIXED_FRAGDEPTH, - SLANG_FRAGMENT_FIXED_COLOR, - SLANG_FRAGMENT_FIXED_SECONDARYCOLOR, - SLANG_FRAGMENT_FIXED_TEXCOORD, - SLANG_FRAGMENT_FIXED_FOGFRAGCOORD, - SLANG_FRAGMENT_FIXED_MAX -}; - -enum -{ - SLANG_COMMON_CODE_MAIN, - SLANG_COMMON_CODE_MAX -}; - -/** - * XXX promote this to mtypes.h? - */ -typedef struct -{ - slang_active_variables active_uniforms; - slang_active_variables active_attribs; - slang_attrib_overrides attrib_overrides; - slang_uniform_bindings uniforms; - slang_attrib_bindings attribs; - slang_varying_bindings varyings; - slang_texture_usages texture_usage; - GLuint common_fixed_entries[SLANG_SHADER_MAX][SLANG_COMMON_FIXED_MAX]; - GLuint vertex_fixed_entries[SLANG_VERTEX_FIXED_MAX]; - GLuint fragment_fixed_entries[SLANG_FRAGMENT_FIXED_MAX]; - GLuint code[SLANG_SHADER_MAX][SLANG_COMMON_CODE_MAX]; - slang_assembly_file *assemblies[SLANG_SHADER_MAX]; -} slang_program; - -extern GLvoid -_slang_program_ctr (slang_program *); - -extern GLvoid -_slang_program_dtr (slang_program *); - -extern GLvoid -_slang_program_rst (slang_program *); - -extern GLboolean -_slang_link (slang_program *, slang_code_object **, GLuint); - extern void _slang_link2(GLcontext *ctx, GLhandleARB h, @@ -357,12 +37,9 @@ _slang_resolve_samplers(struct gl_shader_program *shProg, struct gl_program *prog); extern void -_slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, GLuint newAttrib); - +_slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, + GLuint newAttrib); -#ifdef __cplusplus -} -#endif #endif -- cgit v1.2.3 From c1771918042a26c8f5f27f9e28cf1890c04d891f Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 16 Feb 2007 09:56:19 -0700 Subject: s/_slang_link2/_slang_link/ --- src/mesa/shader/shader_api.c | 2 +- src/mesa/shader/slang/slang_link.c | 12 ++++++------ src/mesa/shader/slang/slang_link.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/mesa/shader/slang/slang_link.h') diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 842960099ea..c439f71f412 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -832,7 +832,7 @@ _mesa_link_program(GLcontext *ctx, GLuint program) return; } - _slang_link2(ctx, program, shProg); + _slang_link(ctx, program, shProg); } diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index b1d355ff802..1af8652d542 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -2,7 +2,7 @@ * Mesa 3-D graphics library * Version: 6.5.3 * - * Copyright (C) 2006 Brian Paul All Rights Reserved. + * Copyright (C) 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"), @@ -23,7 +23,7 @@ */ /** - * \file slang_link2.c + * \file slang_link.c * GLSL linker * \author Brian Paul */ @@ -506,9 +506,9 @@ fragment_program(struct gl_program *prog) * varying storage locations. */ void -_slang_link2(GLcontext *ctx, - GLhandleARB programObj, - struct gl_shader_program *shProg) +_slang_link(GLcontext *ctx, + GLhandleARB programObj, + struct gl_shader_program *shProg) { const struct gl_vertex_program *vertProg; const struct gl_fragment_program *fragProg; @@ -530,7 +530,7 @@ _slang_link2(GLcontext *ctx, else if (shProg->Shaders[i]->Type == GL_FRAGMENT_SHADER) fragProg = fragment_program(shProg->Shaders[i]->Programs[0]); else - _mesa_problem(ctx, "unexpected shader target in slang_link2()"); + _mesa_problem(ctx, "unexpected shader target in slang_link()"); } #if 00 if (!vertProg || !fragProg) { diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index edd4a097d5a..606b9e46b16 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -29,8 +29,8 @@ extern void -_slang_link2(GLcontext *ctx, GLhandleARB h, - struct gl_shader_program *shProg); +_slang_link(GLcontext *ctx, GLhandleARB h, + struct gl_shader_program *shProg); extern void _slang_resolve_samplers(struct gl_shader_program *shProg, -- cgit v1.2.3