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:
authorCampbell Barton <ideasman42@gmail.com>2019-02-10 03:06:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-02-10 03:16:31 +0300
commit0b6dbbc306b0a7e60abe36968d154241bb90c1df (patch)
treed22a40e3e73f80bc1150cffe1fde866f1f602865 /source/blender/gpu
parent16d7967c2b404cbe6719192e073c7685376f6ab1 (diff)
Cleanup: move clipping shader lib & define into struct
Also compare clipping with the draw context instead of accessing the RegionView3D, currently they're matching but this might not always be the case.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_shader.h7
-rw-r--r--source/blender/gpu/intern/gpu_shader.c11
2 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index bae8c3c7b53..2a00c505cb3 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -365,6 +365,13 @@ typedef enum eGPUShaderConfig {
} eGPUShaderConfig;
#define GPU_SHADER_CFG_LEN (GPU_SHADER_CFG_CLIPPED + 1)
+typedef struct GPUShaderConfigData {
+ const char *lib;
+ const char *def;
+} GPUShaderConfigData;
+/* shader.c */
+extern const GPUShaderConfigData GPU_shader_cfg_data[GPU_SHADER_CFG_LEN];
+
/** Keep these in sync with:
* - `gpu_shader_image_interlace_frag.glsl`
* - `gpu_shader_image_rect_interlace_frag.glsl`
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index 4245adbde5f..66c5aea92db 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -171,6 +171,17 @@ extern char datatoc_gpu_shader_gpencil_fill_vert_glsl[];
extern char datatoc_gpu_shader_gpencil_fill_frag_glsl[];
extern char datatoc_gpu_shader_cfg_world_clip_lib_glsl[];
+const struct GPUShaderConfigData GPU_shader_cfg_data[GPU_SHADER_CFG_LEN] = {
+ [GPU_SHADER_CFG_DEFAULT] = {
+ .lib = "",
+ .def = "",
+ },
+ [GPU_SHADER_CFG_CLIPPED] = {
+ .lib = datatoc_gpu_shader_cfg_world_clip_lib_glsl,
+ .def = "#define USE_WORLD_CLIP_PLANES\n",
+ },
+};
+
/* cache of built-in shaders (each is created on first use) */
static GPUShader *builtin_shaders[GPU_SHADER_CFG_LEN][GPU_SHADER_BUILTIN_LEN] = {NULL};