Skip to main content
fixed typos, added code markdown, added HLSL tag
Source Link
Pikalek
  • 13.4k
  • 5
  • 49
  • 54

Proper What is the proper way to write a pixel shader that only ouputoutputs depth?

A Quick one. I have an effect that I want to only write to depth.
commandList->OMSetRenderTargets(0, nullptr, FALSE, &m_mainDepthStencilDescriptorHandle.getCpuHandle());

Pixel shader looklooks like this

struct VS_OUTPUT
{
    float4 position: SV_POSITION;
};

float4 main(VS_OUTPUT input) : SV_TARGET
{
    return float4(0.0f, 0.0f, 0.0f, 0.0f);
}

I do not use the SV_TARGET iSV_TARGET I am only interested in depth writtingwriting. What is the proper way to tell HLSL about it?

Proper way to write a pixel shader that only ouput depth

A Quick one. I have an effect that only write to depth.
commandList->OMSetRenderTargets(0, nullptr, FALSE, &m_mainDepthStencilDescriptorHandle.getCpuHandle());

Pixel shader look like this

struct VS_OUTPUT
{
    float4 position: SV_POSITION;
};

float4 main(VS_OUTPUT input) : SV_TARGET
{
    return float4(0.0f, 0.0f, 0.0f, 0.0f);
}

I do not use the SV_TARGET i am only interested in depth writting. What is the proper way to tell HLSL about it?

What is the proper way to write a pixel shader that only outputs depth?

I have an effect that I want to only write to depth.
commandList->OMSetRenderTargets(0, nullptr, FALSE, &m_mainDepthStencilDescriptorHandle.getCpuHandle());

Pixel shader looks like this

struct VS_OUTPUT
{
    float4 position: SV_POSITION;
};

float4 main(VS_OUTPUT input) : SV_TARGET
{
    return float4(0.0f, 0.0f, 0.0f, 0.0f);
}

I do not use the SV_TARGET I am only interested in depth writing. What is the proper way to tell HLSL about it?

Source Link

Proper way to write a pixel shader that only ouput depth

A Quick one. I have an effect that only write to depth.
commandList->OMSetRenderTargets(0, nullptr, FALSE, &m_mainDepthStencilDescriptorHandle.getCpuHandle());

Pixel shader look like this

struct VS_OUTPUT
{
    float4 position: SV_POSITION;
};

float4 main(VS_OUTPUT input) : SV_TARGET
{
    return float4(0.0f, 0.0f, 0.0f, 0.0f);
}

I do not use the SV_TARGET i am only interested in depth writting. What is the proper way to tell HLSL about it?