aconstlink / natus

[Discontinued] Software Framework for Audio/Visual/Interactive Real-Time Applications
https://aconstlink.de
MIT License
0 stars 0 forks source link

HLSL Code Generator Stage to Stage Data Naming Convention #332

Closed aconstlink closed 1 year ago

aconstlink commented 1 year ago

The HLSL generator names its "varying" data structures in the order the shaders come in. If the nsl shaders are not in the "right" graphics pipeline stage order, This could lead to problems.

So we need to sort the shader types before naming the structs.

For example, passing data from the vertex shader on to the pixel shader should look like this

// Vertex Shader
struct IA_TO_VS {};
struct VS_TO_PS{};
...
VS_TO_PS vs_shader( IA_TO_VS input )
{
  VS_TO_PS output ;
...
  return output ;
}

// Pixel Shader
struct VS_TO_PS{};
float4 ps_shader( VS_TO_PS intput ) {...}

The geometry shader looks a little bit different, but the process should be similar there. The HLSL geometry shader code generation does not produce the correct struct name so this is required anyway.

Similar actions had been taken for the GLSL generator here #330 which is mainly for #327.

aconstlink commented 1 year ago

What a mess. Should be much simpler to include tessellation shaders later on!