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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-02 20:37:31 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-02 20:37:31 +0400
commit0aada35e9331f58fc05884a2d885d28ae7a18386 (patch)
treef299e41a63a998a088b71aece1e9a04081039e44 /source/blender/gpu
parent5c74e6dae2826774b7ff36295d6499a5d45d1060 (diff)
Fix #34788, #34744: GLSL error, #version line needs to be at the top of the shader
and this wasn't the case anymore after recent changes.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c6
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c18
2 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index ae1eb62bc18..f1b631192af 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -680,12 +680,6 @@ void GPU_code_generate_glsl_lib(void)
ds = BLI_dynstr_new();
- if (GPU_bicubic_bump_support()) {
- BLI_dynstr_append(ds, "/* These are needed for high quality bump mapping */\n"
- "#version 130\n"
- "#extension GL_ARB_texture_query_lod: enable\n"
- "#define BUMP_BICUBIC\n");
- }
BLI_dynstr_append(ds, datatoc_gpu_shader_material_glsl);
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index e8d28877043..7ac852f551a 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -1136,6 +1136,18 @@ static void shader_print_errors(const char *task, char *log, const char *code)
fprintf(stderr, "%s\n", log);
}
+static const char *gpu_shader_standard_extensions(void)
+{
+ /* need this extensions for high quality bump mapping */
+ if(GPU_bicubic_bump_support()) {
+ return "#version 130\n"
+ "#extension GL_ARB_texture_query_lod: enable\n"
+ "#define BUMP_BICUBIC\n";
+ }
+
+ return "";
+}
+
static const char *gpu_shader_standard_defines(void)
{
/* some useful defines to detect GPU type */
@@ -1177,9 +1189,10 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, const
}
if (vertexcode) {
- const char *source[3];
+ const char *source[4];
int num_source = 0;
+ source[num_source++] = gpu_shader_standard_extensions();
source[num_source++] = gpu_shader_standard_defines();
if (defines) source[num_source++] = defines;
@@ -1201,9 +1214,10 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, const
}
if (fragcode) {
- const char *source[4];
+ const char *source[5];
int num_source = 0;
+ source[num_source++] = gpu_shader_standard_extensions();
source[num_source++] = gpu_shader_standard_defines();
if (defines) source[num_source++] = defines;