shader_common fixes

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
This commit is contained in:
Isaac Marovitz 2025-03-20 21:19:04 -04:00
parent 6c88f0b31e
commit 4149b8458a
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1

View file

@ -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<typename T>
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]);