diff --git a/XenosRecomp/shader_common.h b/XenosRecomp/shader_common.h index e1cf1c3..fe8e930 100644 --- a/XenosRecomp/shader_common.h +++ b/XenosRecomp/shader_common.h @@ -10,10 +10,12 @@ #define SPEC_CONSTANT_REVERSE_Z (1 << 4) #endif -#if !defined(__cplusplus) || defined(__INTELLISENSE__) +#if defined(__air__) || !defined(__cplusplus) || defined(__INTELLISENSE__) +#ifndef __air__ #define FLT_MIN asfloat(0xff7fffff) #define FLT_MAX asfloat(0x7f7fffff) +#endif #ifdef __spirv__ @@ -162,7 +164,7 @@ void clip(T a) } template -void rcp(T a) +float rcp(T a) { return 1.0 / a; } @@ -216,6 +218,12 @@ float h1(float a) return 1.0f + w3(a) / (w2(a) + w3(a)) + 0.5f; } +struct CubeMapData +{ + float3 cubeMapDirections[2]; + uint cubeMapIndex; +}; + #ifdef __air__ float4 tfetch2DBicubic(constant Texture2DDescriptorHeap& textureHeap, @@ -265,12 +273,6 @@ float4 tfetch3D(constant Texture3DDescriptorHeap& textureHeap, return texture.sample(sampler, texCoord); } -struct CubeMapData -{ - float3 cubeMapDirections[2]; - uint cubeMapIndex; -}; - float4 tfetchCube(constant TextureCubeDescriptorHeap& textureHeap, constant SamplerDescriptorHeap& samplerHeap, uint resourceDescriptorIndex, @@ -321,12 +323,6 @@ float4 tfetch3D(uint resourceDescriptorIndex, uint samplerDescriptorIndex, float return g_Texture3DDescriptorHeap[resourceDescriptorIndex].Sample(g_SamplerDescriptorHeap[samplerDescriptorIndex], texCoord); } -struct CubeMapData -{ - float3 cubeMapDirections[2]; - uint cubeMapIndex; -}; - float4 tfetchCube(uint resourceDescriptorIndex, uint samplerDescriptorIndex, float3 texCoord, inout CubeMapData cubeMapData) { return g_TextureCubeDescriptorHeap[resourceDescriptorIndex].Sample(g_SamplerDescriptorHeap[samplerDescriptorIndex], cubeMapData.cubeMapDirections[texCoord.z]);