Commit: dedca2c9948af7a65dd78263e37f77052fc03de7 Author: Jason Fielder Date: Tue Dec 20 14:18:13 2022 +0100 Branches: master https://developer.blender.org/rBdedca2c9948af7a65dd78263e37f77052fc03de7
Fix T103313: Resolve shader compilation failures when enabling GPU workarounds. A number of paths resulted in compilation errors after porting EEVEE to use Create-Info. Namely the fallback path for cubemap support. A number of other strict compilation failures regarding format comparison also required fixing when this mode is enabled. Authored by Apple: Michael Parkin-White Ref T96261 Reviewed By: fclem Maniphest Tasks: T96261, T103313 Differential Revision: https://developer.blender.org/D16819 =================================================================== M source/blender/draw/engines/eevee/shaders/cubemap_lib.glsl M source/blender/draw/engines/eevee/shaders/shadow_vert.glsl M source/blender/draw/engines/eevee/shaders/surface_vert.glsl M source/blender/draw/engines/eevee_next/shaders/eevee_attributes_lib.glsl M source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_common_lib.glsl M source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_vert.glsl M source/blender/draw/engines/overlay/shaders/overlay_edit_uv_edges_vert.glsl M source/blender/draw/engines/overlay/shaders/overlay_edit_uv_faces_vert.glsl M source/blender/draw/engines/overlay/shaders/overlay_edit_uv_verts_vert.glsl M source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl M source/blender/gpu/shaders/gpu_shader_keyframe_shape_frag.glsl M source/blender/gpu/shaders/metal/mtl_shader_defines.msl M source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl =================================================================== diff --git a/source/blender/draw/engines/eevee/shaders/cubemap_lib.glsl b/source/blender/draw/engines/eevee/shaders/cubemap_lib.glsl index cde52af39e0..30e11d57c9b 100644 --- a/source/blender/draw/engines/eevee/shaders/cubemap_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/cubemap_lib.glsl @@ -1,12 +1,7 @@ -#ifdef GPU_ARB_texture_cube_map_array - -# define textureLod_cubemapArray(tex, co, lod) textureLod(tex, co, lod) - -#else - -/* Fallback implementation for hardware not supporting cubemap arrays. */ -# define samplerCubeArray sampler2DArray +/* Fallback implementation for hardware not supporting cubemap arrays. + * `samplerCubeArray` fallback declaration as sampler2DArray in `glsl_shader_defines.glsl`*/ +#ifndef GPU_ARB_texture_cube_map_array float cubemap_face_index(vec3 P) { diff --git a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl index 92be7294a11..8a99f2cc5e2 100644 --- a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl @@ -70,7 +70,7 @@ int g_curves_attr_id = 0; int curves_attribute_element_id() { int id = hairStrandID; - if (drw_curves.is_point_attribute[g_curves_attr_id][0] != 0) { + if (drw_curves.is_point_attribute[g_curves_attr_id][0] != 0u) { id = hair_get_base_id(); } diff --git a/source/blender/draw/engines/eevee/shaders/surface_vert.glsl b/source/blender/draw/engines/eevee/shaders/surface_vert.glsl index 212208728a0..a0eddc583b7 100644 --- a/source/blender/draw/engines/eevee/shaders/surface_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/surface_vert.glsl @@ -77,7 +77,7 @@ int g_curves_attr_id = 0; int curves_attribute_element_id() { int id = hairStrandID; - if (drw_curves.is_point_attribute[g_curves_attr_id][0] != 0) { + if (drw_curves.is_point_attribute[g_curves_attr_id][0] != 0u) { id = hair_get_base_id(); } diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_attributes_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_attributes_lib.glsl index ea1b02e56b3..f3bb1e2f490 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_attributes_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_attributes_lib.glsl @@ -133,7 +133,7 @@ int g_curves_attr_id = 0; int curves_attribute_element_id() { int id = interp.curves_strand_id; - if (drw_curves.is_point_attribute[g_curves_attr_id][0] != 0) { + if (drw_curves.is_point_attribute[g_curves_attr_id][0] != 0u) { # ifdef COMMON_HAIR_LIB id = hair_get_base_id(); # endif diff --git a/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_common_lib.glsl b/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_common_lib.glsl index 88a976931cc..358a18c88d0 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_common_lib.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_common_lib.glsl @@ -17,7 +17,7 @@ vec4 EDIT_MESH_edge_color_inner(uint edge_flag) color = ((edge_flag & EDGE_SELECTED) != 0u) ? color_select : color; color = ((edge_flag & EDGE_ACTIVE) != 0u) ? colorEditMeshActive : color; - color.a = (selectEdges || (edge_flag & (EDGE_SELECTED | EDGE_ACTIVE)) != 0) ? 1.0 : 0.7; + color.a = (selectEdges || (edge_flag & (EDGE_SELECTED | EDGE_ACTIVE)) != 0u) ? 1.0 : 0.7; return color; } @@ -35,7 +35,7 @@ vec4 EDIT_MESH_edge_vertex_color(uint vertex_flag) vec4 EDIT_MESH_vertex_color(uint vertex_flag, float vertex_crease) { - if ((vertex_flag & VERT_ACTIVE) != 0) { + if ((vertex_flag & VERT_ACTIVE) != 0u) { return vec4(colorEditMeshActive.xyz, 1.0); } else if ((vertex_flag & VERT_SELECTED) != 0u) { @@ -57,7 +57,7 @@ vec4 EDIT_MESH_face_color(uint face_flag) color = ((face_flag & FACE_FREESTYLE) != 0u) ? colorFaceFreestyle : color; color = ((face_flag & FACE_SELECTED) != 0u) ? colorFaceSelect : color; color = ((face_flag & FACE_ACTIVE) != 0u) ? color_active : color; - color.a *= ((face_flag & (FACE_FREESTYLE | FACE_SELECTED | FACE_ACTIVE)) == 0 || selectFaces) ? + color.a *= ((face_flag & (FACE_FREESTYLE | FACE_SELECTED | FACE_ACTIVE)) == 0u || selectFaces) ? 1.0 : 0.5; return color; diff --git a/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_vert.glsl index be90399d6b7..2aa9b4e3ac0 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_vert.glsl @@ -38,10 +38,10 @@ void main() finalColor = EDIT_MESH_vertex_color(m_data.y, vertexCrease); gl_PointSize = sizeVertex * ((vertexCrease > 0.0) ? 3.0 : 2.0); /* Make selected and active vertex always on top. */ - if ((data.x & VERT_SELECTED) != 0) { + if ((data.x & VERT_SELECTED) != 0u) { gl_Position.z -= 5e-7 * abs(gl_Position.w); } - if ((data.x & VERT_ACTIVE) != 0) { + if ((data.x & VERT_ACTIVE) != 0u) { gl_Position.z -= 5e-7 * abs(gl_Position.w); } 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 fdec1421b66..8f9f416f822 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 & int(EDGE_UV_SELECT)) != 0u; + bool is_select = (flag & int(EDGE_UV_SELECT)) != 0; #else - bool is_select = (flag & int(VERT_UV_SELECT)) != 0u; + bool is_select = (flag & int(VERT_UV_SELECT)) != 0; #endif geom_in.selectionFac = is_select ? 1.0 : 0.0; /* Move selected edges to the top diff --git a/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_faces_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_faces_vert.glsl index 80ea6228675..ca5f83501a4 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_faces_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_faces_vert.glsl @@ -5,8 +5,8 @@ void main() vec3 world_pos = point_object_to_world(vec3(au, 0.0)); gl_Position = point_world_to_ndc(world_pos); - bool is_selected = (flag & FACE_UV_SELECT) != 0; - bool is_active = (flag & FACE_UV_ACTIVE) != 0; + bool is_selected = (flag & FACE_UV_SELECT) != 0u; + bool is_active = (flag & FACE_UV_ACTIVE) != 0u; finalColor = (is_selected) ? colorFaceSelect : colorFace; finalColor = (is_active) ? colorEditMeshActive : finalColor; diff --git a/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_verts_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_verts_vert.glsl index 9f9b02ce19d..2a59a623995 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_verts_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_edit_uv_verts_vert.glsl @@ -5,8 +5,8 @@ const vec4 pinned_col = vec4(1.0, 0.0, 0.0, 1.0); void main() { - bool is_selected = (flag & (VERT_UV_SELECT | FACE_UV_SELECT)) != 0; - bool is_pinned = (flag & VERT_UV_PINNED) != 0; + bool is_selected = (flag & (VERT_UV_SELECT | FACE_UV_SELECT)) != 0u; + bool is_pinned = (flag & VERT_UV_PINNED) != 0u; vec4 deselect_col = (is_pinned) ? pinned_col : vec4(color.rgb, 1.0); fillColor = (is_selected) ? colorVertexSelect : deselect_col; outlineColor = (is_pinned) ? pinned_col : vec4(fillColor.rgb, 0.0); diff --git a/source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl index 7305d00c052..e07f0bf3ee9 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl @@ -24,7 +24,7 @@ void main() } if (showKeyFrames) { - if ((flag & MOTIONPATH_VERT_KEY) != 0) { + if ((flag & MOTIONPATH_VERT_KEY) != 0u) { gl_PointSize = float(pointSize + 5); finalColor = colorVertexSelect; /* Bias more to get these on top of regular points */ diff --git a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl index 794af5b69a5..75caf81f9fe 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl @@ -16,11 +16,11 @@ void main(void) const float end_gradient_threshold = 0.65; #ifdef USE_INSTANCE -# define colStart (colid_doarrow[0] < 3 ? start_color : node_link_data.colors[colid_doarrow[0]]) -# define colEnd (colid_doarrow[1] < 3 ? end_color : node_link_data.colors[colid_doarrow[1]]) +# define colStart (colid_doarrow[0] < 3u ? start_color : node_link_data.colors[colid_doarrow[0]]) +# define colEnd (colid_doarrow[1] < 3u ? end_color : node_link_data.colors[colid_doarrow[1]]) # define colShadow node_link_data.colors[colid_doarrow[2]] -# define doArrow (colid_doarrow[3] != 0) -# define doMuted (domuted[0] != 0) +# define doArrow (colid_doarrow[3] != 0u) +# define doMuted (domuted[0] != 0u) #else vec2 P0 = node_link_data.bezierPts[0].xy; vec2 P1 = node_link_data.bezierPts[1].xy; diff --git a/source/blender/gpu/shaders/gpu_shader_keyframe_shape_frag.glsl b/source/blender/gpu/shaders/gpu_shader_keyframe_shape_frag.glsl index 0b1683e93cd..3690dd8d1d2 100644 --- a/source/blender/gpu/shaders/gpu_shader_keyframe_shape_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_keyframe_shape_frag.glsl @@ -1,13 +1,13 @@ /* Values in GPU_shader.h. */ -#define GPU_KEYFRAME_SHAPE_DIAMOND (1 << 0) -#define GPU_KEYFRAME_SHAPE_CIRCLE (1 << 1) -#define GPU_KEYFRAME_SHAPE_CLIPPED_VERTICAL (1 << 2) -#define GPU_KEYFRAME_SHAPE_CLIPPED_HORIZONTAL (1 << 3) -#define GPU_KEYFRAME_SHAPE_INNER_DOT (1 << 4) -#define GPU_KEYFRAME_SHAPE_ARROW_END_MAX (1 << 8) -#define GPU_KEYFRAME_SHAPE_ARROW_END_MIN (1 << 9) -#define GPU_KEYFRAME_SHAPE @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs