Slow shader compile time when using large arrays.

Started by
12 comments, last by unbird 9 years, 4 months ago

I am still curious if some one have any knowledge what the hell compilers are doing with those large arrays.

Advertisement
I'm curious, too.

kalle, you might reconsider. You say DX10 hardware, but you seem use the DX11 API. This is peculiar: structured buffers actually work with feature level 10 (and SM 4 shaders). I just did a minimal test with both hardware and reference device.

I'm curious, too.

kalle, you might reconsider. You say DX10 hardware, but you seem use the DX11 API. This is peculiar: structured buffers actually work with feature level 10 (and SM 4 shaders). I just did a minimal test with both hardware and reference device.

Thanks. Thats interesting behaviour. Documentation is bit scarce and just say.

http://msdn.microsoft.com/en-us/library/windows/desktop/ff471514%28v=vs.85%29.aspx

Shader Model 4 (Available for compute and pixel shaders in Direct3D 11 on some Direct3D 10 devices.)

We are already in early access so I need to be really careful not to cut anyone out that already has bought the game. Structured buffers would be superior of ease of use. I guess the performance should be similar with either tbuffer, Buffer or Structured Buffer?

If the reference device runs fine, you're probably good. But yeah, if you're game is out, you don't wish to break anything.

Can't tell you about performance implications. HLSL assembly looks similar if not identical, though. But with GPUs I wouldn't be surprised of anything.

And for a bit of convenience you can always abstract stuff with functions (GetTransform(uint index)), macros or defines in HLSL and use the lowest denominator for compatibility. Example: I found a similar compiler behaviour when playing with skinning. Here I switch between constant buffers and structured with a define.


#ifdef STRUCTUREDBUFFER
StructuredBuffer<Bone> Bones: register(t4);
#endif

cbuffer SkinningParameters : register(b4)
{
#ifndef STRUCTUREDBUFFER
    Bone Bones[MAX_BONES];
#endif
};
No change in the vertex shader needed, it just accesses Bones[index]. Buffer creation and binding is different, of course.

With the cast functions (asint(), asfloat()) you can also roll your own decoding.

This topic is closed to new replies.

Advertisement