diff options
author | Chip Davis <cdavis@codeweavers.com> | 2020-10-27 21:42:33 -0500 |
---|---|---|
committer | Chip Davis <cdavis@codeweavers.com> | 2020-10-29 10:50:59 -0500 |
commit | c20d5945a2fab3abe96a95b09dd58c7895a2f2f7 (patch) | |
tree | fbddc53cc3645afb0d2852a1a936323039a122d9 | |
parent | 78c6d2d62897e700f7f6bbd6289ff22245058ed7 (diff) | |
download | SPIRV-Cross-c20d5945a2fab3abe96a95b09dd58c7895a2f2f7.tar.gz SPIRV-Cross-c20d5945a2fab3abe96a95b09dd58c7895a2f2f7.tar.bz2 SPIRV-Cross-c20d5945a2fab3abe96a95b09dd58c7895a2f2f7.zip |
MSL: Allow framebuffer fetch on Mac in MSL 2.3.
Another Apple GPU feature that will now be supported on Apple Silicon
Macs.
12 files changed, 1119 insertions, 11 deletions
@@ -729,7 +729,7 @@ static void print_help_msl() "\t[--msl-texture-buffer-native]:\n\t\tEnable native support for texel buffers. Otherwise, it is emulated as a normal texture.\n" "\t[--msl-framebuffer-fetch]:\n\t\tImplement subpass inputs with frame buffer fetch.\n" "\t\tEmits [[color(N)]] inputs in fragment stage.\n" - "\t\tRequires iOS Metal.\n" + "\t\tRequires an Apple GPU.\n" "\t[--msl-emulate-cube-array]:\n\t\tEmulate cube arrays with 2D array and manual math.\n" "\t[--msl-discrete-descriptor-set <index>]:\n\t\tWhen using argument buffers, forces a specific descriptor set to be implemented without argument buffers.\n" "\t\tUseful for implementing push descriptors in emulation layers.\n" @@ -994,9 +994,9 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t> if (args.msl_ios) { msl_opts.platform = CompilerMSL::Options::iOS; - msl_opts.ios_use_framebuffer_fetch_subpasses = args.msl_framebuffer_fetch; msl_opts.emulate_cube_array = args.msl_emulate_cube_array; } + msl_opts.use_framebuffer_fetch_subpasses = args.msl_framebuffer_fetch; msl_opts.pad_fragment_output_components = args.msl_pad_fragment_output; msl_opts.tess_domain_origin_lower_left = args.msl_domain_lower_left; msl_opts.argument_buffers = args.msl_argument_buffers; diff --git a/reference/opt/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag b/reference/opt/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag new file mode 100644 index 00000000..817b1cff --- /dev/null +++ b/reference/opt/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag @@ -0,0 +1,213 @@ +#include <metal_stdlib> +#include <simd/simd.h> + +using namespace metal; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Globals +{ + float3 SoftTransitionScale; + float4 ShadowBufferSize; + float ShadowFadeFraction; + float ShadowSharpen; + float4 LightPositionAndInvRadius; + float4x4 ScreenToShadowMatrix; + float2 ProjectionDepthBiasParameters; + float4 ModulatedShadowColor; + float4 ShadowTileOffsetAndSize; +}; + +constant float4 _58 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData [[color(0)]], texture2d<float> ShadowDepthTexture [[texture(0)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float4 _67 = _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData; + float _68 = _67.w; + float4 _82 = _Globals.ScreenToShadowMatrix * float4((((gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw) - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_68), _68, 1.0); + float _118 = fast::clamp(((fast::clamp((ShadowDepthTexture.sample(ShadowDepthTextureSampler, (((_82.xyz / float3(_82.w)).xy * _Globals.ShadowTileOffsetAndSize.zw).xy + _Globals.ShadowTileOffsetAndSize.xy).xy, level(0.0)).xxx * float3(_Globals.SoftTransitionScale.z)) - float3((fast::min(_82.z, 0.999989986419677734375) * _Globals.SoftTransitionScale.z) - 1.0), float3(0.0), float3(1.0)).x - 0.5) * _Globals.ShadowSharpen) + 0.5, 0.0, 1.0); + float3 _127 = mix(_Globals.ModulatedShadowColor.xyz, float3(1.0), float3(mix(1.0, _118 * _118, _Globals.ShadowFadeFraction))); + float4 _129 = float4(_127.x, _127.y, _127.z, _58.w); + _129.w = 0.0; + out.out_var_SV_Target0 = _129; + return out; +} + diff --git a/reference/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag b/reference/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag new file mode 100644 index 00000000..c6798489 --- /dev/null +++ b/reference/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag @@ -0,0 +1,17 @@ +#include <metal_stdlib> +#include <simd/simd.h> + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(1)]]; +}; + +fragment main0_out main0(float4 uInput [[color(1)]]) +{ + main0_out out = {}; + out.FragColor = uInput; + return out; +} + diff --git a/reference/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag b/reference/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag new file mode 100644 index 00000000..950895d0 --- /dev/null +++ b/reference/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag @@ -0,0 +1,37 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include <metal_stdlib> +#include <simd/simd.h> + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 samp3(float4 uS) +{ + return uS; +} + +static inline __attribute__((always_inline)) +float4 samp(float4 uSub) +{ + return uSub + samp3(uSub); +} + +static inline __attribute__((always_inline)) +float4 samp2(float4 uS) +{ + return uS + samp3(uS); +} + +fragment main0_out main0(float4 uSub [[color(0)]]) +{ + main0_out out = {}; + out.FragColor = samp(uSub) + samp2(uSub); + return out; +} + diff --git a/reference/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag b/reference/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag new file mode 100644 index 00000000..817b1cff --- /dev/null +++ b/reference/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag @@ -0,0 +1,213 @@ +#include <metal_stdlib> +#include <simd/simd.h> + +using namespace metal; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Globals +{ + float3 SoftTransitionScale; + float4 ShadowBufferSize; + float ShadowFadeFraction; + float ShadowSharpen; + float4 LightPositionAndInvRadius; + float4x4 ScreenToShadowMatrix; + float2 ProjectionDepthBiasParameters; + float4 ModulatedShadowColor; + float4 ShadowTileOffsetAndSize; +}; + +constant float4 _58 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData [[color(0)]], texture2d<float> ShadowDepthTexture [[texture(0)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float4 _67 = _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData; + float _68 = _67.w; + float4 _82 = _Globals.ScreenToShadowMatrix * float4((((gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw) - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_68), _68, 1.0); + float _118 = fast::clamp(((fast::clamp((ShadowDepthTexture.sample(ShadowDepthTextureSampler, (((_82.xyz / float3(_82.w)).xy * _Globals.ShadowTileOffsetAndSize.zw).xy + _Globals.ShadowTileOffsetAndSize.xy).xy, level(0.0)).xxx * float3(_Globals.SoftTransitionScale.z)) - float3((fast::min(_82.z, 0.999989986419677734375) * _Globals.SoftTransitionScale.z) - 1.0), float3(0.0), float3(1.0)).x - 0.5) * _Globals.ShadowSharpen) + 0.5, 0.0, 1.0); + float3 _127 = mix(_Globals.ModulatedShadowColor.xyz, float3(1.0), float3(mix(1.0, _118 * _118, _Globals.ShadowFadeFraction))); + float4 _129 = float4(_127.x, _127.y, _127.z, _58.w); + _129.w = 0.0; + out.out_var_SV_Target0 = _129; + return out; +} + diff --git a/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag b/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag new file mode 100644 index 00000000..70822aee --- /dev/null +++ b/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(binding = 4, input_attachment_index = 1) uniform subpassInput uInput; +layout(location = 1) out vec4 FragColor; + +void main() +{ + FragColor = subpassLoad(uInput); +} diff --git a/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag b/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag new file mode 100644 index 00000000..ef9ef77d --- /dev/null +++ b/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag @@ -0,0 +1,24 @@ +#version 450 + +layout(set = 0, input_attachment_index = 0, binding = 0) uniform subpassInput uSub; +layout(location = 0) out vec4 FragColor; + +vec4 samp3(subpassInput uS) +{ + return subpassLoad(uS); +} + +vec4 samp2(subpassInput uS) +{ + return subpassLoad(uS) + samp3(uS); +} + +vec4 samp() +{ + return subpassLoad(uSub) + samp3(uSub); +} + +void main() +{ + FragColor = samp() + samp2(uSub); +} diff --git a/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag b/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag new file mode 100644 index 00000000..e6565873 --- /dev/null +++ b/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag @@ -0,0 +1,589 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 130 +; Schema: 0 + OpCapability Shader + OpCapability InputAttachment + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %Main "main" %gl_FragCoord %out_var_SV_Target0 + OpExecutionMode %Main OriginUpperLeft + OpSource HLSL 600 + OpName %type_subpass_image "type.subpass.image" + OpName %gl_LastFragData "gl_LastFragData" + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_TranslatedWorldToView" + OpMemberName %type_View 3 "View_ViewToTranslatedWorld" + OpMemberName %type_View 4 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 5 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 6 "View_ViewToClip" + OpMemberName %type_View 7 "View_ViewToClipNoAA" + OpMemberName %type_View 8 "View_ClipToView" + OpMemberName %type_View 9 "View_ClipToTranslatedWorld" + OpMemberName %type_View 10 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 11 "View_ScreenToWorld" + OpMemberName %type_View 12 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 13 "View_ViewForward" + OpMemberName %type_View 14 "PrePadding_View_844" + OpMemberName %type_View 15 "View_ViewUp" + OpMemberName %type_View 16 "PrePadding_View_860" + OpMemberName %type_View 17 "View_ViewRight" + OpMemberName %type_View 18 "PrePadding_View_876" + OpMemberName %type_View 19 "View_HMDViewNoRollUp" + OpMemberName %type_View 20 "PrePadding_View_892" + OpMemberName %type_View 21 "View_HMDViewNoRollRight" + OpMemberName %type_View 22 "PrePadding_View_908" + OpMemberName %type_View 23 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 24 "View_ScreenPositionScaleBias" + OpMemberName %type_View 25 "View_WorldCameraOrigin" + OpMemberName %type_View 26 "PrePadding_View_956" + OpMemberName %type_View 27 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 28 "PrePadding_View_972" + OpMemberName %type_View 29 "View_WorldViewOrigin" + OpMemberName %type_View 30 "PrePadding_View_988" + OpMemberName %type_View 31 "View_PreViewTranslation" + OpMemberName %type_View 32 "PrePadding_View_1004" + OpMemberName %type_View 33 "View_PrevProjection" + OpMemberName %type_View 34 "View_PrevViewProj" + OpMemberName %type_View 35 "View_PrevViewRotationProj" + OpMemberName %type_View 36 "View_PrevViewToClip" + OpMemberName %type_View 37 "View_PrevClipToView" + OpMemberName %type_View 38 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 40 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 41 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 42 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 43 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 44 "PrePadding_View_1660" + OpMemberName %type_View 45 "View_PrevWorldViewOrigin" + OpMemberName %type_View 46 "PrePadding_View_1676" + OpMemberName %type_View 47 "View_PrevPreViewTranslation" + OpMemberName %type_View 48 "PrePadding_View_1692" + OpMemberName %type_View 49 "View_PrevInvViewProj" + OpMemberName %type_View 50 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 51 "View_ClipToPrevClip" + OpMemberName %type_View 52 "View_TemporalAAJitter" + OpMemberName %type_View 53 "View_GlobalClippingPlane" + OpMemberName %type_View 54 "View_FieldOfViewWideAngles" + OpMemberName %type_View 55 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 56 "View_ViewRectMin" + OpMemberName %type_View 57 "View_ViewSizeAndInvSize" + OpMemberName %type_View 58 "View_BufferSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 60 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 61 "View_PreExposure" + OpMemberName %type_View 62 "View_OneOverPreExposure" + OpMemberName %type_View 63 "PrePadding_View_2012" + OpMemberName %type_View 64 "View_DiffuseOverrideParameter" + OpMemberName %type_View 65 "View_SpecularOverrideParameter" + OpMemberName %type_View 66 "View_NormalOverrideParameter" + OpMemberName %type_View 67 "View_RoughnessOverrideParameter" + OpMemberName %type_View 68 "View_PrevFrameGameTime" + OpMemberName %type_View 69 "View_PrevFrameRealTime" + OpMemberName %type_View 70 "View_OutOfBoundsMask" + OpMemberName %type_View 71 "PrePadding_View_2084" + OpMemberName %type_View 72 "PrePadding_View_2088" + OpMemberName %type_View 73 "PrePadding_View_2092" + OpMemberName %type_View 74 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 75 "View_CullingSign" + OpMemberName %type_View 76 "View_NearPlane" + OpMemberName %type_View 77 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 78 "View_GameTime" + OpMemberName %type_View 79 "View_RealTime" + OpMemberName %type_View 80 "View_DeltaTime" + OpMemberName %type_View 81 "View_MaterialTextureMipBias" + OpMemberName %type_View 82 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 83 "View_Random" + OpMemberName %type_View 84 "View_FrameNumber" + OpMemberName %type_View 85 "View_StateFrameIndexMod8" + OpMemberName %type_View 86 "View_StateFrameIndex" + OpMemberName %type_View 87 "View_CameraCut" + OpMemberName %type_View 88 "View_UnlitViewmodeMask" + OpMemberName %type_View 89 "PrePadding_View_2164" + OpMemberName %type_View 90 "PrePadding_View_2168" + OpMemberName %type_View 91 "PrePadding_View_2172" + OpMemberName %type_View 92 "View_DirectionalLightColor" + OpMemberName %type_View 93 "View_DirectionalLightDirection" + OpMemberName %type_View 94 "PrePadding_View_2204" + OpMemberName %type_View 95 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 97 "View_TemporalAAParams" + OpMemberName %type_View 98 "View_CircleDOFParams" + OpMemberName %type_View 99 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 100 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 101 "View_DepthOfFieldScale" + OpMemberName %type_View 102 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 103 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 104 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 105 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 106 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 107 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 108 "View_GeneralPurposeTweak" + OpMemberName %type_View 109 "View_DemosaicVposOffset" + OpMemberName %type_View 110 "PrePadding_View_2348" + OpMemberName %type_View 111 "View_IndirectLightingColorScale" + OpMemberName %type_View 112 "View_HDR32bppEncodingMode" + OpMemberName %type_View 113 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 114 "View_AtmosphericFogSunPower" + OpMemberName %type_View 115 "View_AtmosphericFogPower" + OpMemberName %type_View 116 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 117 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 118 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 119 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 120 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 121 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 122 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 123 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 124 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 125 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 126 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 127 "View_AtmosphericFogSunColor" + OpMemberName %type_View 128 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 129 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 130 "View_AmbientCubemapTint" + OpMemberName %type_View 131 "View_AmbientCubemapIntensity" + OpMemberName %type_View 132 "View_SkyLightParameters" + OpMemberName %type_View 133 "PrePadding_View_2488" + OpMemberName %type_View 134 "PrePadding_View_2492" + OpMemberName %type_View 135 "View_SkyLightColor" + OpMemberName %type_View 136 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 137 "View_MobilePreviewMode" + OpMemberName %type_View 138 "View_HMDEyePaddingOffset" + OpMemberName %type_View 139 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 140 "View_ShowDecalsMask" + OpMemberName %type_View 141 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 142 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 143 "PrePadding_View_2648" + OpMemberName %type_View 144 "PrePadding_View_2652" + OpMemberName %type_View 145 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 146 "View_StereoPassIndex" + OpMemberName %type_View 147 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 148 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 149 "View_GlobalVolumeDimension" + OpMemberName %type_View 150 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 151 "View_MaxGlobalDistance" + OpMemberName %type_View 152 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 153 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 154 "PrePadding_View_2828" + OpMemberName %type_View 155 "View_VolumetricFogGridZParams" + OpMemberName %type_View 156 "PrePadding_View_2844" + OpMemberName %type_View 157 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 158 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 159 "PrePadding_View_2860" + OpMemberName %type_View 160 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 161 "PrePadding_View_2876" + OpMemberName %type_View 162 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 163 "PrePadding_View_2892" + OpMemberName %type_View 164 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 165 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 166 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 167 "View_StereoIPD" + OpMemberName %type_View 168 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 169 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_sampler "type.sampler" + OpName %type_2d_image "type.2d.image" + OpName %ShadowDepthTexture "ShadowDepthTexture" + OpName %ShadowDepthTextureSampler "ShadowDepthTextureSampler" + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "SoftTransitionScale" + OpMemberName %type__Globals 1 "ShadowBufferSize" + OpMemberName %type__Globals 2 "ShadowFadeFraction" + OpMemberName %type__Globals 3 "ShadowSharpen" + OpMemberName %type__Globals 4 "LightPositionAndInvRadius" + OpMemberName %type__Globals 5 "ScreenToShadowMatrix" + OpMemberName %type__Globals 6 "ProjectionDepthBiasParameters" + OpMemberName %type__Globals 7 "ModulatedShadowColor" + OpMemberName %type__Globals 8 "ShadowTileOffsetAndSize" + OpName %_Globals "$Globals" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %Main "Main" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %gl_LastFragData InputAttachmentIndex 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_POSITION" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %gl_LastFragData DescriptorSet 0 + OpDecorate %gl_LastFragData Binding 0 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %ShadowDepthTexture DescriptorSet 0 + OpDecorate %ShadowDepthTexture Binding 0 + OpDecorate %ShadowDepthTextureSampler DescriptorSet 0 + OpDecorate %ShadowDepthTextureSampler Binding 0 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 1 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 14 Offset 844 + OpMemberDecorate %type_View 15 Offset 848 + OpMemberDecorate %type_View 16 Offset 860 + OpMemberDecorate %type_View 17 Offset 864 + OpMemberDecorate %type_View 18 Offset 876 + OpMemberDecorate %type_View 19 Offset 880 + OpMemberDecorate %type_View 20 Offset 892 + OpMemberDecorate %type_View 21 Offset 896 + OpMemberDecorate %type_View 22 Offset 908 + OpMemberDecorate %type_View 23 Offset 912 + OpMemberDecorate %type_View 24 Offset 928 + OpMemberDecorate %type_View 25 Offset 944 + OpMemberDecorate %type_View 26 Offset 956 + OpMemberDecorate %type_View 27 Offset 960 + OpMemberDecorate %type_View 28 Offset 972 + OpMemberDecorate %type_View 29 Offset 976 + OpMemberDecorate %type_View 30 Offset 988 + OpMemberDecorate %type_View 31 Offset 992 + OpMemberDecorate %type_View 32 Offset 1004 + OpMemberDecorate %type_View 33 Offset 1008 + OpMemberDecorate %type_View 33 MatrixStride 16 + OpMemberDecorate %type_View 33 ColMajor + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 44 Offset 1660 + OpMemberDecorate %type_View 45 Offset 1664 + OpMemberDecorate %type_View 46 Offset 1676 + OpMemberDecorate %type_View 47 Offset 1680 + OpMemberDecorate %type_View 48 Offset 1692 + OpMemberDecorate %type_View 49 Offset 1696 + OpMemberDecorate %type_View 49 MatrixStride 16 + OpMemberDecorate %type_View 49 ColMajor + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 53 Offset 1904 + OpMemberDecorate %type_View 54 Offset 1920 + OpMemberDecorate %type_View 55 Offset 1928 + OpMemberDecorate %type_View 56 Offset 1936 + OpMemberDecorate %type_View 57 Offset 1952 + OpMemberDecorate %type_View 58 Offset 1968 + OpMemberDecorate %type_View 59 Offset 1984 + OpMemberDecorate %type_View 60 Offset 2000 + OpMemberDecorate %type_View 61 Offset 2004 + OpMemberDecorate %type_View 62 Offset 2008 + OpMemberDecorate %type_View 63 Offset 2012 + OpMemberDecorate %type_View 64 Offset 2016 + OpMemberDecorate %type_View 65 Offset 2032 + OpMemberDecorate %type_View 66 Offset 2048 + OpMemberDecorate %type_View 67 Offset 2064 + OpMemberDecorate %type_View 68 Offset 2072 + OpMemberDecorate %type_View 69 Offset 2076 + OpMemberDecorate %type_View 70 Offset 2080 + OpMemberDecorate %type_View 71 Offset 2084 + OpMemberDecorate %type_View 72 Offset 2088 + OpMemberDecorate %type_View 73 Offset 2092 + OpMemberDecorate %type_View 74 Offset 2096 + OpMemberDecorate %type_View 75 Offset 2108 + OpMemberDecorate %type_View 76 Offset 2112 + OpMemberDecorate %type_View 77 Offset 2116 + OpMemberDecorate %type_View 78 Offset 2120 + OpMemberDecorate %type_View 79 Offset 2124 + OpMemberDecorate %type_View 80 Offset 2128 + OpMemberDecorate %type_View 81 Offset 2132 + OpMemberDecorate %type_View 82 Offset 2136 + OpMemberDecorate %type_View 83 Offset 2140 + OpMemberDecorate %type_View 84 Offset 2144 + OpMemberDecorate %type_View 85 Offset 2148 + OpMemberDecorate %type_View 86 Offset 2152 + OpMemberDecorate %type_View 87 Offset 2156 + OpMemberDecorate %type_View 88 Offset 2160 + OpMemberDecorate %type_View 89 Offset 2164 + OpMemberDecorate %type_View 90 Offset 2168 + OpMemberDecorate %type_View 91 Offset 2172 + OpMemberDecorate %type_View 92 Offset 2176 + OpMemberDecorate %type_View 93 Offset 2192 + OpMemberDecorate %type_View 94 Offset 2204 + OpMemberDecorate %type_View 95 Offset 2208 + OpMemberDecorate %type_View 96 Offset 2240 + OpMemberDecorate %type_View 97 Offset 2272 + OpMemberDecorate %type_View 98 Offset 2288 + OpMemberDecorate %type_View 99 Offset 2304 + OpMemberDecorate %type_View 100 Offset 2308 + OpMemberDecorate %type_View 101 Offset 2312 + OpMemberDecorate %type_View 102 Offset 2316 + OpMemberDecorate %type_View 103 Offset 2320 + OpMemberDecorate %type_View 104 Offset 2324 + OpMemberDecorate %type_View 105 Offset 2328 + OpMemberDecorate %type_View 106 Offset 2332 + OpMemberDecorate %type_View 107 Offset 2336 + OpMemberDecorate %type_View 108 Offset 2340 + OpMemberDecorate %type_View 109 Offset 2344 + OpMemberDecorate %type_View 110 Offset 2348 + OpMemberDecorate %type_View 111 Offset 2352 + OpMemberDecorate %type_View 112 Offset 2364 + OpMemberDecorate %type_View 113 Offset 2368 + OpMemberDecorate %type_View 114 Offset 2380 + OpMemberDecorate %type_View 115 Offset 2384 + OpMemberDecorate %type_View 116 Offset 2388 + OpMemberDecorate %type_View 117 Offset 2392 + OpMemberDecorate %type_View 118 Offset 2396 + OpMemberDecorate %type_View 119 Offset 2400 + OpMemberDecorate %type_View 120 Offset 2404 + OpMemberDecorate %type_View 121 Offset 2408 + OpMemberDecorate %type_View 122 Offset 2412 + OpMemberDecorate %type_View 123 Offset 2416 + OpMemberDecorate %type_View 124 Offset 2420 + OpMemberDecorate %type_View 125 Offset 2424 + OpMemberDecorate %type_View 126 Offset 2428 + OpMemberDecorate %type_View 127 Offset 2432 + OpMemberDecorate %type_View 128 Offset 2448 + OpMemberDecorate %type_View 129 Offset 2460 + OpMemberDecorate %type_View 130 Offset 2464 + OpMemberDecorate %type_View 131 Offset 2480 + OpMemberDecorate %type_View 132 Offset 2484 + OpMemberDecorate %type_View 133 Offset 2488 + OpMemberDecorate %type_View 134 Offset 2492 + OpMemberDecorate %type_View 135 Offset 2496 + OpMemberDecorate %type_View 136 Offset 2512 + OpMemberDecorate %type_View 137 Offset 2624 + OpMemberDecorate %type_View 138 Offset 2628 + OpMemberDecorate %type_View 139 Offset 2632 + OpMemberDecorate %type_View 140 Offset 2636 + OpMemberDecorate %type_View 141 Offset 2640 + OpMemberDecorate %type_View 142 Offset 2644 + OpMemberDecorate %type_View 143 Offset 2648 + OpMemberDecorate %type_View 144 Offset 2652 + OpMemberDecorate %type_View 145 Offset 2656 + OpMemberDecorate %type_View 146 Offset 2668 + OpMemberDecorate %type_View 147 Offset 2672 + OpMemberDecorate %type_View 148 Offset 2736 + OpMemberDecorate %type_View 149 Offset 2800 + OpMemberDecorate %type_View 150 Offset 2804 + OpMemberDecorate %type_View 151 Offset 2808 + OpMemberDecorate %type_View 152 Offset 2812 + OpMemberDecorate %type_View 153 Offset 2816 + OpMemberDecorate %type_View 154 Offset 2828 + OpMemberDecorate %type_View 155 Offset 2832 + OpMemberDecorate %type_View 156 Offset 2844 + OpMemberDecorate %type_View 157 Offset 2848 + OpMemberDecorate %type_View 158 Offset 2856 + OpMemberDecorate %type_View 159 Offset 2860 + OpMemberDecorate %type_View 160 Offset 2864 + OpMemberDecorate %type_View 161 Offset 2876 + OpMemberDecorate %type_View 162 Offset 2880 + OpMemberDecorate %type_View 163 Offset 2892 + OpMemberDecorate %type_View 164 Offset 2896 + OpMemberDecorate %type_View 165 Offset 2908 + OpMemberDecorate %type_View 166 Offset 2912 + OpMemberDecorate %type_View 167 Offset 2924 + OpMemberDecorate %type_View 168 Offset 2928 + OpMemberDecorate %type_View 169 Offset 2932 + OpDecorate %type_View Block + OpMemberDecorate %type__Globals 0 Offset 0 + OpMemberDecorate %type__Globals 1 Offset 16 + OpMemberDecorate %type__Globals 2 Offset 32 + OpMemberDecorate %type__Globals 3 Offset 36 + OpMemberDecorate %type__Globals 4 Offset 48 + OpMemberDecorate %type__Globals 5 Offset 64 + OpMemberDecorate %type__Globals 5 MatrixStride 16 + OpMemberDecorate %type__Globals 5 ColMajor + OpMemberDecorate %type__Globals 6 Offset 128 + OpMemberDecorate %type__Globals 7 Offset 144 + OpMemberDecorate %type__Globals 8 Offset 160 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %float_1 = OpConstant %float 1 + %int_58 = OpConstant %int 58 + %int_24 = OpConstant %int 24 + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_8 = OpConstant %int 8 +%float_0_999989986 = OpConstant %float 0.999989986 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %int_7 = OpConstant %int 7 + %float_0_5 = OpConstant %float 0.5 + %41 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %v2int = OpTypeVector %int 2 + %43 = OpConstantComposite %v2int %int_0 %int_0 + %44 = OpConstantComposite %v3float %float_0 %float_0 %float_0 +%type_subpass_image = OpTypeImage %float SubpassData 2 0 0 2 Unknown +%_ptr_UniformConstant_type_subpass_image = OpTypePointer UniformConstant %type_subpass_image +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type__Globals = OpTypeStruct %v3float %v4float %float %float %v4float %mat4v4float %v2float %v4float %v4float +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %53 = OpTypeFunction %void +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%type_sampled_image = OpTypeSampledImage %type_2d_image +%gl_LastFragData = OpVariable %_ptr_UniformConstant_type_subpass_image UniformConstant + %View = OpVariable %_ptr_Uniform_type_View Uniform +%ShadowDepthTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%ShadowDepthTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %57 = OpConstantNull %v4float + %58 = OpUndef %v4float + %Main = OpFunction %void None %53 + %59 = OpLabel + %60 = OpLoad %v4float %gl_FragCoord + %61 = OpVectorShuffle %v2float %60 %60 0 1 + %62 = OpAccessChain %_ptr_Uniform_v4float %View %int_58 + %63 = OpLoad %v4float %62 + %64 = OpVectorShuffle %v2float %63 %63 2 3 + %65 = OpFMul %v2float %61 %64 + %66 = OpLoad %type_subpass_image %gl_LastFragData + %67 = OpImageRead %v4float %66 %43 None + %68 = OpCompositeExtract %float %67 3 + %69 = OpAccessChain %_ptr_Uniform_v4float %View %int_24 + %70 = OpLoad %v4float %69 + %71 = OpVectorShuffle %v2float %70 %70 3 2 + %72 = OpFSub %v2float %65 %71 + %73 = OpVectorShuffle %v2float %70 %70 0 1 + %74 = OpFDiv %v2float %72 %73 + %75 = OpCompositeConstruct %v2float %68 %68 + %76 = OpFMul %v2float %74 %75 + %77 = OpCompositeExtract %float %76 0 + %78 = OpCompositeExtract %float %76 1 + %79 = OpCompositeConstruct %v4float %77 %78 %68 %float_1 + %80 = OpAccessChain %_ptr_Uniform_mat4v4float %_Globals %int_5 + %81 = OpLoad %mat4v4float %80 + %82 = OpMatrixTimesVector %v4float %81 %79 + %83 = OpCompositeExtract %float %82 2 + %84 = OpCompositeExtract %float %82 3 + %85 = OpCompositeConstruct %v3float %84 %84 %84 + %86 = OpVectorShuffle %v3float %82 %82 0 1 2 + %87 = OpFDiv %v3float %86 %85 + %88 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_8 + %89 = OpLoad %v4float %88 + %90 = OpVectorShuffle %v2float %89 %89 2 3 + %91 = OpVectorShuffle %v2float %87 %57 0 1 + %92 = OpFMul %v2float %91 %90 + %93 = OpVectorShuffle %v2float %89 %89 0 1 + %94 = OpVectorShuffle %v2float %92 %57 0 1 + %95 = OpFAdd %v2float %94 %93 + %96 = OpExtInst %float %1 FMin %83 %float_0_999989986 + %97 = OpLoad %type_2d_image %ShadowDepthTexture + %98 = OpLoad %type_sampler %ShadowDepthTextureSampler + %99 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_2 + %100 = OpLoad %float %99 + %101 = OpVectorShuffle %v2float %95 %57 0 1 + %102 = OpSampledImage %type_sampled_image %97 %98 + %103 = OpImageSampleExplicitLod %v4float %102 %101 Lod %float_0 + %104 = OpVectorShuffle %v3float %103 %103 0 0 0 + %105 = OpFMul %float %96 %100 + %106 = OpFSub %float %105 %float_1 + %107 = OpCompositeConstruct %v3float %100 %100 %100 + %108 = OpFMul %v3float %104 %107 + %109 = OpCompositeConstruct %v3float %106 %106 %106 + %110 = OpFSub %v3float %108 %109 + %111 = OpExtInst %v3float %1 FClamp %110 %44 %41 + %112 = OpCompositeExtract %float %111 0 + %113 = OpFSub %float %112 %float_0_5 + %114 = OpAccessChain %_ptr_Uniform_float %_Globals %int_3 + %115 = OpLoad %float %114 + %116 = OpFMul %float %113 %115 + %117 = OpFAdd %float %116 %float_0_5 + %118 = OpExtInst %float %1 FClamp %117 %float_0 %float_1 + %119 = OpFMul %float %118 %118 + %120 = OpAccessChain %_ptr_Uniform_float %_Globals %int_2 + %121 = OpLoad %float %120 + %122 = OpExtInst %float %1 FMix %float_1 %119 %121 + %123 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_7 + %124 = OpLoad %v4float %123 + %125 = OpVectorShuffle %v3float %124 %124 0 1 2 + %126 = OpCompositeConstruct %v3float %122 %122 %122 + %127 = OpExtInst %v3float %1 FMix %125 %41 %126 + %128 = OpVectorShuffle %v4float %58 %127 4 5 6 3 + %129 = OpCompositeInsert %v4float %float_0 %128 3 + OpStore %out_var_SV_Target0 %129 + OpReturn + OpFunctionEnd diff --git a/spirv_cross_c.cpp b/spirv_cross_c.cpp index cbe3a558..59a9c918 100644 --- a/spirv_cross_c.cpp +++ b/spirv_cross_c.cpp @@ -599,8 +599,8 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c options->msl.enable_base_index_zero = value != 0; break; - case SPVC_COMPILER_OPTION_MSL_IOS_FRAMEBUFFER_FETCH_SUBPASS: - options->msl.ios_use_framebuffer_fetch_subpasses = value != 0; + case SPVC_COMPILER_OPTION_MSL_FRAMEBUFFER_FETCH_SUBPASS: + options->msl.use_framebuffer_fetch_subpasses = value != 0; break; case SPVC_COMPILER_OPTION_MSL_INVARIANT_FP_MATH: diff --git a/spirv_cross_c.h b/spirv_cross_c.h index f52abcda..d6802a1f 100644 --- a/spirv_cross_c.h +++ b/spirv_cross_c.h @@ -606,7 +606,11 @@ typedef enum spvc_compiler_option SPVC_COMPILER_OPTION_MSL_DYNAMIC_OFFSETS_BUFFER_INDEX = 43 | SPVC_COMPILER_OPTION_MSL_BIT, SPVC_COMPILER_OPTION_MSL_TEXTURE_1D_AS_2D = 44 | SPVC_COMPILER_OPTION_MSL_BIT, SPVC_COMPILER_OPTION_MSL_ENABLE_BASE_INDEX_ZERO = 45 | SPVC_COMPILER_OPTION_MSL_BIT, + + /* Obsolete. Use MSL_FRAMEBUFFER_FETCH_SUBPASS instead. */ SPVC_COMPILER_OPTION_MSL_IOS_FRAMEBUFFER_FETCH_SUBPASS = 46 | SPVC_COMPILER_OPTION_MSL_BIT, + SPVC_COMPILER_OPTION_MSL_FRAMEBUFFER_FETCH_SUBPASS = 46 | SPVC_COMPILER_OPTION_MSL_BIT, + SPVC_COMPILER_OPTION_MSL_INVARIANT_FP_MATH = 47 | SPVC_COMPILER_OPTION_MSL_BIT, SPVC_COMPILER_OPTION_MSL_EMULATE_CUBEMAP_ARRAY = 48 | SPVC_COMPILER_OPTION_MSL_BIT, SPVC_COMPILER_OPTION_MSL_ENABLE_DECORATION_BINDING = 49 | SPVC_COMPILER_OPTION_MSL_BIT, diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 2fc7df10..42d5e10f 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -197,7 +197,7 @@ void CompilerMSL::build_implicit_builtins() if (var.storage != StorageClassInput) return; - if (need_subpass_input && (!msl_options.is_ios() || !msl_options.ios_use_framebuffer_fetch_subpasses)) + if (need_subpass_input && (!msl_options.use_framebuffer_fetch_subpasses)) { switch (builtin) { @@ -331,7 +331,7 @@ void CompilerMSL::build_implicit_builtins() // Use Metal's native frame-buffer fetch API for subpass inputs. if ((!has_frag_coord || (msl_options.multiview && !has_view_idx) || (msl_options.arrayed_subpass_input && !msl_options.multiview && !has_layer)) && - (!msl_options.is_ios() || !msl_options.ios_use_framebuffer_fetch_subpasses) && need_subpass_input) + (!msl_options.use_framebuffer_fetch_subpasses) && need_subpass_input) { if (!has_frag_coord) { @@ -1375,7 +1375,7 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: // Use Metal's native frame-buffer fetch API for subpass inputs. auto &type = get<SPIRType>(ops[0]); if (type.basetype == SPIRType::Image && type.image.dim == DimSubpassData && - (!msl_options.is_ios() || !msl_options.ios_use_framebuffer_fetch_subpasses)) + (!msl_options.use_framebuffer_fetch_subpasses)) { // Implicitly reads gl_FragCoord. assert(builtin_frag_coord_id != 0); @@ -7415,7 +7415,7 @@ void CompilerMSL::emit_texture_op(const Instruction &i, bool sparse) if (sparse) SPIRV_CROSS_THROW("Sparse feedback not yet supported in MSL."); - if (msl_options.is_ios() && msl_options.ios_use_framebuffer_fetch_subpasses) + if (msl_options.use_framebuffer_fetch_subpasses) { auto *ops = stream(i); @@ -10471,6 +10471,8 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) } else { + if (msl_options.is_macos() && !msl_options.supports_msl_version(2, 3)) + SPIRV_CROSS_THROW("Framebuffer fetch on Mac is not supported before MSL 2.3."); ep_args += image_type_glsl(type, var_id) + " " + r.name; ep_args += " [[color(" + convert_to_string(r.index) + ")]]"; } @@ -11098,8 +11100,8 @@ uint32_t CompilerMSL::get_metal_resource_index(SPIRVariable &var, SPIRType::Base bool CompilerMSL::type_is_msl_framebuffer_fetch(const SPIRType &type) const { - return type.basetype == SPIRType::Image && type.image.dim == DimSubpassData && msl_options.is_ios() && - msl_options.ios_use_framebuffer_fetch_subpasses; + return type.basetype == SPIRType::Image && type.image.dim == DimSubpassData && + msl_options.use_framebuffer_fetch_subpasses; } string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) diff --git a/spirv_msl.hpp b/spirv_msl.hpp index cd1a1486..13271f62 100644 --- a/spirv_msl.hpp +++ b/spirv_msl.hpp @@ -315,7 +315,7 @@ public: bool ios_support_base_vertex_instance = false; // Use Metal's native frame-buffer fetch API for subpass inputs. - bool ios_use_framebuffer_fetch_subpasses = false; + bool use_framebuffer_fetch_subpasses = false; // Enables use of "fma" intrinsic for invariant float math bool invariant_float_math = false; |