GPU: Change inheritance of depth write and default values
This new inheritance behavior is more beneficial for the metal Backend. Also change the default depth write behavior of shaders to be unchanged. This makes fragment shader depth amendment more explicit. This also add the missing depth_write for metal kernels.
This commit is contained in:
@@ -68,7 +68,9 @@ void ShaderCreateInfo::finalize()
|
||||
if (info.early_fragment_test_) {
|
||||
early_fragment_test_ = true;
|
||||
}
|
||||
if (info.depth_write_ != DepthWrite::ANY) {
|
||||
/* Override depth-write with additional info if this specifies a writing mode
|
||||
* other than the default. */
|
||||
if (info.depth_write_ != DepthWrite::UNCHANGED) {
|
||||
depth_write_ = info.depth_write_;
|
||||
}
|
||||
|
||||
|
||||
@@ -189,10 +189,11 @@ ENUM_OPERATORS(BuiltinBits, BuiltinBits::USE_DEBUG_PRINT);
|
||||
* https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_conservative_depth.txt
|
||||
*/
|
||||
enum class DepthWrite {
|
||||
ANY = 0,
|
||||
/* UNCHANGED specified as default to indicate gl_FragDepth is not used. */
|
||||
UNCHANGED = 0,
|
||||
ANY,
|
||||
GREATER,
|
||||
LESS,
|
||||
UNCHANGED,
|
||||
};
|
||||
|
||||
/* Samplers & images. */
|
||||
@@ -343,7 +344,7 @@ struct ShaderCreateInfo {
|
||||
/** If true, force the use of the GL shader introspection for resource location. */
|
||||
bool legacy_resource_location_ = false;
|
||||
/** Allow optimization when fragment shader writes to `gl_FragDepth`. */
|
||||
DepthWrite depth_write_ = DepthWrite::ANY;
|
||||
DepthWrite depth_write_ = DepthWrite::UNCHANGED;
|
||||
/**
|
||||
* Maximum length of all the resource names including each null terminator.
|
||||
* Only for names used by #gpu::ShaderInterface.
|
||||
|
||||
@@ -17,6 +17,7 @@ GPU_SHADER_CREATE_INFO(depth_2d_update_info_base)
|
||||
.push_constant(Type::VEC2, "size")
|
||||
.push_constant(Type::INT, "mip")
|
||||
.sampler(0, ImageType::FLOAT_2D, "source_data", Frequency::PASS)
|
||||
.depth_write(DepthWrite::ANY)
|
||||
.vertex_source("depth_2d_update_vert.glsl");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(depth_2d_update_float)
|
||||
|
||||
Reference in New Issue
Block a user