summaryrefslogtreecommitdiff
path: root/client/src/render/scene
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/render/scene')
-rw-r--r--client/src/render/scene/draw.rs5
-rw-r--r--client/src/render/scene/mod.rs16
-rw-r--r--client/src/render/scene/pipelines.rs12
-rw-r--r--client/src/render/scene/textures.rs2
4 files changed, 16 insertions, 19 deletions
diff --git a/client/src/render/scene/draw.rs b/client/src/render/scene/draw.rs
index d133d3b..1109401 100644
--- a/client/src/render/scene/draw.rs
+++ b/client/src/render/scene/draw.rs
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-use super::{demand_map::DemandMap, RPrefab};
+use super::{RPrefab, demand_map::DemandMap};
use glam::{EulerRot, Mat3, Mat4};
use std::sync::Arc;
use weareshared::{packets::Resource, resources::Prefab, tree::SceneTree};
@@ -30,6 +30,7 @@ impl ScenePipeline {
&mut self,
commands: &mut CommandEncoder,
target: &TextureView,
+ resolve_target: Option<&TextureView>,
depth: &TextureView,
scene: &SceneTree,
prefabs: &DemandMap<Resource<Prefab>, Arc<RPrefab>>,
@@ -40,7 +41,7 @@ impl ScenePipeline {
label: None,
color_attachments: &[Some(RenderPassColorAttachment {
view: target,
- resolve_target: None,
+ resolve_target,
ops: Operations {
store: StoreOp::Store,
load: LoadOp::Clear(Color {
diff --git a/client/src/render/scene/mod.rs b/client/src/render/scene/mod.rs
index 7471fc8..ad7e0ce 100644
--- a/client/src/render/scene/mod.rs
+++ b/client/src/render/scene/mod.rs
@@ -21,7 +21,8 @@ pub mod pipelines;
pub mod textures;
pub mod vertex_buffers;
-use crate::{armature::RArmature, download::Downloader, shaders::SceneShaders};
+use super::{shaders::SceneShaders, GraphicsConfig};
+use crate::{armature::RArmature, download::Downloader};
use anyhow::Result;
use bytemuck::{Pod, Zeroable};
use demand_map::DemandMap;
@@ -42,11 +43,6 @@ use wgpu::{
util::{BufferInitDescriptor, DeviceExt},
};
-struct GraphicsConfig {
- max_anisotropy: u16,
- max_mip_count: u32,
-}
-
pub struct ScenePreparer {
device: Arc<Device>,
queue: Arc<Queue>,
@@ -143,13 +139,11 @@ impl ScenePreparer {
queue: Arc<Queue>,
render_format: TextureFormat,
downloader: Arc<Downloader>,
+ config: GraphicsConfig,
) -> Self {
Self {
render_format,
- config: GraphicsConfig {
- max_anisotropy: 16,
- max_mip_count: 16,
- },
+ config,
layouts: SceneBgLayouts::load(&device),
shaders: SceneShaders::load(&device),
device,
@@ -210,7 +204,7 @@ impl ScenePreparer {
for spec in self.pipelines.needed() {
self.pipelines.insert(
spec.clone(),
- Arc::new(spec.create(&self.device, &self.layouts, &self.shaders)),
+ Arc::new(spec.create(&self.device, &self.layouts, &self.shaders, &self.config)),
0,
);
}
diff --git a/client/src/render/scene/pipelines.rs b/client/src/render/scene/pipelines.rs
index dfc5d19..53064c9 100644
--- a/client/src/render/scene/pipelines.rs
+++ b/client/src/render/scene/pipelines.rs
@@ -14,6 +14,8 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+use super::{GraphicsConfig, PipelineSpec};
+use crate::render::shaders::SceneShaders;
use wgpu::{
BindGroupLayout, BindGroupLayoutDescriptor, BindGroupLayoutEntry, BindingType, BlendState,
BufferBindingType, ColorTargetState, ColorWrites, CompareFunction, DepthBiasState,
@@ -25,10 +27,6 @@ use wgpu::{
VertexStepMode,
};
-use crate::shaders::SceneShaders;
-
-use super::PipelineSpec;
-
pub struct SceneBgLayouts {
pub texture: BindGroupLayout,
pub material: BindGroupLayout,
@@ -95,6 +93,7 @@ impl PipelineSpec {
device: &Device,
layouts: &SceneBgLayouts,
shaders: &SceneShaders,
+ config: &GraphicsConfig,
) -> RenderPipeline {
let pipeline_layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
label: None,
@@ -188,7 +187,10 @@ impl PipelineSpec {
bias: DepthBiasState::default(),
stencil: StencilState::default(),
}),
- multisample: MultisampleState::default(),
+ multisample: MultisampleState {
+ count: config.sample_count,
+ ..Default::default()
+ },
multiview: None,
cache: None,
})
diff --git a/client/src/render/scene/textures.rs b/client/src/render/scene/textures.rs
index 463e8f1..f85f21f 100644
--- a/client/src/render/scene/textures.rs
+++ b/client/src/render/scene/textures.rs
@@ -32,7 +32,7 @@ pub struct MipGenerationPipeline {
}
impl MipGenerationPipeline {
pub fn load(device: &Device, format: TextureFormat) -> Self {
- let shader = device.create_shader_module(include_wgsl!("../../shaders/texture_copy.wgsl"));
+ let shader = device.create_shader_module(include_wgsl!("../shaders/texture_copy.wgsl"));
let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: Some("mip generator"),
layout: None,