mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 06:21:13 +01:00
fix(core): Blend factor must be one when blend op is min/max (#9110)
This commit is contained in:
1 parent
b09a919c6a
commit
aad2a00f4d
5 files changed
+40
-21
No files matched your search
@@ -175,6 +175,7 @@ depth_stencil: Some(wgpu::DepthStencilState::stencil(
|
||||
- Fixed calculation of the total number of bindings in a pipeline layout when validating against device limits. By @andyleiserson in [#8997](https://github.com/gfx-rs/wgpu/pull/8997).
|
||||
- Reject non-constructible types (runtime- and override-sized arrays, and structs containing non-constructible types) in more places where they should not be allowed. By @andyleiserson in [#8873](https://github.com/gfx-rs/wgpu/pull/8873).
|
||||
- The query set type for an occlusion query is now validated when opening the render pass, in addition to within the call to `beginOcclusionQuery`. By @andyleiserson in [#9086](https://github.com/gfx-rs/wgpu/pull/9086).
|
||||
- Require that the blend factor is `One` when the blend operation is `Min` or `Max`. The `BlendFactorOnUnsupportedTarget` error is now reported within `ColorStateError` rather than directly in `CreateRenderPipelineError`. By @andyleiserson in [#9110](https://github.com/gfx-rs/wgpu/pull/9110).
|
||||
|
||||
#### Vulkan
|
||||
- Fixed a variety of mesh shader SPIR-V writer issues from the original implementation. By @inner-daemons in [#8756](https://github.com/gfx-rs/wgpu/pull/8756)
|
||||
|
||||
@@ -60,7 +60,6 @@ webgpu:api,validation,render_pipeline,fragment_state:dual_source_blending,color_
|
||||
webgpu:api,validation,render_pipeline,fragment_state:dual_source_blending,use_blend_src:* // 62%, https://github.com/gfx-rs/wgpu/pull/8856
|
||||
webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets,blend:* // 95%, blend factors reading source alpha require vec4
|
||||
webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:* // 3%, color target without shader output requires writeMask=0
|
||||
webgpu:api,validation,render_pipeline,fragment_state:targets_blend:* // 0%, missing min/max blend factor validation
|
||||
webgpu:api,validation,render_pipeline,fragment_state:targets_write_mask:* // 50%, TypeError instead of validation error
|
||||
webgpu:api,validation,render_pipeline,inter_stage:* // 15%, inter-stage type validation gaps and interpolation default handling
|
||||
webgpu:api,validation,render_pipeline,misc:external_texture:* // 0%, no external texture in deno
|
||||
|
||||
@@ -246,6 +246,7 @@ webgpu:api,validation,render_pipeline,float32_blendable:*
|
||||
webgpu:api,validation,render_pipeline,fragment_state:color_target_exists:*
|
||||
webgpu:api,validation,render_pipeline,fragment_state:dual_source_blending,use_blend_src:*
|
||||
webgpu:api,validation,render_pipeline,fragment_state:limits,*
|
||||
webgpu:api,validation,render_pipeline,fragment_state:targets_blend:*
|
||||
webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:*
|
||||
webgpu:api,validation,render_pipeline,fragment_state:targets_format_is_color_format:*
|
||||
webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:*
|
||||
|
||||
@@ -4117,20 +4117,32 @@ impl Device {
|
||||
}
|
||||
|
||||
if let Some(blend_mode) = cs.blend {
|
||||
for factor in [
|
||||
blend_mode.color.src_factor,
|
||||
blend_mode.color.dst_factor,
|
||||
blend_mode.alpha.src_factor,
|
||||
blend_mode.alpha.dst_factor,
|
||||
] {
|
||||
if factor.ref_second_blend_source() {
|
||||
self.require_features(wgt::Features::DUAL_SOURCE_BLENDING)?;
|
||||
if i == 0 {
|
||||
dual_source_blending = true;
|
||||
break;
|
||||
} else {
|
||||
return Err(pipeline::CreateRenderPipelineError
|
||||
::BlendFactorOnUnsupportedTarget { factor, target: i as u32 });
|
||||
for component in [&blend_mode.color, &blend_mode.alpha] {
|
||||
for factor in [component.src_factor, component.dst_factor] {
|
||||
if factor.ref_second_blend_source() {
|
||||
self.require_features(wgt::Features::DUAL_SOURCE_BLENDING)?;
|
||||
if i == 0 {
|
||||
dual_source_blending = true;
|
||||
} else {
|
||||
break 'error Some(
|
||||
pipeline::ColorStateError::BlendFactorOnUnsupportedTarget {
|
||||
factor,
|
||||
target: i as u32,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if [wgt::BlendOperation::Min, wgt::BlendOperation::Max]
|
||||
.contains(&component.operation)
|
||||
&& factor != wgt::BlendFactor::One
|
||||
{
|
||||
break 'error Some(
|
||||
pipeline::ColorStateError::InvalidMinMaxBlendFactor {
|
||||
factor,
|
||||
target: i as u32,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -627,6 +627,18 @@ pub enum ColorStateError {
|
||||
},
|
||||
#[error("Invalid write mask {0:?}")]
|
||||
InvalidWriteMask(wgt::ColorWrites),
|
||||
#[error("Using the blend factor {factor:?} for render target {target} is not possible. Only the first render target may be used when dual-source blending.")]
|
||||
BlendFactorOnUnsupportedTarget {
|
||||
factor: wgt::BlendFactor,
|
||||
target: u32,
|
||||
},
|
||||
#[error(
|
||||
"Blend factor {factor:?} for render target {target} is not valid. Blend factor must be `one` when using min/max blend operations."
|
||||
)]
|
||||
InvalidMinMaxBlendFactor {
|
||||
factor: wgt::BlendFactor,
|
||||
target: u32,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Error)]
|
||||
@@ -720,11 +732,6 @@ pub enum CreateRenderPipelineError {
|
||||
},
|
||||
#[error("In the provided shader, the type given for group {group} binding {binding} has a size of {size}. As the device does not support `DownlevelFlags::BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED`, the type must have a size that is a multiple of 16 bytes.")]
|
||||
UnalignedShader { group: u32, binding: u32, size: u64 },
|
||||
#[error("Using the blend factor {factor:?} for render target {target} is not possible. Only the first render target may be used when dual-source blending.")]
|
||||
BlendFactorOnUnsupportedTarget {
|
||||
factor: wgt::BlendFactor,
|
||||
target: u32,
|
||||
},
|
||||
#[error("{}", concat!(
|
||||
"At least one color attachment or depth-stencil attachment was expected, ",
|
||||
"but no render target for the pipeline was specified."
|
||||
@@ -760,7 +767,6 @@ impl WebGpuError for CreateRenderPipelineError {
|
||||
| Self::ConservativeRasterizationNonFillPolygonMode
|
||||
| Self::Stage { .. }
|
||||
| Self::UnalignedShader { .. }
|
||||
| Self::BlendFactorOnUnsupportedTarget { .. }
|
||||
| Self::NoTargetSpecified
|
||||
| Self::PipelineConstants { .. }
|
||||
| Self::VertexAttributeStrideTooLarge { .. } => return ErrorType::Validation,
|
||||
|
||||
Reference in new issue
Block a user