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
This commit is contained in:
parent
3efb31ee31
commit
dedca2c994
Notes:
blender-bot
2023-02-14 11:24:03 +01:00
Referenced by issue #103313, Regression: Crash on EEVEE when launch with --debug-gpu-force-workarounds Referenced by issue #96261, Metal Viewport
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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_ARROW_END_MIXED (1 << 10)
|
||||
#define GPU_KEYFRAME_SHAPE_DIAMOND (1u << 0)
|
||||
#define GPU_KEYFRAME_SHAPE_CIRCLE (1u << 1)
|
||||
#define GPU_KEYFRAME_SHAPE_CLIPPED_VERTICAL (1u << 2)
|
||||
#define GPU_KEYFRAME_SHAPE_CLIPPED_HORIZONTAL (1u << 3)
|
||||
#define GPU_KEYFRAME_SHAPE_INNER_DOT (1u << 4)
|
||||
#define GPU_KEYFRAME_SHAPE_ARROW_END_MAX (1u << 8)
|
||||
#define GPU_KEYFRAME_SHAPE_ARROW_END_MIN (1u << 9)
|
||||
#define GPU_KEYFRAME_SHAPE_ARROW_END_MIXED (1u << 10)
|
||||
#define GPU_KEYFRAME_SHAPE_SQUARE \
|
||||
(GPU_KEYFRAME_SHAPE_CLIPPED_VERTICAL | GPU_KEYFRAME_SHAPE_CLIPPED_HORIZONTAL)
|
||||
|
||||
|
@ -18,7 +18,7 @@ const float minmax_scale = sqrt(1.0 / (1.0 + 1.0 / minmax_bias));
|
|||
|
||||
bool test(uint bit)
|
||||
{
|
||||
return (finalFlags & bit) != 0;
|
||||
return (finalFlags & bit) != 0u;
|
||||
}
|
||||
|
||||
void main()
|
||||
|
|
|
@ -153,6 +153,9 @@ struct SStruct {
|
|||
/* Texture-write functions. */
|
||||
#define imageStore(_tex, _coord, _value) _texture_write_internal(_tex, _coord, _value)
|
||||
|
||||
/* Cubemap support always available when using Metal. */
|
||||
#define textureLod_cubemapArray(tex, co, lod) textureLod(tex, co, lod)
|
||||
|
||||
/* Singular return values from texture functions of type DEPTH are often indexed with either .r or
|
||||
* .x. This is a lightweight wrapper type for handling this syntax. */
|
||||
union _msl_return_float {
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
|
||||
/* Cubemap support and fallback implementation declarations. */
|
||||
#ifdef GPU_ARB_texture_cube_map_array
|
||||
# define textureLod_cubemapArray(tex, co, lod) textureLod(tex, co, lod)
|
||||
#else
|
||||
# define samplerCubeArray sampler2DArray
|
||||
#endif
|
||||
|
||||
/* Texture format tokens -- Type explicitness required by other Graphics APIs. */
|
||||
#define depth2D sampler2D
|
||||
#define depth2DArray sampler2DArray
|
||||
|
|
Loading…
Reference in New Issue