[Bf-blender-cvs] [27d837a6ac7] blender2.8-workbench: Workbench: Shader compilation

Jeroen Bakker noreply at git.blender.org
Thu Apr 26 08:06:47 CEST 2018


Commit: 27d837a6ac7104bf8ddd65839fcc2369ec9ba834
Author: Jeroen Bakker
Date:   Thu Apr 26 08:06:22 2018 +0200
Branches: blender2.8-workbench
https://developer.blender.org/rB27d837a6ac7104bf8ddd65839fcc2369ec9ba834

Workbench: Shader compilation

===================================================================

M	source/blender/draw/engines/workbench/shaders/workbench_object_overlap_lib.glsl
M	source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
M	source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl

===================================================================

diff --git a/source/blender/draw/engines/workbench/shaders/workbench_object_overlap_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_object_overlap_lib.glsl
index e961f50b5f2..0c1c430c61b 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_object_overlap_lib.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_object_overlap_lib.glsl
@@ -9,5 +9,5 @@ float calculate_object_overlap(usampler2D objectId, ivec2 texel, uint object_id)
 	    texelFetchOffset(objectId, texel, 0, ivec2(-OBJECT_OVERLAP_OFFSET, 0)).r,
 	    texelFetchOffset(objectId, texel, 0, ivec2( OBJECT_OVERLAP_OFFSET, 0)).r);
 
-	return dot(vec4(equal(uvec4(object_id), oid_offset)), vec4(1.0/4.0));
+	return dot(vec4(equal(uvec4(object_id), oid_offset)), vec4(0.25));
 }
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
index 1535ab2e36f..09258654072 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
@@ -1,20 +1,25 @@
 uniform int object_id = 0;
 uniform vec3 object_color = vec3(1.0, 0.0, 1.0);
 
+#ifdef V3D_LIGHTING_STUDIO
 in vec3 normal_viewport;
+#endif /* V3D_LIGHTING_STUDIO */
 
 out uint objectId;
 out vec4 diffuseColor;
+#ifdef V3D_LIGHTING_STUDIO
 #ifdef WORKBENCH_ENCODE_NORMALS
 out vec2 normalViewport;
-#else
+#else /* WORKBENCH_ENCODE_NORMALS */
 out vec3 normalViewport;
-#endif
+#endif /* WORKBENCH_ENCODE_NORMALS */
+#endif /* V3D_LIGHTING_STUDIO */
 
 void main()
 {
 	objectId = uint(object_id);
 	diffuseColor = vec4(object_color, 0.0);
+#ifdef V3D_LIGHTING_STUDIO
 #ifdef WORKBENCH_ENCODE_NORMALS
 	if (!gl_FrontFacing) {
 		normalViewport = normal_encode(-normal_viewport);
@@ -25,4 +30,5 @@ void main()
 #else /* WORKBENCH_ENCODE_NORMALS */
 	normalViewport = normal_viewport;
 #endif /* WORKBENCH_ENCODE_NORMALS */
+#endif /* V3D_LIGHTING_STUDIO */
 }
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
index 2da5deabfc2..8f62ddb161d 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
@@ -1,13 +1,21 @@
 uniform mat4 ModelViewProjectionMatrix;
+#ifdef V3D_LIGHTING_STUDIO
 uniform mat3 NormalMatrix;
+#endif /* V3D_LIGHTING_STUDIO */
 
 in vec3 pos;
+#ifdef V3D_LIGHTING_STUDIO
 in vec3 nor;
+#endif /* V3D_LIGHTING_STUDIO */
 
+#ifdef V3D_LIGHTING_STUDIO
 out vec3 normal_viewport;
+#endif /* V3D_LIGHTING_STUDIO */
 
 void main()
 {
+#ifdef V3D_LIGHTING_STUDIO
 	normal_viewport = normalize(NormalMatrix * nor);
+#endif /* V3D_LIGHTING_STUDIO */
 	gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
 }



More information about the Bf-blender-cvs mailing list