I’ve multirendertarget in my deferred pipeline. Curently I am utilizing independnt RTV mixing to selectively output or not an object to those RTV utilizing the alpha channel. Works superb. However I want to use the alpha channel bits for one thing else.
I’ve begin to consider geometry shader to do the identical. Ranging from what we did for rendering cubemap shadow I’ve added a check based mostly on a Flag worth set within the shader contantbuffer related to the item being rendered. Relying on that Flag I would love the item to be drawn in goal 0 and a pair of however not goal 1 for exemple.
However the check is all the time adverse (nothing drawn). The identical buffer fixed is utilized in one other shader so I am certain it’s appropriately stuffed.
Did somebody is aware of what to do?
right here what I am doing (different structs and inputs not proven however apparent):
cbuffer cbMesh : register(b1)
{
matrix World;
float4 FactorColor;
dword Flag;
float3 pad;
}
struct GS_INPUT
{
float4 Pos : SV_POSITION;
};
struct PS_CUBEMAP_IN
{
float4 Pos : SV_POSITION;
uint RTIndex : SV_RenderTargetArrayIndex;
};
GS_INPUT VS_CubeMap( VS_INPUT enter )
{
GS_INPUT output = (GS_INPUT)0.0f;
output.Pos = mul( float4(enter.Pos,1), World );
return output;
}
#outline SomeValue = 1
[maxvertexcount(18)]
void GS_CubeMap( triangle GS_INPUT enter[3], inout TriangleStream<PS_CUBEMAP_IN> CubeMapStream )
{
for( int f = 0; f < 6; ++f )
{
if ((f<3)&&(Flag&SomeValue)) //works if Flag&SomeValue eliminated
{
matrix M = LightViewProjCube[LightIndex][f];
PS_CUBEMAP_IN output;
output.RTIndex = f;
for( int v = 0; v < 3; v++ )
{
output.Pos = mul( enter[v].Pos, M );
CubeMapStream.Append( output );
}
CubeMapStream.RestartStrip();
}
}
}