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:
@@ -100,12 +100,13 @@ private:
|
||||
};
|
||||
|
||||
void
|
||||
init_gl_program(struct gl_program *prog, GLenum target)
|
||||
init_gl_program(struct gl_program *prog, GLenum target, bool is_arb_asm)
|
||||
{
|
||||
mtx_init(&prog->Mutex, mtx_plain);
|
||||
|
||||
prog->RefCount = 1;
|
||||
prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
|
||||
prog->is_arb_asm = is_arb_asm;
|
||||
|
||||
/* default mapping from samplers to texture units */
|
||||
for (int i = 0; i < MAX_SAMPLERS; i++)
|
||||
@@ -113,7 +114,7 @@ init_gl_program(struct gl_program *prog, GLenum target)
|
||||
}
|
||||
|
||||
struct gl_program *
|
||||
new_program(struct gl_context *ctx, GLenum target, GLuint id)
|
||||
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 */
|
||||
@@ -123,7 +124,7 @@ 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);
|
||||
init_gl_program(prog, target);
|
||||
init_gl_program(prog, target, is_arb_asm);
|
||||
return prog;
|
||||
}
|
||||
default:
|
||||
|
Reference in New Issue
Block a user