[Bf-blender-cvs] [6c65e5a] blender2.8: GPU: bind builtin shader for immediate mode
Mike Erwin
noreply at git.blender.org
Mon Aug 8 10:56:31 CEST 2016
Commit: 6c65e5a00c40888f7b7a4d78adade9fdac7e296d
Author: Mike Erwin
Date: Sun Aug 7 22:11:45 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB6c65e5a00c40888f7b7a4d78adade9fdac7e296d
GPU: bind builtin shader for immediate mode
immBindBuiltinProgram extends Gawain’s immBindProgram to use Blender’s
library of built-in shader programs.
It uses imm prefix instead of GPU_ so people won’t be tempted to call
GPU_unbind_program() afterward.
>From my understanding, Apache code is not allowed to call GPL code, so
this function needs to be in the GPU lib.
===================================================================
M source/blender/gpu/GPU_shader.h
M source/blender/gpu/intern/gpu_shader.c
===================================================================
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index 9306d7b..0e29780 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -98,10 +98,12 @@ typedef enum GPUBuiltinShader {
GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader);
GPUShader *GPU_shader_get_builtin_fx_shader(int effects, bool persp);
-void GPU_shader_bind_immediate(GPUBuiltinShader);
-
void GPU_shader_free_builtin_shaders(void);
+/* Extend Gawain’s immBindProgram to use Blender’s library of built-in shader programs.
+ * Use immUnbindProgram() when done. */
+void immBindBuiltinProgram(GPUBuiltinShader);
+
/* Vertex attributes for shaders */
#define GPU_MAX_ATTRIB 32
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index 0bd4fcd..67f6545 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -464,13 +464,6 @@ void GPU_shader_bind(GPUShader *shader)
GPU_ASSERT_NO_GL_ERRORS("Post Shader Bind");
}
-void GPU_shader_bind_immediate(GPUBuiltinShader shader_id)
-{
- GPUShader *shader = GPU_shader_get_builtin_shader(shader_id);
- GPU_shader_bind(shader);
- bind_attrib_locations(&immVertexFormat, shader->program);
-}
-
void GPU_shader_unbind(void)
{
GPU_ASSERT_NO_GL_ERRORS("Pre Shader Unbind");
@@ -782,4 +775,8 @@ void GPU_shader_free_builtin_shaders(void)
}
}
-
+void immBindBuiltinProgram(GPUBuiltinShader shader_id)
+{
+ GPUShader *shader = GPU_shader_get_builtin_shader(shader_id);
+ immBindProgram(shader->program);
+}
More information about the Bf-blender-cvs
mailing list