summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-09 23:38:46 +1100
committerTimothy Arceri <[email protected]>2017-01-06 11:21:42 +1100
commitf584f3821426955b94f36c77191edcfe1b1cc7d5 (patch)
tree043484b6571b8ab26fde0f128b98e245d67cec49 /src/mesa/program
parent2784128398e405405f0263d318ebe4121d1baf4c (diff)
st/mesa/glsl: add new is_arb_asm flag in gl_program
Set the flag via the _mesa_init_gl_program() and NewProgram() helpers. In i965 we currently check for the existance of gl_shader_program to decide if this is an ARB assembly style program or not. Adding a flag makes the code clearer and will help removes a dependency on gl_shader_program in the i965 codegen functions. Also this will allow use to skip initialising sampler units for linked shaders, we currently memset it to zero again during linking. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/program.c9
-rw-r--r--src/mesa/program/program.h6
2 files changed, 10 insertions, 5 deletions
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index b728d862e54..3edeec81730 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -178,7 +178,8 @@ _mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string)
* Initialize a new gl_program object.
*/
struct gl_program *
-_mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id)
+_mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id,
+ bool is_arb_asm)
{
GLuint i;
@@ -192,6 +193,7 @@ _mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id)
prog->RefCount = 1;
prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
prog->info.stage = _mesa_program_enum_to_shader_stage(target);
+ prog->is_arb_asm = is_arb_asm;
/* default mapping from samplers to texture units */
for (i = 0; i < MAX_SAMPLERS; i++)
@@ -214,7 +216,8 @@ _mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id)
* \return pointer to new program object
*/
struct gl_program *
-_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
+_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id,
+ bool is_arb_asm)
{
switch (target) {
case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
@@ -224,7 +227,7 @@ _mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
case GL_FRAGMENT_PROGRAM_ARB:
case GL_COMPUTE_PROGRAM_NV: {
struct gl_program *prog = rzalloc(NULL, struct gl_program);
- return _mesa_init_gl_program(prog, target, id);
+ return _mesa_init_gl_program(prog, target, id, is_arb_asm);
}
default:
_mesa_problem(ctx, "bad target in _mesa_new_program");
diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
index 18122f75b74..296fa40fbc1 100644
--- a/src/mesa/program/program.h
+++ b/src/mesa/program/program.h
@@ -64,10 +64,12 @@ extern void
_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string);
extern struct gl_program *
-_mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id);
+_mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id,
+ bool is_arb_asm);
extern struct gl_program *
-_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id);
+_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id,
+ bool is_arb_asm);
extern void
_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog);