Fix: Overlay: Shader compilation warnings
This is because we now use enums instead of defines. Pull Request: https://projects.blender.org/blender/blender/pulls/140044
This commit is contained in:
committed by
Clément Foucault
parent
1e39da6e98
commit
24ee70553a
@@ -8,6 +8,7 @@ VERTEX_SHADER_CREATE_INFO(overlay_extra_spot_cone)
|
||||
|
||||
#include "draw_view_clipping_lib.glsl"
|
||||
#include "draw_view_lib.glsl"
|
||||
#include "gpu_shader_utildefines_lib.glsl"
|
||||
#include "overlay_common_lib.glsl"
|
||||
#include "select_lib.glsl"
|
||||
|
||||
@@ -54,19 +55,19 @@ void main()
|
||||
float3 vpos = pos;
|
||||
float3 vofs = float3(0.0f);
|
||||
/* Lights */
|
||||
if ((vclass & VCLASS_LIGHT_AREA_SHAPE) != 0) {
|
||||
if (flag_test(vclass, VCLASS_LIGHT_AREA_SHAPE)) {
|
||||
/* HACK: use alpha color for spots to pass the area_size. */
|
||||
if (inst_color_data < 0.0f) {
|
||||
lamp_area_size = float2(-inst_color_data);
|
||||
}
|
||||
vpos.xy *= lamp_area_size;
|
||||
}
|
||||
else if ((vclass & VCLASS_LIGHT_SPOT_SHAPE) != 0) {
|
||||
else if (flag_test(vclass, VCLASS_LIGHT_SPOT_SHAPE)) {
|
||||
lamp_spot_sine = sqrt(1.0f - lamp_spot_cosine * lamp_spot_cosine);
|
||||
lamp_spot_sine *= ((vclass & VCLASS_LIGHT_SPOT_BLEND) != 0) ? lamp_spot_blend : 1.0f;
|
||||
lamp_spot_sine *= (flag_test(vclass, VCLASS_LIGHT_SPOT_BLEND)) ? lamp_spot_blend : 1.0f;
|
||||
vpos = float3(pos.xy * lamp_spot_sine, -lamp_spot_cosine);
|
||||
}
|
||||
else if ((vclass & VCLASS_LIGHT_DIST) != 0) {
|
||||
else if (flag_test(vclass, VCLASS_LIGHT_DIST)) {
|
||||
/* Meh nasty mess. Select one of the 6 axes to display on. (see light_distance_z_get()) */
|
||||
int dist_axis = int(pos.z);
|
||||
float dist = pos.z - floor(pos.z) - 0.5f;
|
||||
@@ -79,8 +80,8 @@ void main()
|
||||
}
|
||||
}
|
||||
/* Camera */
|
||||
else if ((vclass & VCLASS_CAMERA_FRAME) != 0) {
|
||||
if ((vclass & VCLASS_CAMERA_VOLUME) != 0) {
|
||||
else if (flag_test(vclass, VCLASS_CAMERA_FRAME)) {
|
||||
if (flag_test(vclass, VCLASS_CAMERA_VOLUME)) {
|
||||
vpos.z = mix(color.b, color.a, pos.z);
|
||||
}
|
||||
else if (camera_dist > 0.0f) {
|
||||
@@ -91,7 +92,7 @@ void main()
|
||||
}
|
||||
vpos.xy = (camera_center + camera_corner * vpos.xy) * abs(vpos.z);
|
||||
}
|
||||
else if ((vclass & VCLASS_CAMERA_DIST) != 0) {
|
||||
else if (flag_test(vclass, VCLASS_CAMERA_DIST)) {
|
||||
vofs.xy = float2(0.0f);
|
||||
vofs.z = -mix(camera_dist_sta, camera_dist_end, pos.z);
|
||||
vpos.z = 0.0f;
|
||||
@@ -126,15 +127,15 @@ void main()
|
||||
}
|
||||
}
|
||||
/* Empties */
|
||||
else if ((vclass & VCLASS_EMPTY_SCALED) != 0) {
|
||||
else if (flag_test(vclass, VCLASS_EMPTY_SCALED)) {
|
||||
/* This is a bit silly but we avoid scaling the object matrix on CPU (saving a float4x4 mul) */
|
||||
vpos *= empty_scale;
|
||||
}
|
||||
else if ((vclass & VCLASS_EMPTY_SIZE) != 0) {
|
||||
else if (flag_test(vclass, VCLASS_EMPTY_SIZE)) {
|
||||
/* This is a bit silly but we avoid scaling the object matrix on CPU (saving a float4x4 mul) */
|
||||
vpos *= empty_size;
|
||||
}
|
||||
else if ((vclass & VCLASS_EMPTY_AXES) != 0) {
|
||||
else if (flag_test(vclass, VCLASS_EMPTY_AXES)) {
|
||||
float axis = vpos.z;
|
||||
vofs[int(axis)] = (1.0f + fract(axis)) * empty_scale;
|
||||
/* Scale uniformly by axis length */
|
||||
@@ -147,7 +148,7 @@ void main()
|
||||
}
|
||||
|
||||
/* Not exclusive with previous flags. */
|
||||
if ((vclass & VCLASS_CAMERA_VOLUME) != 0) {
|
||||
if (flag_test(vclass, VCLASS_CAMERA_VOLUME)) {
|
||||
/* Unpack final color. */
|
||||
int color_class = int(floor(color.r));
|
||||
float color_intensity = fract(color.r);
|
||||
@@ -166,14 +167,14 @@ void main()
|
||||
}
|
||||
|
||||
float3 world_pos;
|
||||
if ((vclass & VCLASS_SCREENSPACE) != 0) {
|
||||
if (flag_test(vclass, VCLASS_SCREENSPACE)) {
|
||||
/* Relative to DPI scaling. Have constant screen size. */
|
||||
float3 screen_pos = drw_view().viewinv[0].xyz * vpos.x + drw_view().viewinv[1].xyz * vpos.y;
|
||||
float3 p = (obmat * float4(vofs, 1.0f)).xyz;
|
||||
float screen_size = mul_project_m4_v3_zfac(uniform_buf.pixel_fac, p) * theme.sizes.pixel;
|
||||
world_pos = p + screen_pos * screen_size;
|
||||
}
|
||||
else if ((vclass & VCLASS_SCREENALIGNED) != 0) {
|
||||
else if (flag_test(vclass, VCLASS_SCREENALIGNED)) {
|
||||
/* World sized, camera facing geometry. */
|
||||
float3 screen_pos = drw_view().viewinv[0].xyz * vpos.x + drw_view().viewinv[1].xyz * vpos.y;
|
||||
world_pos = (obmat * float4(vofs, 1.0f)).xyz + screen_pos;
|
||||
@@ -182,7 +183,7 @@ void main()
|
||||
world_pos = (obmat * float4(vofs + vpos, 1.0f)).xyz;
|
||||
}
|
||||
|
||||
if ((vclass & VCLASS_LIGHT_SPOT_CONE) != 0) {
|
||||
if (flag_test(vclass, VCLASS_LIGHT_SPOT_CONE)) {
|
||||
/* Compute point on the cone before and after this one. */
|
||||
float2 perp = float2(pos.y, -pos.x);
|
||||
constexpr float incr_angle = 2.0f * 3.1415f / 32.0f;
|
||||
|
||||
Reference in New Issue
Block a user