[Webkit-unassigned] [Bug 226660] [Metal ANGLE] Shaders with reserved metal keywords do not translate, nor do shaders with struct and variable names that are the same except prefixed by an underscore
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Jun 4 16:57:40 PDT 2021
https://bugs.webkit.org/show_bug.cgi?id=226660
--- Comment #6 from John Cunningham <johncunningham at apple.com> ---
Here's the fragment shader converted to MSL:
#define ANGLE_ALWAYS_INLINE __attribute__((always_inline))
ANGLE_ALWAYS_INLINE int ANGLE_int_clamp(int value, int minValue, int maxValue)
{
return ((value < minValue) ? minValue : ((value > maxValue) ? maxValue : value));
};
#define ANGLE_SAMPLE_COMPARE_GRADIENT_INDEX 0
#define ANGLE_SAMPLE_COMPARE_LOD_INDEX 1
#define ANGLE_RASTERIZATION_DISCARD_INDEX 2
#define ANGLE_COVERAGE_MASK_ENABLED_INDEX 3
constant bool ANGLE_UseSampleCompareGradient [[function_constant(ANGLE_SAMPLE_COMPARE_GRADIENT_INDEX)]];
constant bool ANGLE_UseSampleCompareLod [[function_constant(ANGLE_SAMPLE_COMPARE_LOD_INDEX)]];
constant bool ANGLE_RasterizationDiscard [[function_constant(ANGLE_RASTERIZATION_DISCARD_INDEX)]];
constant bool ANGLE_CoverageMaskEnabled [[function_constant(ANGLE_COVERAGE_MASK_ENABLED_INDEX)]];
ANGLE_ALWAYS_INLINE void ANGLE_writeSampleMask(const uint mask,
thread uint& gl_SampleMask)
{
if (ANGLE_CoverageMaskEnabled)
{
gl_SampleMask = as_type<int>(mask);
}
}
#define ANGLE_tensor metal::array
#pragma clang diagnostic ignored "-Wunused-value"
struct ANGLE_s
{
float ANGLE_1_metal;
char ANGLE_5_pad[12];
};
struct ANGLE_DepthRangeParams
{
float ANGLE_near;
float ANGLE_far;
float ANGLE_diff;
float ANGLE_reserved;
};
struct ANGLE_AngleUniforms
{
metal::float4 ANGLE_viewport;
metal::float2 ANGLE_halfRenderArea;
metal::float2 ANGLE_flipXY;
metal::float2 ANGLE_negFlipXY;
uint ANGLE_clipDistancesEnabled;
uint ANGLE_xfbActiveUnpaused;
uint ANGLE_xfbVerticesPerDraw;
metal::int4 ANGLE_xfbBufferOffsets;
metal::uint4 ANGLE_acbBufferOffsets;
ANGLE_DepthRangeParams ANGLE_depthRange;
metal::float2x4 ANGLE_preRotation;
metal::float2x4 ANGLE_fragRotation;
uint coverageMask;
};
struct ANGLE_FragmentOut
{
metal::float4 color [[color(0)]];
uint gl_SampleMask [[sample_mask, function_constant(ANGLE_CoverageMaskEnabled)]];
};
ANGLE_s ANGLE_sb6c;
void ANGLE_helper(ANGLE_s ANGLE_s)
{
}
void ANGLE_0_main(thread ANGLE_FragmentOut & ANGLE_fragmentOut)
{
ANGLE_fragmentOut.color = metal::float4(0.0f, 0.0f, 0.0f, 0.0f);
ANGLE_s ANGLE_s = ANGLE_s{0.0f};
ANGLE_helper(ANGLE_s);
ANGLE_fragmentOut.color = metal::float4(0.0f, 0.80000001f, 0.0f, 1.0f);
}
fragment ANGLE_FragmentOut main0(constant ANGLE_AngleUniforms & ANGLE_angleUniforms [[buffer(17)]])
{
ANGLE_FragmentOut ANGLE_fragmentOut;
{
ANGLE_0_main(ANGLE_fragmentOut);
if (ANGLE_CoverageMaskEnabled)
{
ANGLE_writeSampleMask(ANGLE_angleUniforms.coverageMask, ANGLE_fragmentOut.gl_SampleMask);
} else {}
}
return ANGLE_fragmentOut;;
}
If I compile this I get the following errors:
ANGLE_s ANGLE_sb6c;
^
shader.metal:77:28: error: expected ';' at end of declaration
ANGLE_s ANGLE_s = ANGLE_s{0.0f};
^
;
shader.metal:77:21: warning: variable 'ANGLE_s' is uninitialized when used within its own initialization [-Wuninitialized]
ANGLE_s ANGLE_s = ANGLE_s{0.0f};
~~~~~~~ ^~~~~~~
1 warning and 2 errors generated.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210604/9d02d5e9/attachment.htm>
More information about the webkit-unassigned
mailing list