[DX11] Effect groups questions

Started by
3 comments, last by n3Xus 13 years, 11 months ago
Hello, I've just moved from DX10 to DX11 and I discovered that effect pools don't exist anymore. Now these "effect groups" have been introduced, which requires you to have all shaders #included into one file if you want to use effect groups, for sharing cbuffers for example(or at least that is how I understood it). I have come across this topic: http://forums.xna.com/forums/p/45724/274328.aspx In it someone says that you can't use effect groups any other way than including everything, that you want to share some stuff between, into one fx file so that you can group all techniques. It is also said that you could implement "effect pool" functionality on your own since the source code for effects had been given. I kinda don't want to include everything into one file, I want to compile more smaller shaders separately because it can take a while to compile everything once you get a high shader count and this makes writing new shader code a pain. My question is: has anyone managed to get the effect-pools-like functionality in DX11 without having to stuff all shaders into one file?
Advertisement
You could do this as a build step by preprocessing your effect files and assigns register mappings for all resources so that they are universally consistent. Or, use header files for resource declarations used in many effects, and provide the register mappings there. I'm not sure of any other simpler solutions to achieving the same end result.
I'm a bit confused about these register mapping, I never used them before.

I started of with DX10 shader programming, so HLSL only, never touched assembler GPU shader programming, so these register mappings are a totaly mistery to me; does anyone have any articles that explain them or should I just go and look into older DX SDKs (DX9, DX8) for explanation?

This is how I understand this mappings:

// someEffect1.fx
cbuffer myData
{
matrix ViewProjMaitrx : register(b);

};

// someEffect2.fx
cbuffer myData
{
matrix ViewProjMaitrx : register(b);

};

Or am I totally off?
You map constant buffers to registers, not the constants themselves. The registers available are cb0 through cb15.

Within a constant buffer, you can specify the packing for a constant using packoffset. Like this:
cbuffer myData : register (cb0){    float4x4 ViewProjMatrix : packoffset(c0);    float NearClip : packoffset(c4.x);    float NearClip : packoffset(c4.y);}
Ah, yes :D

Thank you both!

This topic is closed to new replies.

Advertisement