|
@@ -32,18 +32,26 @@ layout(location = 5) in highp uvec4 instance_color_custom_data; // Color packed
|
|
|
|
|
|
#include "stdlib_inc.glsl"
|
|
#include "stdlib_inc.glsl"
|
|
|
|
|
|
-layout(location = 6) in highp vec4 attrib_A;
|
|
|
|
-layout(location = 7) in highp vec4 attrib_B;
|
|
|
|
-layout(location = 8) in highp vec4 attrib_C;
|
|
|
|
-layout(location = 9) in highp vec4 attrib_D;
|
|
|
|
-layout(location = 10) in highp vec4 attrib_E;
|
|
|
|
|
|
+#if defined(CUSTOM0_USED)
|
|
|
|
+layout(location = 6) in highp vec4 custom0_attrib;
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#if defined(CUSTOM1_USED)
|
|
|
|
+layout(location = 7) in highp vec4 custom1_attrib;
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+layout(location = 8) in highp vec4 attrib_A;
|
|
|
|
+layout(location = 9) in highp vec4 attrib_B;
|
|
|
|
+layout(location = 10) in highp vec4 attrib_C;
|
|
|
|
+layout(location = 11) in highp vec4 attrib_D;
|
|
|
|
+layout(location = 12) in highp vec4 attrib_E;
|
|
#ifdef USE_PRIMITIVE
|
|
#ifdef USE_PRIMITIVE
|
|
-layout(location = 11) in highp uvec4 attrib_F;
|
|
|
|
|
|
+layout(location = 13) in highp uvec4 attrib_F;
|
|
#else
|
|
#else
|
|
-layout(location = 11) in highp vec4 attrib_F;
|
|
|
|
|
|
+layout(location = 13) in highp vec4 attrib_F;
|
|
#endif
|
|
#endif
|
|
-layout(location = 12) in highp uvec4 attrib_G;
|
|
|
|
-layout(location = 13) in highp uvec4 attrib_H;
|
|
|
|
|
|
+layout(location = 14) in highp uvec4 attrib_G;
|
|
|
|
+layout(location = 15) in highp uvec4 attrib_H;
|
|
|
|
|
|
#define read_draw_data_world_x attrib_A.xy
|
|
#define read_draw_data_world_x attrib_A.xy
|
|
#define read_draw_data_world_y attrib_A.zw
|
|
#define read_draw_data_world_y attrib_A.zw
|
|
@@ -137,6 +145,13 @@ void main() {
|
|
|
|
|
|
vec4 instance_custom = vec4(0.0);
|
|
vec4 instance_custom = vec4(0.0);
|
|
|
|
|
|
|
|
+#if defined(CUSTOM0_USED)
|
|
|
|
+ vec4 custom0 = vec4(0.0);
|
|
|
|
+#endif
|
|
|
|
+#if defined(CUSTOM1_USED)
|
|
|
|
+ vec4 custom1 = vec4(0.0);
|
|
|
|
+#endif
|
|
|
|
+
|
|
#ifdef USE_PRIMITIVE
|
|
#ifdef USE_PRIMITIVE
|
|
vec2 vertex;
|
|
vec2 vertex;
|
|
vec2 uv;
|
|
vec2 uv;
|
|
@@ -169,9 +184,9 @@ void main() {
|
|
if (bool(read_draw_data_flags & FLAGS_INSTANCING_HAS_CUSTOM_DATA)) {
|
|
if (bool(read_draw_data_flags & FLAGS_INSTANCING_HAS_CUSTOM_DATA)) {
|
|
instance_custom = vec4(unpackHalf2x16(instance_color_custom_data.z), unpackHalf2x16(instance_color_custom_data.w));
|
|
instance_custom = vec4(unpackHalf2x16(instance_color_custom_data.z), unpackHalf2x16(instance_color_custom_data.w));
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
|
|
+#endif // !USE_INSTANCING
|
|
|
|
|
|
-#else
|
|
|
|
|
|
+#else // !USE_ATTRIBUTES
|
|
vec2 vertex_base_arr[6] = vec2[](vec2(0.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 1.0), vec2(1.0, 0.0), vec2(0.0, 0.0), vec2(1.0, 1.0));
|
|
vec2 vertex_base_arr[6] = vec2[](vec2(0.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 1.0), vec2(1.0, 0.0), vec2(0.0, 0.0), vec2(1.0, 1.0));
|
|
vec2 vertex_base = vertex_base_arr[gl_VertexID % 6];
|
|
vec2 vertex_base = vertex_base_arr[gl_VertexID % 6];
|
|
|
|
|
|
@@ -179,6 +194,14 @@ void main() {
|
|
vec4 color = read_draw_data_modulation;
|
|
vec4 color = read_draw_data_modulation;
|
|
vec2 vertex = read_draw_data_dst_rect.xy + abs(read_draw_data_dst_rect.zw) * mix(vertex_base, vec2(1.0, 1.0) - vertex_base, lessThan(read_draw_data_src_rect.zw, vec2(0.0, 0.0)));
|
|
vec2 vertex = read_draw_data_dst_rect.xy + abs(read_draw_data_dst_rect.zw) * mix(vertex_base, vec2(1.0, 1.0) - vertex_base, lessThan(read_draw_data_src_rect.zw, vec2(0.0, 0.0)));
|
|
|
|
|
|
|
|
+#endif // USE_ATTRIBUTES
|
|
|
|
+
|
|
|
|
+#if defined(CUSTOM0_USED)
|
|
|
|
+ custom0 = custom0_attrib;
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#if defined(CUSTOM1_USED)
|
|
|
|
+ custom1 = custom1_attrib;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
mat4 model_matrix = mat4(vec4(read_draw_data_world_x, 0.0, 0.0), vec4(read_draw_data_world_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(read_draw_data_world_ofs, 0.0, 1.0));
|
|
mat4 model_matrix = mat4(vec4(read_draw_data_world_x, 0.0, 0.0), vec4(read_draw_data_world_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(read_draw_data_world_ofs, 0.0, 1.0));
|