summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shared.c
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2014-01-07 15:19:07 -0800
committerPaul Berry <stereotype441@gmail.com>2014-01-21 20:24:56 -0800
commit4a91675b262c8150c1542991e1018e924c72f337 (patch)
treea1000cbc2a2aa26a2ad226a4eae43409b66e7f4b /src/mesa/main/shared.c
parent020919b2ae76192f0f35c0901be0e1069a87b7f2 (diff)
downloadexternal_mesa3d-4a91675b262c8150c1542991e1018e924c72f337.zip
external_mesa3d-4a91675b262c8150c1542991e1018e924c72f337.tar.gz
external_mesa3d-4a91675b262c8150c1542991e1018e924c72f337.tar.bz2
mesa: use _mesa_validate_shader_target() more frequently.
This patch replaces code in _mesa_new_shader() and delete_shader_cb() that checks the type of a shader with calls to _mesa_validate_shader_target(). This has two advantages: it allows for a more thorough check (since _mesa_validate_shader_target() doesn't permit shader targets that aren't supported by the back-end), and it reduces the amount of code that will need to be modified when adding new shader stages. Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/main/shared.c')
-rw-r--r--src/mesa/main/shared.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index 2f73cf3..c11c7f9 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -38,6 +38,7 @@
#include "dlist.h"
#include "samplerobj.h"
#include "set.h"
+#include "shaderapi.h"
#include "shaderobj.h"
#include "syncobj.h"
@@ -218,8 +219,7 @@ delete_shader_cb(GLuint id, void *data, void *userData)
{
struct gl_context *ctx = (struct gl_context *) userData;
struct gl_shader *sh = (struct gl_shader *) data;
- if (sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER ||
- sh->Type == GL_GEOMETRY_SHADER) {
+ if (_mesa_validate_shader_target(ctx, sh->Type)) {
ctx->Driver.DeleteShader(ctx, sh);
}
else {