🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Issue with directx12 root constant buffer on AMD card

Started by
0 comments, last by he3117 1 year, 2 months ago

I'm trying to implement bind-less rendering in directx12 but I got invalid output on AMD RX580.

I only render a full screen triangle and pass the pixel color as root constants parameters. blending is off.

Root constants are all set to 1.0 so pixel color should be white. It works correctly on NVIDIA cards but I got a gradient instead on AMD 580RX. In PIX debug pixel shader reads 0 for constant parameters(instead of 1.0) but on output I got a gradient like pixel position or UV.

I can't find any reason for this output. Can you explain what is happening here?

#define BindlessRootSignature           \
    "RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | SAMPLER_HEAP_DIRECTLY_INDEXED)," \
    "RootConstants(b0, num32BitConstants=8, visibility = SHADER_VISIBILITY_ALL)," \
    "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_POINT, addressU = TEXTURE_ADDRESS_CLAMP, addressV = TEXTURE_ADDRESS_CLAMP, addressW = TEXTURE_ADDRESS_CLAMP, mipLODBias = 0.0f, minLOD = 0.0f, maxLOD = 100.0f)," \
    "StaticSampler(s1, filter = FILTER_MIN_MAG_MIP_POINT, addressU = TEXTURE_ADDRESS_WRAP, addressV = TEXTURE_ADDRESS_WRAP, addressW = TEXTURE_ADDRESS_WRAP,  mipLODBias = 0.0f, minLOD = 0.0f, maxLOD = 100.0f)," \
    "StaticSampler(s2, filter = FILTER_MIN_MAG_MIP_LINEAR, addressU = TEXTURE_ADDRESS_WRAP, addressV = TEXTURE_ADDRESS_WRAP, addressW = TEXTURE_ADDRESS_WRAP,  mipLODBias = 0.0f, minLOD = 0.0f, maxLOD = 100.0f), " \
    "StaticSampler(s3, filter = FILTER_MIN_MAG_LINEAR_MIP_POINT, addressU = TEXTURE_ADDRESS_CLAMP, addressV = TEXTURE_ADDRESS_CLAMP, addressW = TEXTURE_ADDRESS_WRAP,  mipLODBias = 0.0f, minLOD = 0.0f, maxLOD = 100.0f), " \
    "StaticSampler(s4, filter = FILTER_MIN_MAG_LINEAR_MIP_POINT, addressU = TEXTURE_ADDRESS_CLAMP, addressV = TEXTURE_ADDRESS_CLAMP, addressW = TEXTURE_ADDRESS_CLAMP)," \
    "StaticSampler(s5, filter = FILTER_MIN_MAG_LINEAR_MIP_POINT, addressU = TEXTURE_ADDRESS_WRAP, addressV = TEXTURE_ADDRESS_WRAP, addressW = TEXTURE_ADDRESS_WRAP)," \
    "StaticSampler(s6, filter = FILTER_MIN_MAG_POINT_MIP_LINEAR, addressU = TEXTURE_ADDRESS_WRAP, addressV = TEXTURE_ADDRESS_WRAP, addressW = TEXTURE_ADDRESS_WRAP), " \
    "StaticSampler(s7, filter = FILTER_MIN_MAG_POINT_MIP_LINEAR, addressU = TEXTURE_ADDRESS_CLAMP, addressV = TEXTURE_ADDRESS_CLAMP, addressW = TEXTURE_ADDRESS_CLAMP), " \
    "StaticSampler(s8, filter = FILTER_ANISOTROPIC, maxAnisotropy = 16)"

// Samplers
SamplerState pointClampSampler : register(s0);
SamplerState pointWrapSampler : register(s1);
SamplerState linearWrapSampler : register(s2);
SamplerState linearClampSampler: register(s3);
SamplerState minMapLinearMipPointClampSampler : register(s4);
SamplerState minMapLinearMipPointWrapSampler : register(s5);
SamplerState minMapPointMipLinearClampSampler : register(s6);
SamplerState minMapPointMipLinearWrapSampler : register(s7);
SamplerState anisotropicSampler : register(s8);

struct SimpleFullScreenVertexShaderOutput
{
    float4 Position : SV_POSITION0;
    float2 UV : TEXCOORD0;
};


[RootSignature(BindlessRootSignature)]
SimpleFullScreenVertexShaderOutput SimpleFullScreenVertexShaderFunction(uint id : SV_VertexID)
{
    float2 uv = float2((id << 1) & 2, id & 2);
    
    SimpleFullScreenVertexShaderOutput output;
    output.Position = float4(uv * float2(2, -2) + float2(-1, 1), 0, 1);
    output.UV = uv;

    return output;
}



struct RenderData
{
    float4 color0;
    float4 color1;
    
};

ConstantBuffer<RenderData> m_myData : register(b0);

/***************************
pixel shader
******************************/
[RootSignature(BindlessRootSignature)]
float4 PixelShaderFunction(SimpleFullScreenVertexShaderOutput input) : SV_TARGET0
{
	float4 C=m_myData.color0;
	C.a=1;
	return C;
	
}

This topic is closed to new replies.

Advertisement