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>2022-05-02 01:35:49 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-05-02 01:35:49 +0300
commit0676963809a4800f1f666cd559c30885d79f66b8 (patch)
treed7971e9bee7a62e8088f97cfcd475393e457f581
parent2a7a01b339ad60aec5ffe265411fa2f0b1589137 (diff)
GPUShader: Port dashed line shaders to use shaderCreateInfo
This should have no functional changes. This reduce the complexity of the shader by only supporting 2 colors. We never use more than 2 color in practice and this makes usage not require a UBO.
-rw-r--r--source/blender/editors/interface/interface_draw.c4
-rw-r--r--source/blender/editors/mask/mask_draw.c9
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c4
-rw-r--r--source/blender/editors/space_image/image_draw.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_ruler.c12
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c8
-rw-r--r--source/blender/gpu/CMakeLists.txt1
-rw-r--r--source/blender/gpu/intern/gpu_shader_builtin.c17
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl55
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl15
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl22
-rw-r--r--source/blender/gpu/shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh18
-rw-r--r--source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh46
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c20
14 files changed, 94 insertions, 141 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 695f34a448f..18bad7949ee 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1135,8 +1135,8 @@ static void ui_draw_colorband_handle(uint shdr_pos,
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
immUniform1i("colors_len", 2); /* "advanced" mode */
- immUniformArray4fv(
- "colors", (float *)(float[][4]){{0.8f, 0.8f, 0.8f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2);
+ immUniform4f("color", 0.8f, 0.8f, 0.8f, 1.0f);
+ immUniform4f("color2", 0.0f, 0.0f, 0.0f, 1.0f);
immUniform1f("dash_width", active ? 4.0f : 2.0f);
immUniform1f("dash_factor", 0.5f);
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 60232dee109..aab4007854f 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -464,12 +464,12 @@ static void mask_draw_curve_type(const bContext *C,
break;
case MASK_DT_DASH: {
- float colors[8];
+ float colors[2][4];
mask_color_active_tint(rgb_tmp, rgb_spline, is_active);
- rgba_uchar_to_float(colors, rgb_tmp);
+ rgba_uchar_to_float(colors[0], rgb_tmp);
mask_color_active_tint(rgb_tmp, rgb_black, is_active);
- rgba_uchar_to_float(colors + 4, rgb_tmp);
+ rgba_uchar_to_float(colors[1], rgb_tmp);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
@@ -478,7 +478,8 @@ static void mask_draw_curve_type(const bContext *C,
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
immUniform1i("colors_len", 2); /* "advanced" mode */
- immUniformArray4fv("colors", colors, 2);
+ immUniform4fv("color", colors[0]);
+ immUniform4fv("color2", colors[1]);
immUniform1f("dash_width", 4.0f);
immUniform1f("dash_factor", 0.5f);
GPU_line_width(1.0f);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index c5820ef3a2e..d2005473512 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -172,8 +172,8 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
immUniform1i("colors_len", 2); /* "advanced" mode */
const float alpha = (float)paint->paint_cursor_col[3] / 255.0f;
- immUniformArray4fv(
- "colors", (float *)(float[][4]){{0.0f, 0.0f, 0.0f, alpha}, {1.0f, 1.0f, 1.0f, alpha}}, 2);
+ immUniform4f("color", 0.0f, 0.0f, 0.0f, alpha);
+ immUniform4f("color2", 1.0f, 1.0f, 1.0f, alpha);
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 342f2df0020..048c7345b97 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -455,8 +455,8 @@ void draw_image_sample_line(SpaceImage *sima)
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
immUniform1i("colors_len", 2); /* Advanced dashes. */
- immUniformArray4fv(
- "colors", (float *)(float[][4]){{1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2);
+ immUniform4f("color", 1.0f, 1.0f, 1.0f, 1.0f);
+ immUniform4f("color2", 0.0f, 0.0f, 0.0f, 1.0f);
immUniform1f("dash_width", 2.0f);
immUniform1f("dash_factor", 0.5f);
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index 3a8a28dc2a1..567022cc9d1 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -689,10 +689,8 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
immUniform1i("colors_len", 2); /* "advanced" mode */
const float *col = is_act ? color_act : color_base;
- immUniformArray4fv(
- "colors",
- (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}},
- 2);
+ immUniform4f("color", 0.67f, 0.67f, 0.67f, 1.0f);
+ immUniform4f("color2", col[0], col[1], col[2], col[3]);
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
@@ -760,10 +758,8 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
immUniform1i("colors_len", 2); /* "advanced" mode */
const float *col = is_act ? color_act : color_base;
- immUniformArray4fv(
- "colors",
- (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}},
- 2);
+ immUniform4f("color", 0.67f, 0.67f, 0.67f, 1.0f);
+ immUniform4f("color2", col[0], col[1], col[2], col[3]);
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index a083ded1752..141b59e0355 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -46,8 +46,8 @@ void ED_image_draw_cursor(ARegion *region, const float cursor[2])
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
immUniform1i("colors_len", 2); /* "advanced" mode */
- immUniformArray4fv(
- "colors", (float *)(float[][4]){{1.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
+ immUniform4f("color", 1.0f, 0.0f, 0.0f, 1.0f);
+ immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
immUniform1f("dash_width", 8.0f);
immUniform1f("dash_factor", 0.5f);
@@ -67,8 +67,8 @@ void ED_image_draw_cursor(ARegion *region, const float cursor[2])
immEnd();
- immUniformArray4fv(
- "colors", (float *)(float[][4]){{1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2);
+ immUniform4f("color", 1.0f, 1.0f, 1.0f, 1.0f);
+ immUniform4f("color2", 0.0f, 0.0f, 0.0f, 1.0f);
immUniform1f("dash_width", 2.0f);
immUniform1f("dash_factor", 0.5f);
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 3cb89f0f233..9c1ffe617cf 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -503,6 +503,7 @@ set(SRC_SHADER_CREATE_INFOS
shaders/infos/gpu_shader_gpencil_stroke_info.hh
shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh
shaders/infos/gpu_shader_keyframe_shape_info.hh
+ shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh
shaders/infos/gpu_shader_simple_lighting_info.hh
shaders/infos/gpu_shader_text_info.hh
shaders/infos/gpu_srgb_to_framebuffer_space_info.hh
diff --git a/source/blender/gpu/intern/gpu_shader_builtin.c b/source/blender/gpu/intern/gpu_shader_builtin.c
index b0e11d85fb9..0463262b779 100644
--- a/source/blender/gpu/intern/gpu_shader_builtin.c
+++ b/source/blender/gpu/intern/gpu_shader_builtin.c
@@ -238,18 +238,13 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
[GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR] = {.name = "GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR",
.create_info = "gpu_shader_3D_polyline_smooth_color"},
- [GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR] =
- {
- .name = "GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR",
- .vert = datatoc_gpu_shader_2D_line_dashed_uniform_color_vert_glsl,
- .frag = datatoc_gpu_shader_2D_line_dashed_frag_glsl,
- },
+ [GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR] = {.name = "GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR",
+ .create_info =
+ "gpu_shader_2D_line_dashed_uniform_color"},
[GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR] =
- {
- .name = "GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR",
- .vert = datatoc_gpu_shader_3D_line_dashed_uniform_color_vert_glsl,
- .frag = datatoc_gpu_shader_2D_line_dashed_frag_glsl,
- },
+ {.name = "GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR",
+ .create_info = "gpu_shader_3D_line_dashed_uniform_color",
+ .clipped_create_info = "gpu_shader_3D_line_dashed_uniform_color_clipped"},
[GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA] =
{
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
index af9a24d1280..1ddffaef16e 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
@@ -6,57 +6,24 @@
* Dashed is performed in screen space.
*/
-#ifndef USE_GPU_SHADER_CREATE_INFO
-
-uniform float dash_width;
-
-/* Simple mode, discarding non-dash parts (so no need for blending at all). */
-uniform float dash_factor; /* if > 1.0, solid line. */
-
-/* More advanced mode, allowing for complex, multi-colored patterns.
- * Enabled when colors_len > 0. */
-/* NOTE: max number of steps/colors in pattern is 32! */
-uniform int colors_len; /* Enabled if > 0, 1 for solid line. */
-uniform vec4 colors[32];
-
-flat in vec4 color_vert;
-
-noperspective in vec2 stipple_pos;
-flat in vec2 stipple_start;
-
-out vec4 fragColor;
-#endif
-
void main()
{
float distance_along_line = distance(stipple_pos, stipple_start);
- /* Multi-color option. */
- if (colors_len > 0) {
- /* Solid line case, simple. */
- if (colors_len == 1) {
- fragColor = colors[0];
- }
- /* Actually dashed line... */
- else {
- float normalized_distance = fract(distance_along_line / dash_width);
- fragColor = colors[int(normalized_distance * colors_len)];
- }
+ /* Solid line case, simple. */
+ if (dash_factor >= 1.0f) {
+ fragColor = color;
}
- /* Single color option. */
+ /* Actually dashed line... */
else {
- /* Solid line case, simple. */
- if (dash_factor >= 1.0f) {
- fragColor = color_vert;
+ float normalized_distance = fract(distance_along_line / dash_width);
+ if (normalized_distance <= dash_factor) {
+ fragColor = color;
+ }
+ else if (colors_len > 0) {
+ fragColor = color2;
}
- /* Actually dashed line... */
else {
- float normalized_distance = fract(distance_along_line / dash_width);
- if (normalized_distance <= dash_factor) {
- fragColor = color_vert;
- }
- else {
- discard;
- }
+ discard;
}
}
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl
index 9d52820188b..7878dc18362 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl
@@ -5,24 +5,9 @@
*
* Dashed is performed in screen space.
*/
-#ifndef USE_GPU_SHADER_CREATE_INFO
-uniform mat4 ModelViewProjectionMatrix;
-
-uniform vec4 color;
-uniform vec2 viewport_size;
-
-in vec2 pos;
-
-flat out vec4 color_vert;
-
-/* We leverage hardware interpolation to compute distance along the line. */
-noperspective out vec2 stipple_pos; /* In screen space */
-flat out vec2 stipple_start; /* In screen space */
-#endif
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
stipple_start = stipple_pos = viewport_size * 0.5 * (gl_Position.xy / gl_Position.w);
- color_vert = color;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
index 9328e0a13e9..68835cb1d0f 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
@@ -1,3 +1,4 @@
+#pragma BLENDER_REQUIRE(gpu_shader_cfg_world_clip_lib.glsl)
/*
* Vertex Shader for dashed lines with 3D coordinates,
@@ -6,32 +7,11 @@
* Dashed is performed in screen space.
*/
-#ifndef USE_GPU_SHADER_CREATE_INFO
-
-uniform mat4 ModelViewProjectionMatrix;
-
-# ifdef USE_WORLD_CLIP_PLANES
-uniform mat4 ModelMatrix;
-# endif
-
-uniform vec4 color;
-uniform vec2 viewport_size;
-
-in vec3 pos;
-
-flat out vec4 color_vert;
-
-/* We leverage hardware interpolation to compute distance along the line. */
-noperspective out vec2 stipple_pos; /* In screen space */
-flat out vec2 stipple_start; /* In screen space */
-#endif
-
void main()
{
vec4 pos_4d = vec4(pos, 1.0);
gl_Position = ModelViewProjectionMatrix * pos_4d;
stipple_start = stipple_pos = viewport_size * 0.5 * (gl_Position.xy / gl_Position.w);
- color_vert = color;
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
#endif
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh
deleted file mode 100644
index 81ba8a26213..00000000000
--- a/source/blender/gpu/shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright 2022 Blender Foundation. All rights reserved. */
-
-/** \file
- * \ingroup gpu
- */
-
-#include "gpu_interface_info.hh"
-#include "gpu_shader_create_info.hh"
-
-/* TODO(jbakker): Skipped as data doesn't fit as push constant. */
-GPU_SHADER_CREATE_INFO(gpu_shader_2D_line_dashed_uniform_color)
- .vertex_in(0, Type::VEC3, "pos")
- .vertex_out(flat_color_iface)
- .push_constant(Type::MAT4, "ModelViewProjectionMatrix")
- .vertex_source("gpu_shader_2D_line_dashed_uniform_color_vert.glsl")
- .fragment_source("gpu_shader_2D_line_dashed_frag.glsl")
- .do_static_compilation(true);
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh
new file mode 100644
index 00000000000..57cb02c8484
--- /dev/null
+++ b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "gpu_interface_info.hh"
+#include "gpu_shader_create_info.hh"
+
+/* We leverage hardware interpolation to compute distance along the line. */
+GPU_SHADER_INTERFACE_INFO(gpu_shader_line_dashed_interface, "")
+ .no_perspective(Type::VEC2, "stipple_start") /* In screen space */
+ .flat(Type::VEC2, "stipple_pos"); /* In screen space */
+
+GPU_SHADER_CREATE_INFO(gpu_shader_line_dashed)
+ .vertex_out(flat_color_iface)
+ .push_constant(Type::MAT4, "ModelViewProjectionMatrix")
+ .push_constant(Type::VEC2, "viewport_size")
+ .push_constant(Type::FLOAT, "dash_width")
+ .push_constant(Type::FLOAT, "dash_factor") /* if > 1.0, solid line. */
+ /* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */
+ .push_constant(Type::INT, "colors_len") /* Enabled if > 0, 1 for solid line. */
+ .push_constant(Type::VEC4, "color")
+ .push_constant(Type::VEC4, "color2")
+ .vertex_out(gpu_shader_line_dashed_interface)
+ .fragment_out(0, Type::VEC4, "fragColor")
+ .fragment_source("gpu_shader_2D_line_dashed_frag.glsl");
+
+GPU_SHADER_CREATE_INFO(gpu_shader_2D_line_dashed_uniform_color)
+ .vertex_in(0, Type::VEC2, "pos")
+ .vertex_source("gpu_shader_2D_line_dashed_uniform_color_vert.glsl")
+ .additional_info("gpu_shader_line_dashed")
+ .do_static_compilation(true);
+
+GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
+ .vertex_in(0, Type::VEC3, "pos")
+ .vertex_source("gpu_shader_3D_line_dashed_uniform_color_vert.glsl")
+ .additional_info("gpu_shader_line_dashed")
+ .do_static_compilation(true);
+
+GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color_clipped)
+ .push_constant(Type::MAT4, "ModelMatrix")
+ .additional_info("gpu_shader_3D_line_dashed_uniform_color")
+ .additional_info("gpu_clip_planes")
+ .do_static_compilation(true);
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index ec01e097e98..9b34468ae82 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -182,8 +182,8 @@ static void wm_gesture_draw_line(wmGesture *gt)
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
immUniform1i("colors_len", 2); /* "advanced" mode */
- immUniformArray4fv(
- "colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
+ immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
+ immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
immUniform1f("dash_width", 8.0f);
immUniform1f("dash_factor", 0.5f);
@@ -225,8 +225,8 @@ static void wm_gesture_draw_rect(wmGesture *gt)
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
immUniform1i("colors_len", 2); /* "advanced" mode */
- immUniformArray4fv(
- "colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
+ immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
+ immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
immUniform1f("dash_width", 8.0f);
immUniform1f("dash_factor", 0.5f);
@@ -264,8 +264,8 @@ static void wm_gesture_draw_circle(wmGesture *gt)
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
immUniform1i("colors_len", 2); /* "advanced" mode */
- immUniformArray4fv(
- "colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
+ immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
+ immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
immUniform1f("dash_width", 4.0f);
immUniform1f("dash_factor", 0.5f);
@@ -368,8 +368,8 @@ static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
immUniform1i("colors_len", 2); /* "advanced" mode */
- immUniformArray4fv(
- "colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
+ immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
+ immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
immUniform1f("dash_width", 2.0f);
immUniform1f("dash_factor", 0.5f);
@@ -402,8 +402,8 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
immUniform1i("colors_len", 2); /* "advanced" mode */
- immUniformArray4fv(
- "colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
+ immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
+ immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
immUniform1f("dash_width", 8.0f);
immUniform1f("dash_factor", 0.5f);