diff options
author | marha <marha@users.sourceforge.net> | 2010-04-12 09:53:17 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-04-12 09:53:17 +0000 |
commit | 29b86f9852b2b7ecc31cdfee56679537e40bc6e2 (patch) | |
tree | 1e6ec8ccf2dbf773260a1953b8e13c49f9b7c5f5 /mesalib/src/mesa/shader/atifragshader.c | |
parent | 529236591df7366479a6fac30b387667678fd1ba (diff) | |
download | vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.gz vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.bz2 vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.zip |
svn merge -r524:HEAD "^/branches/released" .
Diffstat (limited to 'mesalib/src/mesa/shader/atifragshader.c')
-rw-r--r-- | mesalib/src/mesa/shader/atifragshader.c | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/mesalib/src/mesa/shader/atifragshader.c b/mesalib/src/mesa/shader/atifragshader.c index ac087d415..870f77e30 100644 --- a/mesalib/src/mesa/shader/atifragshader.c +++ b/mesalib/src/mesa/shader/atifragshader.c @@ -60,11 +60,11 @@ _mesa_delete_ati_fragment_shader(GLcontext *ctx, struct ati_fragment_shader *s) GLuint i; for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { if (s->Instructions[i]) - _mesa_free(s->Instructions[i]); + free(s->Instructions[i]); if (s->SetupInst[i]) - _mesa_free(s->SetupInst[i]); + free(s->SetupInst[i]); } - _mesa_free(s); + free(s); } @@ -96,27 +96,27 @@ create_dst_mod_str(GLuint mod) { static char ret_str[1024]; - _mesa_memset(ret_str, 0, 1024); + memset(ret_str, 0, 1024); if (mod & GL_2X_BIT_ATI) - _mesa_strncat(ret_str, "|2X", 1024); + strncat(ret_str, "|2X", 1024); if (mod & GL_4X_BIT_ATI) - _mesa_strncat(ret_str, "|4X", 1024); + strncat(ret_str, "|4X", 1024); if (mod & GL_8X_BIT_ATI) - _mesa_strncat(ret_str, "|8X", 1024); + strncat(ret_str, "|8X", 1024); if (mod & GL_HALF_BIT_ATI) - _mesa_strncat(ret_str, "|HA", 1024); + strncat(ret_str, "|HA", 1024); if (mod & GL_QUARTER_BIT_ATI) - _mesa_strncat(ret_str, "|QU", 1024); + strncat(ret_str, "|QU", 1024); if (mod & GL_EIGHTH_BIT_ATI) - _mesa_strncat(ret_str, "|EI", 1024); + strncat(ret_str, "|EI", 1024); if (mod & GL_SATURATE_BIT_ATI) - _mesa_strncat(ret_str, "|SAT", 1024); + strncat(ret_str, "|SAT", 1024); - if (_mesa_strlen(ret_str) == 0) - _mesa_strncat(ret_str, "NONE", 1024); + if (strlen(ret_str) == 0) + strncat(ret_str, "NONE", 1024); return ret_str; } @@ -290,9 +290,11 @@ _mesa_DeleteFragmentShaderATI(GLuint id) /* The ID is immediately available for re-use now */ _mesa_HashRemove(ctx->Shared->ATIShaders, id); - prog->RefCount--; - if (prog->RefCount <= 0) { - _mesa_free(prog); + if (prog) { + prog->RefCount--; + if (prog->RefCount <= 0) { + free(prog); + } } } } @@ -316,9 +318,9 @@ _mesa_BeginFragmentShaderATI(void) /* 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]) - _mesa_free(ctx->ATIFragmentShader.Current->Instructions[i]); + free(ctx->ATIFragmentShader.Current->Instructions[i]); if (ctx->ATIFragmentShader.Current->SetupInst[i]) - _mesa_free(ctx->ATIFragmentShader.Current->SetupInst[i]); + free(ctx->ATIFragmentShader.Current->SetupInst[i]); } /* malloc the instructions here - not sure if the best place but its @@ -326,11 +328,11 @@ _mesa_BeginFragmentShaderATI(void) for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { ctx->ATIFragmentShader.Current->Instructions[i] = (struct atifs_instruction *) - _mesa_calloc(sizeof(struct atifs_instruction) * + calloc(1, sizeof(struct atifs_instruction) * (MAX_NUM_INSTRUCTIONS_PER_PASS_ATI)); ctx->ATIFragmentShader.Current->SetupInst[i] = (struct atifs_setupinst *) - _mesa_calloc(sizeof(struct atifs_setupinst) * + calloc(1, sizeof(struct atifs_setupinst) * (MAX_NUM_FRAGMENT_REGISTERS_ATI)); } @@ -376,8 +378,11 @@ _mesa_EndFragmentShaderATI(void) } if (ctx->ATIFragmentShader.Current->cur_pass > 1) ctx->ATIFragmentShader.Current->NumPasses = 2; - else ctx->ATIFragmentShader.Current->NumPasses = 1; - ctx->ATIFragmentShader.Current->cur_pass=0; + else + ctx->ATIFragmentShader.Current->NumPasses = 1; + + ctx->ATIFragmentShader.Current->cur_pass = 0; + #if MESA_DEBUG_ATI_FS for (j = 0; j < MAX_NUM_PASSES_ATI; j++) { for (i = 0; i < MAX_NUM_FRAGMENT_REGISTERS_ATI; i++) { @@ -400,8 +405,13 @@ _mesa_EndFragmentShaderATI(void) } } #endif - if (ctx->Driver.ProgramStringNotify) - ctx->Driver.ProgramStringNotify( ctx, GL_FRAGMENT_SHADER_ATI, NULL ); + + if (!ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_SHADER_ATI, NULL)) { + ctx->ATIFragmentShader.Current->isValid = GL_FALSE; + /* XXX is this the right error? */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glEndFragmentShaderATI(driver rejected shader)"); + } } void GLAPIENTRY |