1
1

DRW: Add preprocessor error if including common_view_lib.glsl without draw_view

This avoid making include mistake and potentially detect areas that do
not really need common_view_lib.glsl.
This commit is contained in:
2022-02-06 01:18:19 +01:00
parent 085a3662dd
commit 48fbf0baea
2 changed files with 9 additions and 3 deletions

View File

@@ -13,7 +13,7 @@ GPU_SHADER_CREATE_INFO(workbench_composite)
.fragment_out(0, Type::VEC4, "fragColor")
.typedef_source("workbench_shader_shared.h")
.fragment_source("workbench_composite_frag.glsl")
.additional_info("draw_fullscreen");
.additional_info("draw_fullscreen", "draw_view");
/** \} */

View File

@@ -1,5 +1,5 @@
/* Temporary until we fully make the switch. */
#ifndef DRW_SHADER_SHARED_H
#ifndef USE_GPU_SHADER_CREATE_INFO
# define DRW_RESOURCE_CHUNK_LEN 512
@@ -24,7 +24,13 @@ layout(std140) uniform viewBlock
vec4 CameraTexCoFactors;
};
#endif /* DRW_SHADER_SHARED_H */
#endif /* USE_GPU_SHADER_CREATE_INFO */
#ifdef USE_GPU_SHADER_CREATE_INFO
# ifndef DRW_RESOURCE_CHUNK_LEN
# error "Missing draw_view additional create info on shader create info"
# endif
#endif
#define ViewNear (ViewVecs[0].w)
#define ViewFar (ViewVecs[1].w)