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:
authorClément Foucault <foucault.clem@gmail.com>2019-09-14 00:02:45 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-09-14 00:03:10 +0300
commitfd5c1972cd5c8a826c0d40effb0e2d367389666a (patch)
tree6a093944267ff888e9fb4323bac22d52468ab7ec /source/blender/gpu/shaders
parentc80564ef9f557fadd235b87533b24d126e2138c9 (diff)
Revert "DRW: Refactor to support draw call batching"
This reverts commit ce34a6b0d727bbde6ae373afa8ec6c42bc8980ce.
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_common_obinfos_lib.glsl19
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl8
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_distance_line_vert.glsl7
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl7
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_vert.glsl2
6 files changed, 19 insertions, 34 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_common_obinfos_lib.glsl b/source/blender/gpu/shaders/gpu_shader_common_obinfos_lib.glsl
deleted file mode 100644
index aa1d437c307..00000000000
--- a/source/blender/gpu/shaders/gpu_shader_common_obinfos_lib.glsl
+++ /dev/null
@@ -1,19 +0,0 @@
-
-/* Need to be included after common_view_lib.glsl for resource_id. */
-#ifndef GPU_OBINFOS_UBO
-#define GPU_OBINFOS_UBO
-struct ObjectInfos {
- vec4 drw_OrcoTexCoFactors[2];
- vec4 drw_ObjectColor;
- vec4 drw_Infos;
-};
-
-layout(std140) uniform infoBlock
-{
- /* DRW_RESOURCE_CHUNK_LEN = 512 */
- ObjectInfos drw_infos[512];
-};
-#define OrcoTexCoFactors (drw_infos[resource_id].drw_OrcoTexCoFactors)
-#define ObjectInfo (drw_infos[resource_id].drw_Infos)
-#define ObjectColor (drw_infos[resource_id].drw_ObjectColor)
-#endif
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl
index f32c47bcec3..31b359dbe6d 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl
@@ -1,5 +1,8 @@
uniform mat4 ViewProjectionMatrix;
+#ifdef USE_WORLD_CLIP_PLANES
+uniform mat4 ModelMatrix;
+#endif
/* ---- Instantiated Attrs ---- */
in float pos;
@@ -44,12 +47,11 @@ void main()
pPos = vec3(0.0);
}
- vec4 wPos = InstanceModelMatrix * vec4(pPos, 1.0);
- gl_Position = ViewProjectionMatrix * wPos;
+ gl_Position = ViewProjectionMatrix * InstanceModelMatrix * vec4(pPos, 1.0);
finalColor = vec4(color, 1.0);
#ifdef USE_WORLD_CLIP_PLANES
- world_clip_planes_calc_clip_distance(wPos.xyz);
+ world_clip_planes_calc_clip_distance((ModelMatrix * InstanceModelMatrix * vec4(pPos, 1.0)).xyz);
#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_distance_line_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_distance_line_vert.glsl
index 5bd29c55e42..d9a0ffbbdac 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_distance_line_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_distance_line_vert.glsl
@@ -18,14 +18,13 @@ void main()
{
float len = end - start;
vec3 sta = vec3(0.0, 0.0, -start);
+ vec4 pos_4d = vec4(pos * -len + sta, 1.0);
- vec4 wPos = InstanceModelMatrix * vec4(pos * -len + sta, 1.0);
-
- gl_Position = ViewProjectionMatrix * wPos;
+ gl_Position = ViewProjectionMatrix * InstanceModelMatrix * pos_4d;
gl_PointSize = size;
finalColor = vec4(color, 1.0);
#ifdef USE_WORLD_CLIP_PLANES
- world_clip_planes_calc_clip_distance(wPos.xyz);
+ world_clip_planes_calc_clip_distance((InstanceModelMatrix * pos_4d).xyz);
#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl
index 10228a1e985..3e52e43beae 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl
@@ -1,5 +1,6 @@
uniform mat4 ViewProjectionMatrix;
+uniform mat4 ModelMatrix;
/* ---- Instantiated Attrs ---- */
in vec3 pos;
@@ -19,10 +20,10 @@ void main()
{
finalColor = color;
- vec4 wPos = InstanceModelMatrix * vec4(pos * size, 1.0);
- gl_Position = ViewProjectionMatrix * wPos;
+ vec4 pos_4d = vec4(pos * size, 1.0);
+ gl_Position = ViewProjectionMatrix * InstanceModelMatrix * pos_4d;
#ifdef USE_WORLD_CLIP_PLANES
- world_clip_planes_calc_clip_distance(wPos.xyz);
+ world_clip_planes_calc_clip_distance((ModelMatrix * InstanceModelMatrix * pos_4d).xyz);
#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl
index 32db8d17572..130f46e1e33 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl
@@ -1,6 +1,8 @@
uniform mat4 ViewProjectionMatrix;
-
+#ifdef USE_WORLD_CLIP_PLANES
+uniform mat4 ModelMatrix;
+#endif
uniform int baseId;
/* ---- Instantiated Attrs ---- */
@@ -19,11 +21,11 @@ flat out uint finalId;
void main()
{
- vec4 wPos = InstanceModelMatrix * vec4(pos * size, 1.0);
- gl_Position = ViewProjectionMatrix * wPos;
+ vec4 pos_4d = vec4(pos * size, 1.0);
+ gl_Position = ViewProjectionMatrix * InstanceModelMatrix * pos_4d;
finalId = uint(baseId + callId);
#ifdef USE_WORLD_CLIP_PLANES
- world_clip_planes_calc_clip_distance(wPos.xyz);
+ world_clip_planes_calc_clip_distance((ModelMatrix * InstanceModelMatrix * pos_4d).xyz);
#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl
index b8d31f5540a..eeca6e972fa 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl
@@ -9,5 +9,5 @@ in mat4 InstanceModelMatrix;
void main()
{
- gl_Position = ViewProjectionMatrix * (InstanceModelMatrix * vec4(pos, 1.0));
+ gl_Position = ViewProjectionMatrix * InstanceModelMatrix * vec4(pos, 1.0);
}