Fix texture format error when HDR is enabled.
This commit is contained in:
parent
a8233ff7fa
commit
5f06c32bcf
@ -146,7 +146,8 @@ pub(crate) fn queue_outline_volume_mesh(
|
|||||||
PassType::Opaque
|
PassType::Opaque
|
||||||
})
|
})
|
||||||
.with_depth_mode(volume_flags.depth_mode)
|
.with_depth_mode(volume_flags.depth_mode)
|
||||||
.with_offset_zero(volume_uniform.offset == 0.0);
|
.with_offset_zero(volume_uniform.offset == 0.0)
|
||||||
|
.with_hdr_format(view.hdr);
|
||||||
let pipeline = pipelines
|
let pipeline = pipelines
|
||||||
.specialize(&mut pipeline_cache, &outline_pipeline, key, &mesh.layout)
|
.specialize(&mut pipeline_cache, &outline_pipeline, key, &mesh.layout)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -11,6 +11,7 @@ use bevy::render::render_resource::{
|
|||||||
};
|
};
|
||||||
use bevy::render::renderer::RenderDevice;
|
use bevy::render::renderer::RenderDevice;
|
||||||
use bevy::render::texture::BevyDefault;
|
use bevy::render::texture::BevyDefault;
|
||||||
|
use bevy::render::view::ViewTarget;
|
||||||
use bevy::{
|
use bevy::{
|
||||||
pbr::MeshPipeline,
|
pbr::MeshPipeline,
|
||||||
render::{
|
render::{
|
||||||
@ -53,6 +54,7 @@ impl PipelineKey {
|
|||||||
pass_type_int, set_pass_type_int: 10, 9;
|
pass_type_int, set_pass_type_int: 10, 9;
|
||||||
depth_mode_int, set_depth_mode_int: 12, 11;
|
depth_mode_int, set_depth_mode_int: 12, 11;
|
||||||
pub offset_zero, set_offset_zero: 13;
|
pub offset_zero, set_offset_zero: 13;
|
||||||
|
pub hdr_format, set_hdr_format: 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn new() -> Self {
|
pub(crate) fn new() -> Self {
|
||||||
@ -98,11 +100,6 @@ impl PipelineKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn with_offset_zero(mut self, offset_zero: bool) -> Self {
|
|
||||||
self.set_offset_zero(offset_zero);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn with_depth_mode(mut self, depth_mode: DepthMode) -> Self {
|
pub(crate) fn with_depth_mode(mut self, depth_mode: DepthMode) -> Self {
|
||||||
self.set_depth_mode_int(depth_mode as u32);
|
self.set_depth_mode_int(depth_mode as u32);
|
||||||
self
|
self
|
||||||
@ -115,6 +112,16 @@ impl PipelineKey {
|
|||||||
x => panic!("Invalid value for DepthMode: {}", x),
|
x => panic!("Invalid value for DepthMode: {}", x),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn with_offset_zero(mut self, offset_zero: bool) -> Self {
|
||||||
|
self.set_offset_zero(offset_zero);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn with_hdr_format(mut self, hdr_format: bool) -> Self {
|
||||||
|
self.set_hdr_format(hdr_format);
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Resource)]
|
#[derive(Resource)]
|
||||||
@ -251,7 +258,11 @@ impl SpecializedMeshPipeline for OutlinePipeline {
|
|||||||
PassType::Opaque | PassType::Transparent => {
|
PassType::Opaque | PassType::Transparent => {
|
||||||
fragment_defs.push("VOLUME".to_string());
|
fragment_defs.push("VOLUME".to_string());
|
||||||
targets.push(Some(ColorTargetState {
|
targets.push(Some(ColorTargetState {
|
||||||
format: TextureFormat::bevy_default(),
|
format: if key.hdr_format() {
|
||||||
|
ViewTarget::TEXTURE_FORMAT_HDR
|
||||||
|
} else {
|
||||||
|
TextureFormat::bevy_default()
|
||||||
|
},
|
||||||
blend: Some(if key.pass_type() == PassType::Transparent {
|
blend: Some(if key.pass_type() == PassType::Transparent {
|
||||||
BlendState::ALPHA_BLENDING
|
BlendState::ALPHA_BLENDING
|
||||||
} else {
|
} else {
|
||||||
@ -299,7 +310,7 @@ impl SpecializedMeshPipeline for OutlinePipeline {
|
|||||||
mask: !0,
|
mask: !0,
|
||||||
alpha_to_coverage_enabled: false,
|
alpha_to_coverage_enabled: false,
|
||||||
},
|
},
|
||||||
label: Some(Cow::Borrowed("outline_stencil_pipeline")),
|
label: Some(Cow::Borrowed("outline_pipeline")),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user