GPU: Fix static compilation errors

- Missing explicit cast to `int` for bitwise operator.
- UBO struct member macro colision. Rename fixes it.
This commit is contained in:
2022-12-09 00:10:14 +01:00
parent c50e25c5f0
commit f898190362
4 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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__);

View File

@@ -54,7 +54,7 @@ struct GPUClipPlanes {
BLI_STATIC_ASSERT_ALIGN(struct GPUClipPlanes, 16)
struct SimpleLightingData {
float4 color;
float4 l_color;
float3 light;
float _pad;
};

View File

@@ -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);
}