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:
Diffstat (limited to 'source/blender/draw/intern/shaders/common_view_lib.glsl')
-rw-r--r--source/blender/draw/intern/shaders/common_view_lib.glsl18
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/draw/intern/shaders/common_view_lib.glsl b/source/blender/draw/intern/shaders/common_view_lib.glsl
index e9912ba7d9a..b0d405165f2 100644
--- a/source/blender/draw/intern/shaders/common_view_lib.glsl
+++ b/source/blender/draw/intern/shaders/common_view_lib.glsl
@@ -1,5 +1,7 @@
-#define COMMON_VIEW_LIB
-#define DRW_RESOURCE_CHUNK_LEN 512
+/* Temporary until we fully make the switch. */
+#ifndef DRW_SHADER_SHARED_H
+
+# define DRW_RESOURCE_CHUNK_LEN 512
/* keep in sync with DRWManager.view_data */
layout(std140) uniform viewBlock
@@ -22,6 +24,8 @@ layout(std140) uniform viewBlock
vec4 CameraTexCoFactors;
};
+#endif /* DRW_SHADER_SHARED_H */
+
#define ViewNear (ViewVecs[0].w)
#define ViewFar (ViewVecs[1].w)
@@ -141,6 +145,10 @@ flat in int resourceIDFrag;
/* clang-format off */
#if !defined(GPU_INTEL) && !defined(GPU_DEPRECATED_AMD_DRIVER) && !defined(OS_MAC) && !defined(INSTANCED_ATTR)
/* clang-format on */
+
+/* Temporary until we fully make the switch. */
+# ifndef DRW_SHADER_SHARED_H
+
struct ObjectMatrices {
mat4 drw_modelMatrix;
mat4 drw_modelMatrixInverse;
@@ -150,17 +158,23 @@ layout(std140) uniform modelBlock
{
ObjectMatrices drw_matrices[DRW_RESOURCE_CHUNK_LEN];
};
+# endif /* DRW_SHADER_SHARED_H */
# define ModelMatrix (drw_matrices[resource_id].drw_modelMatrix)
# define ModelMatrixInverse (drw_matrices[resource_id].drw_modelMatrixInverse)
#else /* GPU_INTEL */
+
+/* Temporary until we fully make the switch. */
+# ifndef DRW_SHADER_SHARED_H
/* Intel GPU seems to suffer performance impact when the model matrix is in UBO storage.
* So for now we just force using the legacy path. */
/* Note that this is also a workaround of a problem on osx (amd or nvidia)
* and older amd driver on windows. */
uniform mat4 ModelMatrix;
uniform mat4 ModelMatrixInverse;
+# endif /* DRW_SHADER_SHARED_H */
+
#endif
#define resource_handle (resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)