GPU: Use Same Type in Comparisons. #106789
|
@ -396,7 +396,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle)
|
|||
.geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 10)
|
||||
.geometry_out(overlay_edit_smooth_color_iface)
|
||||
.push_constant(Type::BOOL, "showCurveHandles")
|
||||
.push_constant(Type::INT, "curveHandleDisplay")
|
||||
.push_constant(Type::UINT, "curveHandleDisplay")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("overlay_edit_curve_handle_vert.glsl")
|
||||
.geometry_source("overlay_edit_curve_handle_geom.glsl")
|
||||
|
@ -414,7 +414,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_no_geom)
|
|||
.vertex_in(1, Type::UCHAR, "data")
|
||||
.vertex_out(overlay_edit_smooth_color_iface)
|
||||
.push_constant(Type::BOOL, "showCurveHandles")
|
||||
.push_constant(Type::INT, "curveHandleDisplay")
|
||||
.push_constant(Type::UINT, "curveHandleDisplay")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("overlay_edit_curve_handle_vert_no_geom.glsl")
|
||||
.fragment_source("overlay_varying_color.glsl")
|
||||
|
@ -439,7 +439,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_point)
|
|||
.vertex_in(1, Type::UINT, "data")
|
||||
.vertex_out(overlay_edit_flat_color_iface)
|
||||
.push_constant(Type::BOOL, "showCurveHandles")
|
||||
.push_constant(Type::INT, "curveHandleDisplay")
|
||||
.push_constant(Type::UINT, "curveHandleDisplay")
|
||||
Jeroen-Bakker marked this conversation as resolved
Outdated
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("overlay_edit_curve_point_vert.glsl")
|
||||
.fragment_source("overlay_point_varying_color_frag.glsl")
|
||||
|
|
|
@ -26,7 +26,7 @@ void main()
|
|||
uint color_id = (vert[1].flag >> COLOR_SHIFT);
|
||||
|
||||
/* Don't output any edges if we don't show handles */
|
||||
if (!showCurveHandles && (color_id < 5)) {
|
||||
if (!showCurveHandles && (color_id < 5u)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ void main()
|
|||
if ((curveHandleDisplay != CURVE_HANDLE_ALL) && (!handle_selected)) {
|
||||
Jeroen-Bakker marked this conversation as resolved
Outdated
Clément Foucault
commented
I believe it is I believe it is `(uint(curveHandleDisplay) != CURVE_HANDLE_ALL)` you want here.
|
||||
/* Nurbs must show the handles always. */
|
||||
bool is_u_segment = (((vert[1].flag ^ vert[0].flag) & EVEN_U_BIT) != 0u);
|
||||
if ((!is_u_segment) && (color_id <= 4)) {
|
||||
if ((!is_u_segment) && (color_id <= 4u)) {
|
||||
return;
|
||||
}
|
||||
if (is_gpencil) {
|
||||
|
@ -49,24 +49,24 @@ void main()
|
|||
}
|
||||
|
||||
vec4 inner_color;
|
||||
if (color_id == 0) {
|
||||
if (color_id == 0u) {
|
||||
inner_color = (edge_selected) ? colorHandleSelFree : colorHandleFree;
|
||||
}
|
||||
else if (color_id == 1) {
|
||||
else if (color_id == 1u) {
|
||||
inner_color = (edge_selected) ? colorHandleSelAuto : colorHandleAuto;
|
||||
}
|
||||
else if (color_id == 2) {
|
||||
else if (color_id == 2u) {
|
||||
inner_color = (edge_selected) ? colorHandleSelVect : colorHandleVect;
|
||||
}
|
||||
else if (color_id == 3) {
|
||||
else if (color_id == 3u) {
|
||||
inner_color = (edge_selected) ? colorHandleSelAlign : colorHandleAlign;
|
||||
}
|
||||
else if (color_id == 4) {
|
||||
else if (color_id == 4u) {
|
||||
inner_color = (edge_selected) ? colorHandleSelAutoclamp : colorHandleAutoclamp;
|
||||
}
|
||||
else {
|
||||
bool is_selected = (((vert[1].flag & vert[0].flag) & VERT_SELECTED) != 0);
|
||||
bool is_u_segment = (((vert[1].flag ^ vert[0].flag) & EVEN_U_BIT) != 0);
|
||||
bool is_selected = (((vert[1].flag & vert[0].flag) & VERT_SELECTED) != 0u);
|
||||
bool is_u_segment = (((vert[1].flag ^ vert[0].flag) & EVEN_U_BIT) != 0u);
|
||||
if (is_u_segment) {
|
||||
inner_color = (is_selected) ? colorNurbSelUline : colorNurbUline;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ void main()
|
|||
}
|
||||
}
|
||||
|
||||
vec4 outer_color = (is_active_nurb != 0) ?
|
||||
vec4 outer_color = (is_active_nurb != 0u) ?
|
||||
mix(colorActiveSpline,
|
||||
inner_color,
|
||||
0.25) /* Minimize active color bleeding on inner_color. */
|
||||
|
|
|
@ -47,7 +47,7 @@ void main()
|
|||
uint color_id = (vert_flag[1] >> COLOR_SHIFT);
|
||||
|
||||
/* Don't output any edges if we don't show handles */
|
||||
if (!showCurveHandles && (color_id < 5)) {
|
||||
if (!showCurveHandles && (color_id < 5u)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ void main()
|
|||
if ((curveHandleDisplay != CURVE_HANDLE_ALL) && (!handle_selected)) {
|
||||
Jeroen-Bakker marked this conversation as resolved
Outdated
Clément Foucault
commented
Same here. Same here.
|
||||
/* Nurbs must show the handles always. */
|
||||
bool is_u_segment = (((vert_flag[1] ^ vert_flag[0]) & EVEN_U_BIT) != 0u);
|
||||
if ((!is_u_segment) && (color_id <= 4)) {
|
||||
if ((!is_u_segment) && (color_id <= 4u)) {
|
||||
return;
|
||||
}
|
||||
if (is_gpencil) {
|
||||
|
@ -70,24 +70,24 @@ void main()
|
|||
}
|
||||
|
||||
vec4 inner_color;
|
||||
if (color_id == 0) {
|
||||
if (color_id == 0u) {
|
||||
inner_color = (edge_selected) ? colorHandleSelFree : colorHandleFree;
|
||||
}
|
||||
else if (color_id == 1) {
|
||||
else if (color_id == 1u) {
|
||||
inner_color = (edge_selected) ? colorHandleSelAuto : colorHandleAuto;
|
||||
}
|
||||
else if (color_id == 2) {
|
||||
else if (color_id == 2u) {
|
||||
inner_color = (edge_selected) ? colorHandleSelVect : colorHandleVect;
|
||||
}
|
||||
else if (color_id == 3) {
|
||||
else if (color_id == 3u) {
|
||||
inner_color = (edge_selected) ? colorHandleSelAlign : colorHandleAlign;
|
||||
}
|
||||
else if (color_id == 4) {
|
||||
else if (color_id == 4u) {
|
||||
inner_color = (edge_selected) ? colorHandleSelAutoclamp : colorHandleAutoclamp;
|
||||
}
|
||||
else {
|
||||
bool is_selected = (((vert_flag[1] & vert_flag[0]) & VERT_SELECTED) != 0);
|
||||
bool is_u_segment = (((vert_flag[1] ^ vert_flag[0]) & EVEN_U_BIT) != 0);
|
||||
bool is_selected = (((vert_flag[1] & vert_flag[0]) & VERT_SELECTED) != 0u);
|
||||
bool is_u_segment = (((vert_flag[1] ^ vert_flag[0]) & EVEN_U_BIT) != 0u);
|
||||
if (is_u_segment) {
|
||||
inner_color = (is_selected) ? colorNurbSelUline : colorNurbUline;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ void main()
|
|||
}
|
||||
}
|
||||
|
||||
vec4 outer_color = (is_active_nurb != 0) ?
|
||||
vec4 outer_color = (is_active_nurb != 0u) ?
|
||||
mix(colorActiveSpline,
|
||||
inner_color,
|
||||
0.25) /* Minimize active color bleeding on inner_color. */
|
||||
|
|
|
@ -8,8 +8,8 @@ void main()
|
|||
|
||||
/* Reuse the FREESTYLE flag to determine is GPencil. */
|
||||
bool is_gpencil = ((data & EDGE_FREESTYLE) != 0);
|
||||
Jeroen-Bakker marked this conversation as resolved
Outdated
Johannes J.
commented
`0` -> `0u`
|
||||
if ((data & VERT_SELECTED) != 0) {
|
||||
if ((data & VERT_ACTIVE) != 0) {
|
||||
if ((data & VERT_SELECTED) != 0u) {
|
||||
if ((data & VERT_ACTIVE) != 0u) {
|
||||
finalColor = colorEditMeshActive;
|
||||
}
|
||||
else {
|
||||
|
@ -26,7 +26,7 @@ void main()
|
|||
view_clipping_distances(world_pos);
|
||||
|
||||
bool show_handle = showCurveHandles;
|
||||
if ((curveHandleDisplay == CURVE_HANDLE_SELECTED) && ((data & VERT_SELECTED_BEZT_HANDLE) == 0)) {
|
||||
if ((curveHandleDisplay == CURVE_HANDLE_SELECTED) && ((data & VERT_SELECTED_BEZT_HANDLE) == 0u)) {
|
||||
Jeroen-Bakker marked this conversation as resolved
Outdated
Clément Foucault
commented
Same here Same here
|
||||
show_handle = false;
|
||||
}
|
||||
|
||||
Jeroen-Bakker marked this conversation as resolved
Johannes J.
commented
`0` -> `0u` on line 33
|
||||
|
|
|
@ -6,10 +6,10 @@ void main()
|
|||
{
|
||||
GPU_INTEL_VERTEX_SHADER_WORKAROUND
|
||||
|
||||
if ((data & VERT_SELECTED) != 0) {
|
||||
if ((data & VERT_SELECTED) != 0u) {
|
||||
finalColor = colorVertexSelect;
|
||||
}
|
||||
else if ((data & VERT_ACTIVE) != 0) {
|
||||
else if ((data & VERT_ACTIVE) != 0u) {
|
||||
finalColor = colorEditMeshActive;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue
This will create errors on some drivers. AMDPRO, for instance, emit an error because we set its value using signed int functions. So I prefer to fix the usage in the shader by casting them to
uint
when needed.