mirror of
https://github.com/hedge-dev/XenosRecomp.git
synced 2025-10-30 07:12:17 +00:00
shader_common fixes
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
This commit is contained in:
parent
6c88f0b31e
commit
4149b8458a
1 changed files with 10 additions and 14 deletions
|
|
@ -10,10 +10,12 @@
|
||||||
#define SPEC_CONSTANT_REVERSE_Z (1 << 4)
|
#define SPEC_CONSTANT_REVERSE_Z (1 << 4)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__cplusplus) || defined(__INTELLISENSE__)
|
#if defined(__air__) || !defined(__cplusplus) || defined(__INTELLISENSE__)
|
||||||
|
|
||||||
|
#ifndef __air__
|
||||||
#define FLT_MIN asfloat(0xff7fffff)
|
#define FLT_MIN asfloat(0xff7fffff)
|
||||||
#define FLT_MAX asfloat(0x7f7fffff)
|
#define FLT_MAX asfloat(0x7f7fffff)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __spirv__
|
#ifdef __spirv__
|
||||||
|
|
||||||
|
|
@ -162,7 +164,7 @@ void clip(T a)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void rcp(T a)
|
float rcp(T a)
|
||||||
{
|
{
|
||||||
return 1.0 / a;
|
return 1.0 / a;
|
||||||
}
|
}
|
||||||
|
|
@ -216,6 +218,12 @@ float h1(float a)
|
||||||
return 1.0f + w3(a) / (w2(a) + w3(a)) + 0.5f;
|
return 1.0f + w3(a) / (w2(a) + w3(a)) + 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct CubeMapData
|
||||||
|
{
|
||||||
|
float3 cubeMapDirections[2];
|
||||||
|
uint cubeMapIndex;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef __air__
|
#ifdef __air__
|
||||||
|
|
||||||
float4 tfetch2DBicubic(constant Texture2DDescriptorHeap& textureHeap,
|
float4 tfetch2DBicubic(constant Texture2DDescriptorHeap& textureHeap,
|
||||||
|
|
@ -265,12 +273,6 @@ float4 tfetch3D(constant Texture3DDescriptorHeap& textureHeap,
|
||||||
return texture.sample(sampler, texCoord);
|
return texture.sample(sampler, texCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CubeMapData
|
|
||||||
{
|
|
||||||
float3 cubeMapDirections[2];
|
|
||||||
uint cubeMapIndex;
|
|
||||||
};
|
|
||||||
|
|
||||||
float4 tfetchCube(constant TextureCubeDescriptorHeap& textureHeap,
|
float4 tfetchCube(constant TextureCubeDescriptorHeap& textureHeap,
|
||||||
constant SamplerDescriptorHeap& samplerHeap,
|
constant SamplerDescriptorHeap& samplerHeap,
|
||||||
uint resourceDescriptorIndex,
|
uint resourceDescriptorIndex,
|
||||||
|
|
@ -321,12 +323,6 @@ float4 tfetch3D(uint resourceDescriptorIndex, uint samplerDescriptorIndex, float
|
||||||
return g_Texture3DDescriptorHeap[resourceDescriptorIndex].Sample(g_SamplerDescriptorHeap[samplerDescriptorIndex], texCoord);
|
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)
|
float4 tfetchCube(uint resourceDescriptorIndex, uint samplerDescriptorIndex, float3 texCoord, inout CubeMapData cubeMapData)
|
||||||
{
|
{
|
||||||
return g_TextureCubeDescriptorHeap[resourceDescriptorIndex].Sample(g_SamplerDescriptorHeap[samplerDescriptorIndex], cubeMapData.cubeMapDirections[texCoord.z]);
|
return g_TextureCubeDescriptorHeap[resourceDescriptorIndex].Sample(g_SamplerDescriptorHeap[samplerDescriptorIndex], cubeMapData.cubeMapDirections[texCoord.z]);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue