2023-08-24 10:54:59 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2018-2023 Blender Authors
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
|
2018-03-31 19:32:28 +02:00
|
|
|
/**
|
|
|
|
|
* Simple shader that just draw multiple icons at the specified locations
|
|
|
|
|
* does not need any vertex input (producing less call to immBegin/End)
|
2019-03-19 15:17:46 +11:00
|
|
|
*/
|
2018-03-31 19:32:28 +02:00
|
|
|
|
2025-09-25 10:57:02 +02:00
|
|
|
#include "infos/gpu_shader_icon_infos.hh"
|
2024-11-12 18:53:34 +01:00
|
|
|
|
|
|
|
|
VERTEX_SHADER_CREATE_INFO(gpu_shader_icon_multi)
|
|
|
|
|
|
2018-03-31 19:32:28 +02:00
|
|
|
void main()
|
|
|
|
|
{
|
2025-04-14 13:46:41 +02:00
|
|
|
float4 rect = multi_icon_data.calls_data[gl_InstanceID * 3];
|
|
|
|
|
float4 tex = multi_icon_data.calls_data[gl_InstanceID * 3 + 1];
|
2025-06-03 17:34:04 +02:00
|
|
|
final_color = multi_icon_data.calls_data[gl_InstanceID * 3 + 2];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-09 19:28:36 +02:00
|
|
|
/* Use pos to select the right swizzle (instead of gl_VertexID)
|
|
|
|
|
* in order to workaround an OSX driver bug. */
|
2025-04-14 13:46:41 +02:00
|
|
|
if (all(equal(pos, float2(0.0f, 0.0f)))) {
|
2020-09-09 19:28:36 +02:00
|
|
|
rect.xy = rect.xz;
|
2020-08-31 18:39:17 +02:00
|
|
|
tex.xy = tex.xz;
|
2019-06-04 00:36:16 +10:00
|
|
|
}
|
2025-04-14 13:46:41 +02:00
|
|
|
else if (all(equal(pos, float2(0.0f, 1.0f)))) {
|
2020-09-09 19:28:36 +02:00
|
|
|
rect.xy = rect.xw;
|
2018-03-31 19:32:28 +02:00
|
|
|
tex.xy = tex.xw;
|
|
|
|
|
}
|
2025-04-14 13:46:41 +02:00
|
|
|
else if (all(equal(pos, float2(1.0f, 1.0f)))) {
|
2020-09-09 19:28:36 +02:00
|
|
|
rect.xy = rect.yw;
|
2018-03-31 19:32:28 +02:00
|
|
|
tex.xy = tex.yw;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2020-09-09 19:28:36 +02:00
|
|
|
rect.xy = rect.yz;
|
2018-03-31 19:32:28 +02:00
|
|
|
tex.xy = tex.yz;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-04-14 13:46:41 +02:00
|
|
|
gl_Position = float4(rect.xy, 0.0f, 1.0f);
|
2018-03-31 19:32:28 +02:00
|
|
|
texCoord_interp = tex.xy;
|
|
|
|
|
}
|