How to use Buffers in stride with sdsl

hi all,

I would like to know how to replicate the old shader workflow from beta.
How to setup a dynamicbuffer in gamma, and how to declare the input in a sdsl shader file.

the first thing you have to answer is what is the intended use? will you do custom low-level drawing like in beta dx11 without using any PBR/light features?

if so, the syntax is exactly the same as in HLSL. however, for float/2/3/4 you should use Buffer instead of StructuredBuffer.

the rgroup for buffers for custom drawing is called PerUpdate.

so you would write:

rgroup PerUpdate
{
    Buffer<float4> MyBuffer;
}

Tried with the example draw shader from the help patch, but no input pin is showing up…
VL treats the color as vec4 if I remove [Color], do I have to label the buffer it in a similar way?
Could you be so kind and post a small example patch that also shows how to setup the buffer node on the VL side ? I looked through the ShaderFX helppatches but could not find an example.

shader Sheeet_DrawFX : VS_PS_Base
{
[Color]
float4 Color = float4(1, 0, 0, 1);

rgroup PerUpdate
{
	Buffer<float4> MyBuffer;
}

override stage void VSMain()
{

    streams.ShadingPosition = mul(streams.Position, WorldViewProjection);
}

override stage void PSMain() 
{
    streams.Depth = 1;
    streams.ColorTarget = Color;
}

};

It looks like you don’t ever use MyBuffer, hence the compiler will optimize and not create a Pin

1 Like

Thanks for the hint, coming from beta I am not used to that. I got my Buffer input pin, now how do I create and fill this buffer? DynamicBuffer takes a datatype called “IHasMemory”, but I don’t find a node within the “IHasMemory” category, which lets me input data.

Unbenannt

you can just connect a sequence or spread

1 Like

lol eine schwere Geburt. The tooltip is a bit misleading. I know, still experimental.

thx sebl!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.