Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-09-27 20:38:35 +0300
committerMike Erwin <significant.bit@gmail.com>2016-09-27 22:25:38 +0300
commit0ca211885182bf9b07329eeac7e0a930a410984a (patch)
tree48a9a845703627782b480e6bfda37109ca3db793
parentad32b774cbfe5470a5d3cd074e16b325c5393a07 (diff)
safety checks in GPU shader library
If shader compilation fails, or for some other reason the shader is NULL or 0, we need to know.
-rw-r--r--source/blender/gpu/intern/gpu_shader.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index 41a45377ad8..6a730f3e53e 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -470,6 +470,8 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode,
void GPU_shader_bind(GPUShader *shader)
{
+ BLI_assert(shader && shader->program);
+
glUseProgram(shader->program);
}
@@ -480,6 +482,8 @@ void GPU_shader_unbind(void)
void GPU_shader_free(GPUShader *shader)
{
+ BLI_assert(shader);
+
if (shader->vertex)
glDeleteShader(shader->vertex);
if (shader->geometry)
@@ -497,6 +501,8 @@ void GPU_shader_free(GPUShader *shader)
int GPU_shader_get_uniform(GPUShader *shader, const char *name)
{
+ BLI_assert(shader && shader->program);
+
return glGetUniformLocation(shader->program, name);
}
@@ -584,6 +590,8 @@ void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), int location, GPUText
int GPU_shader_get_attribute(GPUShader *shader, const char *name)
{
+ BLI_assert(shader && shader->program);
+
return glGetAttribLocation(shader->program, name);
}