From f898190362f7a33dbc6bb71b3dfca385d3979a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Fri, 9 Dec 2022 00:10:14 +0100 Subject: [PATCH] GPU: Fix static compilation errors - Missing explicit cast to `int` for bitwise operator. - UBO struct member macro colision. Rename fixes it. --- .../engines/overlay/shaders/overlay_edit_uv_edges_vert.glsl | 4 ++-- source/blender/editors/interface/interface_draw.cc | 2 +- source/blender/gpu/GPU_shader_shared.h | 2 +- .../blender/gpu/shaders/gpu_shader_simple_lighting_frag.glsl | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_edges_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_edges_vert.glsl index 877527f2d89..fdec1421b66 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_edges_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_edges_vert.glsl @@ -11,9 +11,9 @@ void main() half_pixel_offset; #ifdef USE_EDGE_SELECT - bool is_select = (flag & EDGE_UV_SELECT) != 0u; + bool is_select = (flag & int(EDGE_UV_SELECT)) != 0u; #else - bool is_select = (flag & VERT_UV_SELECT) != 0u; + bool is_select = (flag & int(VERT_UV_SELECT)) != 0u; #endif geom_in.selectionFac = is_select ? 1.0 : 0.0; /* Move selected edges to the top diff --git a/source/blender/editors/interface/interface_draw.cc b/source/blender/editors/interface/interface_draw.cc index 5c09bbe291b..973f92a5d0b 100644 --- a/source/blender/editors/interface/interface_draw.cc +++ b/source/blender/editors/interface/interface_draw.cc @@ -1346,7 +1346,7 @@ void ui_draw_but_UNITVEC(uiBut *but, GPUBatch *sphere = GPU_batch_preset_sphere(2); SimpleLightingData simple_lighting_data; - copy_v4_fl4(simple_lighting_data.color, diffuse[0], diffuse[1], diffuse[2], 1.0f); + copy_v4_fl4(simple_lighting_data.l_color, diffuse[0], diffuse[1], diffuse[2], 1.0f); copy_v3_v3(simple_lighting_data.light, light); GPUUniformBuf *ubo = GPU_uniformbuf_create_ex( sizeof(SimpleLightingData), &simple_lighting_data, __func__); diff --git a/source/blender/gpu/GPU_shader_shared.h b/source/blender/gpu/GPU_shader_shared.h index 8c00e90d681..2291de74782 100644 --- a/source/blender/gpu/GPU_shader_shared.h +++ b/source/blender/gpu/GPU_shader_shared.h @@ -54,7 +54,7 @@ struct GPUClipPlanes { BLI_STATIC_ASSERT_ALIGN(struct GPUClipPlanes, 16) struct SimpleLightingData { - float4 color; + float4 l_color; float3 light; float _pad; }; diff --git a/source/blender/gpu/shaders/gpu_shader_simple_lighting_frag.glsl b/source/blender/gpu/shaders/gpu_shader_simple_lighting_frag.glsl index 2f5ce4bdf50..07b0e8373f5 100644 --- a/source/blender/gpu/shaders/gpu_shader_simple_lighting_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_simple_lighting_frag.glsl @@ -1,6 +1,6 @@ void main() { - fragColor = simple_lighting_data.color; + fragColor = simple_lighting_data.l_color; fragColor.xyz *= clamp(dot(normalize(normal), simple_lighting_data.light), 0.0, 1.0); }