Compare commits

..

13 commits

Author SHA1 Message Date
Isaac Marovitz
ebfbf9de89
Upstream
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:12:11 -04:00
Isaac Marovitz
13fb9fd4b9
Move Push Constants buffer index
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:08:46 -04:00
Isaac Marovitz
c96ad61b71
Fix spec constants
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:08:46 -04:00
Isaac Marovitz
46938a4142
Fix matrix multiplication ordering
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:08:46 -04:00
Isaac Marovitz
253c5954cd
Make spec constants optional
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:08:46 -04:00
Isaac Marovitz
ce5aeb3fef
Fix incorrect “FLT_MIN”
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:08:46 -04:00
Isaac Marovitz
d6cd7ca917
Enable source inclusion for recompiled shaders
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:08:46 -04:00
Isaac Marovitz
f542f86c28
Use HLSL semantics as user name
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:08:46 -04:00
Isaac Marovitz
88196ee508
MSL cast down workaround
Explicitly adds single component swizzle for narrowing vector to scalar conversion

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:08:46 -04:00
Isaac Marovitz
85c3c83fa7
AIR Compilation, Compression, and Packing
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:08:46 -04:00
Isaac Marovitz
04539fdf02
Always emit output struct init
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:08:46 -04:00
Isaac Marovitz
e851c0baff
MSL Shader Generation
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-04-02 14:08:45 -04:00
Skyth (Asilkan)
421e3b3e79
Apply half pixel offset in the vertex shader. (#16) 2025-03-30 03:47:16 +03:00
2 changed files with 12 additions and 5 deletions

View file

@ -29,7 +29,8 @@ struct PushConstants
#define g_Booleans vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 256)
#define g_SwappedTexcoords vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 260)
#define g_AlphaThreshold vk::RawBufferLoad<float>(g_PushConstants.SharedConstants + 264)
#define g_HalfPixelOffset vk::RawBufferLoad<float2>(g_PushConstants.SharedConstants + 264)
#define g_AlphaThreshold vk::RawBufferLoad<float>(g_PushConstants.SharedConstants + 272)
[[vk::constant_id(0)]] const uint g_SpecConstants = 0;
@ -58,14 +59,16 @@ struct PushConstants
#define g_Booleans (*(reinterpret_cast<device uint*>(g_PushConstants.SharedConstants + 256)))
#define g_SwappedTexcoords (*(reinterpret_cast<device uint*>(g_PushConstants.SharedConstants + 260)))
#define g_AlphaThreshold (*(reinterpret_cast<device float*>(g_PushConstants.SharedConstants + 264)))
#define g_HalfPixelOffset (*(reinterpret_cast<device float*>(g_PushConstants.SharedConstants + 264)))
#define g_AlphaThreshold (*(reinterpret_cast<device float*>(g_PushConstants.SharedConstants + 272)))
#else
#define DEFINE_SHARED_CONSTANTS() \
uint g_Booleans : packoffset(c16.x); \
uint g_SwappedTexcoords : packoffset(c16.y); \
float g_AlphaThreshold : packoffset(c16.z) \
float2 g_HalfPixelOffset : packoffset(c16.z); \
float g_AlphaThreshold : packoffset(c17.x);
uint g_SpecConstants();

View file

@ -1687,7 +1687,7 @@ void ShaderRecompiler::recompile(const uint8_t* shaderData, const std::string_vi
out += "\tconstant Texture3DDescriptorHeap& g_Texture3DDescriptorHeap [[buffer(1)]],\n";
out += "\tconstant TextureCubeDescriptorHeap& g_TextureCubeDescriptorHeap [[buffer(2)]],\n";
out += "\tconstant SamplerDescriptorHeap& g_SamplerDescriptorHeap [[buffer(3)]],\n";
out += "\tconstant PushConstants& g_PushConstants [[buffer(8)]]\n";
out += "\tconstant PushConstants& g_PushConstants [[buffer(4)]]\n";
out += "#else\n";
@ -1705,7 +1705,7 @@ void ShaderRecompiler::recompile(const uint8_t* shaderData, const std::string_vi
else
{
out += "#ifdef __air__\n";
out += "\tconstant PushConstants& g_PushConstants [[buffer(8)]],\n";
out += "\tconstant PushConstants& g_PushConstants [[buffer(4)]],\n";
out += "\tVertexShaderInput input [[stage_in]]\n";
out += "#else\n";
out += "\tVertexShaderInput input\n";
@ -2216,6 +2216,10 @@ void ShaderRecompiler::recompile(const uint8_t* shaderData, const std::string_vi
out += "}\n";
#endif
}
else
{
out += "\toutput.oPos.xy += g_HalfPixelOffset * output.oPos.w;\n";
}
if (simpleControlFlow)
{