OK I'm taking a look at the HLSL stuff (which is already integrated).
There's a warning I missed (and you too! haha) in
glslang:
An HLSL front-end for translation of an approximation of HLSL to glslang's AST form.
Status: Partially complete. Semantics are not reference quality and input is not validated. This is in contrast to the DXC project, which receives a much larger investment and attempts to have definitive/reference-level semantics.
Ouch. That means we should not use it with Hlms. No big deal. I wasn't planning to
DirectXShaderCompiler sounds more stable/robust, but I'm worried its Linux supports may become a problem when trying to support Android.
My goal is to attempt to use HLSL for low level materials, since existing shaders should map well to Vulkan
without any major modification (could even theoretically work out of the box).
So far it seems glslang's HLSL support is close to that goal. This vertex shader (meant for D3D11) compiles out of the box on Vulkan too:
Code: Select all
struct VS_INPUT
{
float4 vertex : POSITION;
float2 uv0 : TEXCOORD0;
};
struct PS_INPUT
{
float2 uv0 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
uniform matrix worldViewProj;
PS_INPUT main
(
VS_INPUT input
)
{
PS_INPUT outVs;
outVs.gl_Position = mul( worldViewProj, input.vertex ).xyzw;
outVs.uv0 = input.uv0;
return outVs;
}
However if I write:
Code: Select all
PS_INPUT main
(
VS_INPUT input,
uniform matrix worldViewProj; // Uniform is here
)
{
// ...
}
The wrong shader is compiled (SPIRV expects worldViewProj to be a vertex location, not a uniform).
I can live with that.
So far my current problem is that this shader:
Code: Select all
struct VS_INPUT
{
float4 vertex : POSITION;
float2 uv0 : TEXCOORD0;
};
struct PS_INPUT
{
float2 uv0 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
uniform matrix worldViewProj;
uniform float4 anotherVal;
PS_INPUT main
(
VS_INPUT input
)
{
PS_INPUT outVs;
outVs.gl_Position = mul( worldViewProj, input.vertex ).xyzw;
outVs.uv0 = input.uv0;
return outVs;
}
Doesn't show up because the first row of worldViewProj is all zeroes. I'm still researching why is that.
Update: Happens with GLSL too. Must be probably a bug in buildConstantDefinitions
Update 2: Fixed
Hotshot5000 wrote: ↑Sun Aug 09, 2020 4:15 pm
One bad/ugly thing is that you can't set the drawId buffer in VulkanRenderSystem::executeRenderPassDescriptorDelayedActions() as the location depends on the shader.
Don't worry. DrawID is mostly an Hlms thing. And if users want to use it, they can use GLSL
Hotshot5000 wrote: ↑Sun Aug 09, 2020 4:15 pm
What other samples should I test next? The pose sample, the PBSMaterial sample? I know not all of them work.
You can abort that