Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

discard (sm4 - asm)

Conditionally flag results of Pixel Shader to be discarded when the end of the program is reached.

discard{_z|_nz} src0.select_component

 

ItemDescription

src0

[in] The value that determines whether to discard the current pixel being processed.

 

Remarks

This instruction flags the current pixel as terminated, while continuing execution, so that other pixels executing in parallel may obtain derivatives if necessary. Even though execution continues, all Pixel Shader output writes before or after the discard instruction are discarded.

For discard_z, if all bits in src0.select_component are zero, then the pixel is discarded.

For discard_nz, if any bits in src0.select_component are nonzero, then the pixel is discarded.

In addition, the discard instruction can be present inside any flow control construct.

Multiple discard instructions may be present in a Shader, and if any is executed, the pixel is terminated.

This instruction applies to the following shader stages:

Vertex ShaderGeometry ShaderPixel Shader
x

 

Minimum Shader Model

This function is supported in the following shader models.

Shader ModelSupported
Shader Model 5 yes
Shader Model 4.1 yes
Shader Model 4 yes
Shader Model 3 (DirectX HLSL) no
Shader Model 2 (DirectX HLSL) no
Shader Model 1 (DirectX HLSL) no

 

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.