struct gl_program *gl_prog =
ctx->Driver.NewProgram(ctx,
_mesa_shader_stage_to_program(shader_list[0]->Stage),
- prog->Name);
+ prog->Name, false);
if (!gl_prog) {
prog->data->LinkStatus = false;
_mesa_delete_linked_shader(ctx, linked);
};
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++)
}
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 */
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:
}
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:{
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;
default:
/* Just fallback:
*/
- return _mesa_new_program(ctx, target, id);
+ return _mesa_new_program(ctx, target, id, is_arb_asm);
}
}
return id;
}
-static struct gl_program *brwNewProgram( struct gl_context *ctx,
- GLenum target,
- GLuint id )
+static struct gl_program *brwNewProgram(struct gl_context *ctx, GLenum target,
+ GLuint id, bool is_arb_asm)
{
struct brw_context *brw = brw_context(ctx);
if (prog) {
prog->id = get_new_program_id(brw->screen);
- return _mesa_init_gl_program(&prog->program, target, id);
+ return _mesa_init_gl_program(&prog->program, target, id, is_arb_asm);
}
else
return NULL;
if (prog) {
prog->id = get_new_program_id(brw->screen);
- return _mesa_init_gl_program(&prog->program, target, id);
+ return _mesa_init_gl_program(&prog->program, target, id, is_arb_asm);
}
else
return NULL;
}
static struct gl_program *
-r200NewProgram(struct gl_context *ctx, GLenum target, GLuint id)
+r200NewProgram(struct gl_context *ctx, GLenum target, GLuint id,
+ bool is_arb_asm)
{
switch(target){
case GL_VERTEX_PROGRAM_ARB: {
struct r200_vertex_program *vp = rzalloc(NULL,
struct r200_vertex_program);
- return _mesa_init_gl_program(&vp->mesa_program, target, id);
+ return _mesa_init_gl_program(&vp->mesa_program, target, id, is_arb_asm);
}
case GL_FRAGMENT_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);
}
default:
_mesa_problem(ctx, "Bad target in r200NewProgram");
newProg = _mesa_lookup_program(ctx, id);
if (!newProg || newProg == &_mesa_DummyProgram) {
/* allocate a new program now */
- newProg = ctx->Driver.NewProgram(ctx, target, id);
+ newProg = ctx->Driver.NewProgram(ctx, target, id, true);
if (!newProg) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramARB");
return;
struct gl_program *prog);
/** Allocate a new program */
struct gl_program * (*NewProgram)(struct gl_context *ctx, GLenum target,
- GLuint id);
+ GLuint id, bool is_arb_asm);
/** Delete a program */
void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog);
/**
if (0)
printf("Build new TNL program\n");
- prog = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
+ prog = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0, true);
if (!prog)
return NULL;
struct nir_shader *nir;
+ bool is_arb_asm; /** Is this an ARB assembly-style program */
+
GLbitfield64 SecondaryOutputsWritten; /**< Subset of OutputsWritten outputs written with non-zero index. */
GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */
GLbitfield SamplersUsed; /**< Bitfield of which samplers are used */
shared->Programs = _mesa_NewHashTable();
shared->DefaultVertexProgram =
- ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
+ ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0, true);
shared->DefaultFragmentProgram =
- ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
+ ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0, true);
shared->ATIShaders = _mesa_NewHashTable();
shared->DefaultFragmentShader = _mesa_new_ati_fragment_shader(ctx, 0);
* 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;
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++)
* \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 */
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");
_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);
* fragment program.
*/
static struct gl_program *
-st_new_program(struct gl_context *ctx, GLenum target, GLuint id)
+st_new_program(struct gl_context *ctx, GLenum target, GLuint id,
+ bool is_arb_asm)
{
switch (target) {
case GL_VERTEX_PROGRAM_ARB: {
struct st_vertex_program *prog = rzalloc(NULL,
struct st_vertex_program);
- return _mesa_init_gl_program(&prog->Base, target, id);
+ return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
case GL_FRAGMENT_PROGRAM_ARB: {
struct st_fragment_program *prog = rzalloc(NULL,
struct st_fragment_program);
- return _mesa_init_gl_program(&prog->Base, target, id);
+ return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
case GL_GEOMETRY_PROGRAM_NV: {
struct st_geometry_program *prog = rzalloc(NULL,
struct st_geometry_program);
- return _mesa_init_gl_program(&prog->Base, target, id);
+ return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
case GL_TESS_CONTROL_PROGRAM_NV: {
struct st_tessctrl_program *prog = rzalloc(NULL,
struct st_tessctrl_program);
- return _mesa_init_gl_program(&prog->Base, target, id);
+ return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
case GL_TESS_EVALUATION_PROGRAM_NV: {
struct st_tesseval_program *prog = rzalloc(NULL,
struct st_tesseval_program);
- return _mesa_init_gl_program(&prog->Base, target, id);
+ return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
case GL_COMPUTE_PROGRAM_NV: {
struct st_compute_program *prog = rzalloc(NULL,
struct st_compute_program);
- return _mesa_init_gl_program(&prog->Base, target, id);
+ return _mesa_init_gl_program(&prog->Base, target, id, is_arb_asm);
}
default:
assert(0);
st_new_ati_fs(struct gl_context *ctx, struct ati_fragment_shader *curProg)
{
struct gl_program *prog = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
- curProg->Id);
+ curProg->Id, true);
struct st_fragment_program *stfp = (struct st_fragment_program *)prog;
stfp->ati_fs = curProg;
return prog;