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-03-13 22:00:13 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-03-13 22:00:13 +0400
commit5ff0daf1acdc5d88afcec016a379b33cb2cd1288 (patch)
treed0c56acef2add2ad16bbd9cbbbebccaaadd53104 /source/blender/gpu/intern
parent1d73ee50a48012712bc2846602fb475bb76f7c21 (diff)
Fix #34492: clipping border not working with GLSL/matcap and Nouveau drivers.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index fd671446768..08f4206e4ca 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -1128,6 +1128,19 @@ static void shader_print_errors(const char *task, char *log, const char *code)
fprintf(stderr, "%s\n", log);
}
+static const char *gpu_shader_standard_defines()
+{
+ /* some useful defines to detect GPU type */
+ if(GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY))
+ return "#define GPU_ATI\n";
+ else if(GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY))
+ return "#define GPU_NVIDIA\n";
+ else if(GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY))
+ return "#define GPU_INTEL\n";
+
+ return "";
+}
+
GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, const char *libcode, const char *defines)
{
GLint status;
@@ -1156,9 +1169,11 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, const
}
if (vertexcode) {
- const char *source[2];
+ const char *source[3];
int num_source = 0;
+ source[num_source++] = gpu_shader_standard_defines();
+
if (defines) source[num_source++] = defines;
if (vertexcode) source[num_source++] = vertexcode;
@@ -1178,9 +1193,11 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, const
}
if (fragcode) {
- const char *source[3];
+ const char *source[4];
int num_source = 0;
+ source[num_source++] = gpu_shader_standard_defines();
+
if (defines) source[num_source++] = defines;
if (libcode) source[num_source++] = libcode;
if (fragcode) source[num_source++] = fragcode;