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 <eric@anholt.net>
This commit is contained in:
Timothy Arceri
2016-11-09 23:38:46 +11:00
parent 2784128398
commit f584f38214
13 changed files with 45 additions and 34 deletions

View File

@@ -1144,12 +1144,13 @@ i915BindProgram(struct gl_context * ctx, GLenum target, struct gl_program *prog)
}
static struct gl_program *
i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id)
i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id,
bool is_arb_asm)
{
switch (target) {
case GL_VERTEX_PROGRAM_ARB: {
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);
}
case GL_FRAGMENT_PROGRAM_ARB:{
@@ -1158,7 +1159,8 @@ i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id)
if (prog) {
i915_init_program(I915_CONTEXT(ctx), prog);
return _mesa_init_gl_program(&prog->FragProg, target, id);
return _mesa_init_gl_program(&prog->FragProg, target, id,
is_arb_asm);
}
else
return NULL;
@@ -1167,7 +1169,7 @@ i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id)
default:
/* Just fallback:
*/
return _mesa_new_program(ctx, target, id);
return _mesa_new_program(ctx, target, id, is_arb_asm);
}
}