X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fatifragshader.c;h=7077c96f1e3d3de2bed52c3664165e30e3334765;hb=17cde55c538009764207bd29b78a909d2c5d14b4;hp=550f50b7a00fbe5fabbb8cfb6b8dc38acb560a74;hpb=1218430e1200a08cd64b6555d3fd1fd0274ad9e5;p=mesa.git diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c index 550f50b7a00..7077c96f1e3 100644 --- a/src/mesa/main/atifragshader.c +++ b/src/mesa/main/atifragshader.c @@ -31,38 +31,16 @@ #include "main/dispatch.h" #include "main/atifragshader.h" -#if FEATURE_ATI_fragment_shader - #define MESA_DEBUG_ATI_FS 0 static struct ati_fragment_shader DummyShader; -void -_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp) -{ - SET_GenFragmentShadersATI(disp, _mesa_GenFragmentShadersATI); - SET_BindFragmentShaderATI(disp, _mesa_BindFragmentShaderATI); - SET_DeleteFragmentShaderATI(disp, _mesa_DeleteFragmentShaderATI); - SET_BeginFragmentShaderATI(disp, _mesa_BeginFragmentShaderATI); - SET_EndFragmentShaderATI(disp, _mesa_EndFragmentShaderATI); - SET_PassTexCoordATI(disp, _mesa_PassTexCoordATI); - SET_SampleMapATI(disp, _mesa_SampleMapATI); - SET_ColorFragmentOp1ATI(disp, _mesa_ColorFragmentOp1ATI); - SET_ColorFragmentOp2ATI(disp, _mesa_ColorFragmentOp2ATI); - SET_ColorFragmentOp3ATI(disp, _mesa_ColorFragmentOp3ATI); - SET_AlphaFragmentOp1ATI(disp, _mesa_AlphaFragmentOp1ATI); - SET_AlphaFragmentOp2ATI(disp, _mesa_AlphaFragmentOp2ATI); - SET_AlphaFragmentOp3ATI(disp, _mesa_AlphaFragmentOp3ATI); - SET_SetFragmentShaderConstantATI(disp, _mesa_SetFragmentShaderConstantATI); -} - - /** * Allocate and initialize a new ATI fragment shader object. */ struct ati_fragment_shader * -_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id) +_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id) { struct ati_fragment_shader *s = CALLOC_STRUCT(ati_fragment_shader); (void) ctx; @@ -78,14 +56,12 @@ _mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id) * Delete the given ati fragment shader */ void -_mesa_delete_ati_fragment_shader(GLcontext *ctx, struct ati_fragment_shader *s) +_mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct ati_fragment_shader *s) { GLuint i; for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { - if (s->Instructions[i]) - free(s->Instructions[i]); - if (s->SetupInst[i]) - free(s->SetupInst[i]); + free(s->Instructions[i]); + free(s->SetupInst[i]); } free(s); } @@ -316,6 +292,7 @@ _mesa_DeleteFragmentShaderATI(GLuint id) if (prog) { prog->RefCount--; if (prog->RefCount <= 0) { + assert(prog != &DummyShader); free(prog); } } @@ -340,21 +317,17 @@ _mesa_BeginFragmentShaderATI(void) (or, could use the same mem but would need to reinitialize) */ /* no idea if it's allowed to redefine a shader */ for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { - if (ctx->ATIFragmentShader.Current->Instructions[i]) - free(ctx->ATIFragmentShader.Current->Instructions[i]); - if (ctx->ATIFragmentShader.Current->SetupInst[i]) - free(ctx->ATIFragmentShader.Current->SetupInst[i]); + free(ctx->ATIFragmentShader.Current->Instructions[i]); + free(ctx->ATIFragmentShader.Current->SetupInst[i]); } /* malloc the instructions here - not sure if the best place but its a start */ for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { ctx->ATIFragmentShader.Current->Instructions[i] = - (struct atifs_instruction *) calloc(1, sizeof(struct atifs_instruction) * (MAX_NUM_INSTRUCTIONS_PER_PASS_ATI)); ctx->ATIFragmentShader.Current->SetupInst[i] = - (struct atifs_setupinst *) calloc(1, sizeof(struct atifs_setupinst) * (MAX_NUM_FRAGMENT_REGISTERS_ATI)); } @@ -492,7 +465,7 @@ _mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle) } } - curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); + curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); new_tex_inst(curProg); /* add the instructions */ @@ -565,7 +538,7 @@ _mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle) } } - curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); + curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); new_tex_inst(curProg); /* add the instructions */ @@ -790,5 +763,3 @@ _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value) COPY_4V(ctx->ATIFragmentShader.GlobalConstants[dstindex], value); } } - -#endif /* FEATURE_ATI_fragment_shader */