Vulkan: Convert Workbench Stage Interfaces

Convert workbench stage interfaces to be compatible with Vulkan.

Pull Request: https://projects.blender.org/blender/blender/pulls/111221
This commit is contained in:
Jeroen Bakker
2023-08-17 15:48:22 +02:00
parent 667be8c49d
commit 6c9f6eefe9
4 changed files with 7 additions and 4 deletions

View File

@@ -13,7 +13,8 @@
GPU_SHADER_INTERFACE_INFO(workbench_shadow_iface, "vData")
.smooth(Type::VEC3, "pos")
.smooth(Type::VEC4, "frontPosition")
.smooth(Type::VEC4, "backPosition")
.smooth(Type::VEC4, "backPosition");
GPU_SHADER_INTERFACE_INFO(workbench_shadow_flat_iface, "vData_flat")
.flat(Type::VEC3, "light_direction_os"); /*Workbench Next*/
GPU_SHADER_CREATE_INFO(workbench_shadow_common)
@@ -27,6 +28,7 @@ GPU_SHADER_CREATE_INFO(workbench_shadow_common)
* as only gl_Position is returned. */
GPU_SHADER_CREATE_INFO(workbench_shadow_common_geom)
.vertex_out(workbench_shadow_iface)
.vertex_out(workbench_shadow_flat_iface)
.vertex_source("workbench_shadow_vert.glsl");
GPU_SHADER_CREATE_INFO(workbench_next_shadow_common)

View File

@@ -35,7 +35,7 @@ void main()
vec3 n = cross(v12, v10);
#ifdef WORKBENCH_NEXT
float facing = dot(n, vData[0].light_direction_os);
float facing = dot(n, vData_flat[0].light_direction_os);
#else
float facing = dot(n, lightDirection);
#endif

View File

@@ -43,7 +43,8 @@ void main()
#endif
#ifdef WORKBENCH_NEXT
vec2 facing = vec2(dot(n1, vData[0].light_direction_os), dot(n2, vData[0].light_direction_os));
vec2 facing = vec2(dot(n1, vData_flat[0].light_direction_os),
dot(n2, vData_flat[0].light_direction_os));
#else
vec2 facing = vec2(dot(n1, lightDirection), dot(n2, lightDirection));
#endif

View File

@@ -6,7 +6,7 @@ void main()
vData.pos = pos;
vData.frontPosition = point_object_to_ndc(pos);
#ifdef WORKBENCH_NEXT
vData.light_direction_os = normal_world_to_object(vec3(pass_data.light_direction_ws));
vData_flat.light_direction_os = normal_world_to_object(vec3(pass_data.light_direction_ws));
vec3 pos_ws = point_object_to_world(pos);
float extrude_distance = 1e5f;
float LDoFP = dot(pass_data.light_direction_ws, pass_data.far_plane.xyz);