diff options
Diffstat (limited to 'source/blender/gpu/opengl/gl_shader.cc')
-rw-r--r-- | source/blender/gpu/opengl/gl_shader.cc | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index 9136a1d9714..4314ecfa6be 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -25,9 +25,9 @@ #include "BLI_string.h" -#include "GPU_extensions.h" #include "GPU_platform.h" +#include "gl_backend.hh" #include "gl_vertex_buffer.hh" #include "gl_shader.hh" @@ -44,24 +44,22 @@ GLShader::GLShader(const char *name) : Shader(name) { #if 0 /* Would be nice to have, but for now the Deferred compilation \ * does not have a GPUContext. */ - BLI_assert(GPU_context_active_get() != NULL); + BLI_assert(GLContext::get() != NULL); #endif shader_program_ = glCreateProgram(); -#ifndef __APPLE__ - if ((G.debug & G_DEBUG_GPU) && (GLEW_VERSION_4_3 || GLEW_KHR_debug)) { + if (GLContext::debug_layer_support) { char sh_name[64]; SNPRINTF(sh_name, "ShaderProgram-%s", name); glObjectLabel(GL_PROGRAM, shader_program_, -1, sh_name); } -#endif } GLShader::~GLShader(void) { #if 0 /* Would be nice to have, but for now the Deferred compilation \ * does not have a GPUContext. */ - BLI_assert(GPU_context_active_get() != NULL); + BLI_assert(GLContext::get() != NULL); #endif /* Invalid handles are silently ignored. */ glDeleteShader(vert_shader_); @@ -112,16 +110,14 @@ char *GLShader::glsl_patch_get(void) STR_CONCAT(patch, slen, "#extension GL_ARB_shader_draw_parameters : enable\n"); STR_CONCAT(patch, slen, "#define GPU_ARB_shader_draw_parameters\n"); } - if (GPU_arb_texture_cube_map_array_is_supported()) { + if (GLContext::texture_cube_map_array_support) { STR_CONCAT(patch, slen, "#extension GL_ARB_texture_cube_map_array : enable\n"); STR_CONCAT(patch, slen, "#define GPU_ARB_texture_cube_map_array\n"); } /* Derivative sign can change depending on implementation. */ - float derivatives[2]; - GPU_get_dfdy_factors(derivatives); - STR_CONCATF(patch, slen, "#define DFDX_SIGN %1.1f\n", derivatives[0]); - STR_CONCATF(patch, slen, "#define DFDY_SIGN %1.1f\n", derivatives[1]); + STR_CONCATF(patch, slen, "#define DFDX_SIGN %1.1f\n", GLContext::derivative_signs[0]); + STR_CONCATF(patch, slen, "#define DFDY_SIGN %1.1f\n", GLContext::derivative_signs[1]); BLI_assert(slen < sizeof(patch)); return patch; @@ -167,8 +163,7 @@ GLuint GLShader::create_shader_stage(GLenum gl_stage, MutableSpan<const char *> return 0; } -#ifndef __APPLE__ - if ((G.debug & G_DEBUG_GPU) && (GLEW_VERSION_4_3 || GLEW_KHR_debug)) { + if (GLContext::debug_layer_support) { char sh_name[64]; switch (gl_stage) { case GL_VERTEX_SHADER: @@ -183,7 +178,6 @@ GLuint GLShader::create_shader_stage(GLenum gl_stage, MutableSpan<const char *> } glObjectLabel(GL_SHADER, shader, -1, sh_name); } -#endif glAttachShader(shader_program_, shader); return shader; |