From f61ad0e1017bcf924b0529738c08c3a74d1e7476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 30 Nov 2020 14:52:46 +0100 Subject: Fix T83203 BGL: shader.program wrongly always returns 0 This was a leftover from the 2.91 GPU module refactor. This is an exception that should be removed when we remove BGL. --- source/blender/gpu/intern/gpu_shader.cc | 7 +++---- source/blender/gpu/intern/gpu_shader_private.hh | 3 +++ source/blender/gpu/opengl/gl_shader.cc | 5 +++++ source/blender/gpu/opengl/gl_shader.hh | 3 +++ 4 files changed, 14 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index 49f96cb652c..827ea06686f 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -591,11 +591,10 @@ int GPU_shader_get_attribute(GPUShader *shader, const char *name) /** \name Getters * \{ */ -/* Clement : Temp */ -int GPU_shader_get_program(GPUShader *UNUSED(shader)) +/* DEPRECATED: Kept only because of BGL API */ +int GPU_shader_get_program(GPUShader *shader) { - /* TODO fixme */ - return (int)0; + return unwrap(shader)->program_handle_get(); } /** \} */ diff --git a/source/blender/gpu/intern/gpu_shader_private.hh b/source/blender/gpu/intern/gpu_shader_private.hh index eac39dccd81..3c29fdec36c 100644 --- a/source/blender/gpu/intern/gpu_shader_private.hh +++ b/source/blender/gpu/intern/gpu_shader_private.hh @@ -64,6 +64,9 @@ class Shader { virtual void vertformat_from_shader(GPUVertFormat *) const = 0; + /* DEPRECATED: Kept only because of BGL API. */ + virtual int program_handle_get(void) const = 0; + inline const char *const name_get(void) const { return name; diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index cc5f83228d6..28b89ad48f5 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -426,4 +426,9 @@ void GLShader::vertformat_from_shader(GPUVertFormat *format) const } } +int GLShader::program_handle_get(void) const +{ + return (int)this->shader_program_; +} + /** \} */ diff --git a/source/blender/gpu/opengl/gl_shader.hh b/source/blender/gpu/opengl/gl_shader.hh index a686014f4c5..befb2bce8b0 100644 --- a/source/blender/gpu/opengl/gl_shader.hh +++ b/source/blender/gpu/opengl/gl_shader.hh @@ -71,6 +71,9 @@ class GLShader : public Shader { void vertformat_from_shader(GPUVertFormat *format) const override; + /* DEPRECATED: Kept only because of BGL API. */ + int program_handle_get(void) const override; + private: char *glsl_patch_get(void); -- cgit v1.2.3