Implement software ATI_fragment_shader
no error detection, slow, may not be 100% correct but a good start
This commit is contained in:
@@ -83,6 +83,13 @@ _mesa_init_program(GLcontext *ctx)
|
||||
assert(ctx->FragmentProgram.Current);
|
||||
ctx->FragmentProgram.Current->Base.RefCount++;
|
||||
#endif
|
||||
|
||||
#if FEATURE_ATI_fragment_shader
|
||||
ctx->ATIFragmentShader.Enabled = GL_FALSE;
|
||||
ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader;
|
||||
assert(ctx->ATIFragmentShader.Current);
|
||||
ctx->ATIFragmentShader.Current->Base.RefCount++;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +112,13 @@ _mesa_free_program_data(GLcontext *ctx)
|
||||
if (ctx->FragmentProgram.Current->Base.RefCount <= 0)
|
||||
ctx->Driver.DeleteProgram(ctx, &(ctx->FragmentProgram.Current->Base));
|
||||
}
|
||||
#endif
|
||||
#if FEATURE_ATI_fragment_shader
|
||||
if (ctx->ATIFragmentShader.Current) {
|
||||
ctx->ATIFragmentShader.Current->Base.RefCount--;
|
||||
if (ctx->ATIFragmentShader.Current->Base.RefCount <= 0)
|
||||
ctx->Driver.DeleteProgram(ctx, &(ctx->ATIFragmentShader.Current->Base));
|
||||
}
|
||||
#endif
|
||||
_mesa_free((void *) ctx->Program.ErrorString);
|
||||
}
|
||||
@@ -216,6 +230,20 @@ _mesa_init_vertex_program( GLcontext *ctx, struct vertex_program *prog,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a new ATI fragment shader object.
|
||||
*/
|
||||
struct program *
|
||||
_mesa_init_ati_fragment_shader( GLcontext *ctx, struct ati_fragment_shader *prog,
|
||||
GLenum target, GLuint id)
|
||||
{
|
||||
if (prog)
|
||||
return _mesa_init_program_struct( ctx, &prog->Base, target, id );
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allocate and initialize a new fragment/vertex program object but
|
||||
@@ -240,6 +268,10 @@ _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id)
|
||||
case GL_FRAGMENT_PROGRAM_ARB:
|
||||
return _mesa_init_fragment_program( ctx, CALLOC_STRUCT(fragment_program),
|
||||
target, id );
|
||||
case GL_FRAGMENT_SHADER_ATI:
|
||||
return _mesa_init_ati_fragment_shader( ctx, CALLOC_STRUCT(ati_fragment_shader),
|
||||
target, id );
|
||||
|
||||
default:
|
||||
_mesa_problem(ctx, "bad target in _mesa_new_program");
|
||||
return NULL;
|
||||
@@ -289,6 +321,12 @@ _mesa_delete_program(GLcontext *ctx, struct program *prog)
|
||||
if (fprog->Parameters)
|
||||
_mesa_free_parameter_list(fprog->Parameters);
|
||||
}
|
||||
else if (prog->Target == GL_FRAGMENT_SHADER_ATI) {
|
||||
struct ati_fragment_shader *atifs = (struct ati_fragment_shader *)prog;
|
||||
if (atifs->Instructions)
|
||||
_mesa_free(atifs->Instructions);
|
||||
}
|
||||
|
||||
_mesa_free(prog);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user