From 6e44fbe8a4f2189fe6b8c76a3f1a64196e102e47 Mon Sep 17 00:00:00 2001 From: Dmitry Stepanov Date: Fri, 4 Oct 2024 19:40:41 +0300 Subject: [PATCH] move gl-specific graphics server parts into its own module --- editor/src/highlight.rs | 3 +- editor/src/overlay.rs | 2 +- fyrox-graphics/src/geometry_buffer.rs | 3 +- fyrox-graphics/src/gl/buffer.rs | 3 +- fyrox-graphics/src/gl/framebuffer.rs | 3 +- fyrox-graphics/src/gl/mod.rs | 5 ++ fyrox-graphics/src/gl/query.rs | 2 +- fyrox-graphics/src/{state.rs => gl/server.rs} | 63 +------------ fyrox-graphics/src/gl/texture.rs | 3 +- fyrox-graphics/src/gpu_program.rs | 2 +- fyrox-graphics/src/lib.rs | 2 +- fyrox-graphics/src/pixel_buffer.rs | 3 +- fyrox-graphics/src/server.rs | 90 +++++++++++++++++++ fyrox-impl/src/renderer/bloom/blur.rs | 3 +- fyrox-impl/src/renderer/bloom/mod.rs | 3 +- fyrox-impl/src/renderer/bundle.rs | 2 +- fyrox-impl/src/renderer/cache/geometry.rs | 2 +- fyrox-impl/src/renderer/cache/shader.rs | 2 +- fyrox-impl/src/renderer/cache/texture.rs | 4 +- fyrox-impl/src/renderer/cache/uniform.rs | 2 +- fyrox-impl/src/renderer/debug_renderer.rs | 4 +- fyrox-impl/src/renderer/flat_shader.rs | 2 +- fyrox-impl/src/renderer/forward_renderer.rs | 4 +- fyrox-impl/src/renderer/framework/mod.rs | 2 +- fyrox-impl/src/renderer/fxaa.rs | 3 +- fyrox-impl/src/renderer/gbuffer/decal.rs | 2 +- fyrox-impl/src/renderer/gbuffer/mod.rs | 4 +- fyrox-impl/src/renderer/hdr/adaptation.rs | 2 +- fyrox-impl/src/renderer/hdr/downscale.rs | 2 +- fyrox-impl/src/renderer/hdr/luminance.rs | 2 +- fyrox-impl/src/renderer/hdr/map.rs | 2 +- fyrox-impl/src/renderer/hdr/mod.rs | 4 +- fyrox-impl/src/renderer/light/ambient.rs | 2 +- fyrox-impl/src/renderer/light/directional.rs | 2 +- fyrox-impl/src/renderer/light/mod.rs | 2 +- fyrox-impl/src/renderer/light/point.rs | 2 +- fyrox-impl/src/renderer/light/spot.rs | 2 +- fyrox-impl/src/renderer/light_volume.rs | 3 +- fyrox-impl/src/renderer/mod.rs | 4 +- fyrox-impl/src/renderer/occlusion/mod.rs | 3 +- .../src/renderer/occlusion/optimizer.rs | 4 +- fyrox-impl/src/renderer/shadow/csm.rs | 4 +- fyrox-impl/src/renderer/shadow/point.rs | 4 +- fyrox-impl/src/renderer/shadow/spot.rs | 4 +- fyrox-impl/src/renderer/skybox_shader.rs | 2 +- fyrox-impl/src/renderer/ssao/blur.rs | 3 +- fyrox-impl/src/renderer/ssao/mod.rs | 3 +- fyrox-impl/src/renderer/storage.rs | 4 +- fyrox-impl/src/renderer/ui_renderer.rs | 2 +- fyrox-impl/src/renderer/visibility.rs | 4 +- 50 files changed, 169 insertions(+), 120 deletions(-) rename fyrox-graphics/src/{state.rs => gl/server.rs} (95%) create mode 100644 fyrox-graphics/src/server.rs diff --git a/editor/src/highlight.rs b/editor/src/highlight.rs index b19b68e95..c79a365e9 100644 --- a/editor/src/highlight.rs +++ b/editor/src/highlight.rs @@ -38,12 +38,13 @@ use crate::{ Attachment, AttachmentKind, FrameBuffer, ResourceBindGroup, ResourceBinding, }, geometry_buffer::GeometryBuffer, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, gpu_texture::{ Coordinate, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::{GlGraphicsServer, GraphicsServer}, + server::GraphicsServer, uniform::StaticUniformBuffer, BlendFactor, BlendFunc, BlendParameters, CompareFunc, DrawParameters, ElementRange, GeometryBufferExt, diff --git a/editor/src/overlay.rs b/editor/src/overlay.rs index 91afb357c..47d26cd6e 100644 --- a/editor/src/overlay.rs +++ b/editor/src/overlay.rs @@ -27,8 +27,8 @@ use crate::{ error::FrameworkError, framebuffer::{ResourceBindGroup, ResourceBinding}, geometry_buffer::GeometryBuffer, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::GlGraphicsServer, uniform::StaticUniformBuffer, BlendFactor, BlendFunc, BlendParameters, CompareFunc, DrawParameters, ElementRange, GeometryBufferExt, diff --git a/fyrox-graphics/src/geometry_buffer.rs b/fyrox-graphics/src/geometry_buffer.rs index 0191eaa0e..e9508ed24 100644 --- a/fyrox-graphics/src/geometry_buffer.rs +++ b/fyrox-graphics/src/geometry_buffer.rs @@ -18,12 +18,13 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +use crate::gl::server::GlGraphicsServer; +use crate::gl::ToGlConstant; use crate::{ buffer::{Buffer, BufferKind, BufferUsage}, core::{array_as_u8_slice, math::TriangleDefinition}, error::FrameworkError, gl::buffer::GlBuffer, - state::{GlGraphicsServer, ToGlConstant}, ElementKind, ElementRange, }; use glow::HasContext; diff --git a/fyrox-graphics/src/gl/buffer.rs b/fyrox-graphics/src/gl/buffer.rs index ce4d6dedf..d1e521610 100644 --- a/fyrox-graphics/src/gl/buffer.rs +++ b/fyrox-graphics/src/gl/buffer.rs @@ -18,10 +18,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +use crate::gl::server::GlGraphicsServer; +use crate::gl::ToGlConstant; use crate::{ buffer::{Buffer, BufferKind, BufferUsage}, error::FrameworkError, - state::{GlGraphicsServer, ToGlConstant}, }; use glow::HasContext; use std::any::Any; diff --git a/fyrox-graphics/src/gl/framebuffer.rs b/fyrox-graphics/src/gl/framebuffer.rs index 82bd3c76c..0123d6ee3 100644 --- a/fyrox-graphics/src/gl/framebuffer.rs +++ b/fyrox-graphics/src/gl/framebuffer.rs @@ -19,6 +19,8 @@ // SOFTWARE. use crate::framebuffer::ResourceBindGroup; +use crate::gl::server::GlGraphicsServer; +use crate::gl::ToGlConstant; use crate::{ buffer::{Buffer, BufferKind}, core::{color::Color, math::Rect}, @@ -28,7 +30,6 @@ use crate::{ gl::{buffer::GlBuffer, texture::GlTexture}, gpu_program::{GpuProgram, GpuProgramBinding}, gpu_texture::{CubeMapFace, GpuTexture, GpuTextureKind, PixelElementKind}, - state::{GlGraphicsServer, ToGlConstant}, ColorMask, DrawParameters, ElementRange, }; use glow::HasContext; diff --git a/fyrox-graphics/src/gl/mod.rs b/fyrox-graphics/src/gl/mod.rs index 26ddac987..782720aa3 100644 --- a/fyrox-graphics/src/gl/mod.rs +++ b/fyrox-graphics/src/gl/mod.rs @@ -21,4 +21,9 @@ pub mod buffer; pub mod framebuffer; pub mod query; +pub mod server; pub mod texture; + +pub trait ToGlConstant { + fn into_gl(self) -> u32; +} diff --git a/fyrox-graphics/src/gl/query.rs b/fyrox-graphics/src/gl/query.rs index d6ebde727..0eae8b2b0 100644 --- a/fyrox-graphics/src/gl/query.rs +++ b/fyrox-graphics/src/gl/query.rs @@ -18,10 +18,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +use crate::gl::server::GlGraphicsServer; use crate::{ error::FrameworkError, query::{Query, QueryKind, QueryResult}, - state::GlGraphicsServer, }; use glow::HasContext; use std::any::Any; diff --git a/fyrox-graphics/src/state.rs b/fyrox-graphics/src/gl/server.rs similarity index 95% rename from fyrox-graphics/src/state.rs rename to fyrox-graphics/src/gl/server.rs index 1aaea8aeb..551a87bec 100644 --- a/fyrox-graphics/src/state.rs +++ b/fyrox-graphics/src/gl/server.rs @@ -18,6 +18,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +use crate::gl::ToGlConstant; +use crate::server::{GraphicsServer, ServerCapabilities}; use crate::{ buffer::{Buffer, BufferKind, BufferUsage}, core::{color::Color, log::Log, math::Rect}, @@ -47,7 +49,6 @@ use glutin_winit::{DisplayBuilder, GlWindow}; use raw_window_handle::HasRawWindowHandle; use std::any::Any; use std::cell::RefCell; -use std::fmt::{Display, Formatter}; use std::ops::DerefMut; use std::rc::{Rc, Weak}; #[cfg(not(target_arch = "wasm32"))] @@ -57,10 +58,6 @@ use winit::{ window::{Window, WindowBuilder}, }; -pub trait ToGlConstant { - fn into_gl(self) -> u32; -} - impl ToGlConstant for PolygonFace { fn into_gl(self) -> u32 { match self { @@ -1053,62 +1050,6 @@ impl GlGraphicsServer { } } -pub struct ServerCapabilities { - pub max_uniform_block_size: usize, - pub uniform_buffer_offset_alignment: usize, -} - -impl Display for ServerCapabilities { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - writeln!( - f, - "\tMax Uniform Block Size: {}", - self.max_uniform_block_size - )?; - writeln!( - f, - "\tUniform Block Offset Alignment: {}", - self.uniform_buffer_offset_alignment - )?; - Ok(()) - } -} - -pub trait GraphicsServer: Any { - fn create_buffer( - &self, - size: usize, - buffer_kind: BufferKind, - buffer_usage: BufferUsage, - ) -> Result, FrameworkError>; - fn create_texture( - &self, - kind: GpuTextureKind, - pixel_kind: PixelKind, - min_filter: MinificationFilter, - mag_filter: MagnificationFilter, - mip_count: usize, - data: Option<&[u8]>, - ) -> Result>, FrameworkError>; - fn create_frame_buffer( - &self, - depth_attachment: Option, - color_attachments: Vec, - ) -> Result, FrameworkError>; - fn back_buffer(&self) -> Box; - fn create_query(&self) -> Result, FrameworkError>; - fn as_any(&self) -> &dyn Any; - fn as_any_mut(&mut self) -> &mut dyn Any; - fn weak(self: Rc) -> Weak; - fn flush(&self); - fn finish(&self); - fn invalidate_resource_bindings_cache(&self); - fn pipeline_statistics(&self) -> PipelineStatistics; - fn swap_buffers(&self) -> Result<(), FrameworkError>; - fn set_frame_size(&self, new_size: (u32, u32)); - fn capabilities(&self) -> ServerCapabilities; -} - impl GraphicsServer for GlGraphicsServer { fn create_buffer( &self, diff --git a/fyrox-graphics/src/gl/texture.rs b/fyrox-graphics/src/gl/texture.rs index 9e9e3b1bc..a45ee4f79 100644 --- a/fyrox-graphics/src/gl/texture.rs +++ b/fyrox-graphics/src/gl/texture.rs @@ -18,6 +18,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +use crate::gl::server::GlGraphicsServer; +use crate::gl::ToGlConstant; use crate::gpu_texture::CubeMapFace; use crate::{ core::color::Color, @@ -26,7 +28,6 @@ use crate::{ image_1d_size_bytes, image_2d_size_bytes, image_3d_size_bytes, Coordinate, GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::{GlGraphicsServer, ToGlConstant}, }; use glow::{HasContext, PixelPackData, COMPRESSED_RED_RGTC1, COMPRESSED_RG_RGTC2}; use std::any::Any; diff --git a/fyrox-graphics/src/gpu_program.rs b/fyrox-graphics/src/gpu_program.rs index 12d7682c4..a29683d52 100644 --- a/fyrox-graphics/src/gpu_program.rs +++ b/fyrox-graphics/src/gpu_program.rs @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +use crate::gl::server::{GlGraphicsServer, GlKind}; use crate::{ core::{ algebra::{Matrix2, Matrix3, Matrix4, Vector2, Vector3, Vector4}, @@ -28,7 +29,6 @@ use crate::{ visitor::prelude::*, }, error::FrameworkError, - state::{GlGraphicsServer, GlKind}, }; use fxhash::FxHashMap; use glow::HasContext; diff --git a/fyrox-graphics/src/lib.rs b/fyrox-graphics/src/lib.rs index 6d5f764ac..7cf4593bf 100644 --- a/fyrox-graphics/src/lib.rs +++ b/fyrox-graphics/src/lib.rs @@ -36,7 +36,7 @@ pub mod gpu_program; pub mod gpu_texture; pub mod pixel_buffer; pub mod query; -pub mod state; +pub mod server; pub mod stats; pub mod uniform; diff --git a/fyrox-graphics/src/pixel_buffer.rs b/fyrox-graphics/src/pixel_buffer.rs index 9efbf0292..09a3b4411 100644 --- a/fyrox-graphics/src/pixel_buffer.rs +++ b/fyrox-graphics/src/pixel_buffer.rs @@ -19,6 +19,8 @@ // SOFTWARE. use crate::gl::framebuffer::GlFrameBuffer; +use crate::gl::server::GlGraphicsServer; +use crate::gl::ToGlConstant; use crate::{ buffer::{Buffer, BufferKind, BufferUsage}, core::{algebra::Vector2, math::Rect}, @@ -26,7 +28,6 @@ use crate::{ framebuffer::FrameBuffer, gl::buffer::GlBuffer, gpu_texture::{image_2d_size_bytes, GpuTextureKind}, - state::{GlGraphicsServer, ToGlConstant}, }; use bytemuck::Pod; use glow::{HasContext, PixelPackData}; diff --git a/fyrox-graphics/src/server.rs b/fyrox-graphics/src/server.rs new file mode 100644 index 000000000..287055a43 --- /dev/null +++ b/fyrox-graphics/src/server.rs @@ -0,0 +1,90 @@ +// Copyright (c) 2019-present Dmitry Stepanov and Fyrox Engine contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +use crate::{ + buffer::{Buffer, BufferKind, BufferUsage}, + error::FrameworkError, + framebuffer::{Attachment, FrameBuffer}, + gpu_texture::{GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind}, + query::Query, + stats::PipelineStatistics, +}; +use std::{ + any::Any, + cell::RefCell, + fmt::{Display, Formatter}, + rc::{Rc, Weak}, +}; + +pub struct ServerCapabilities { + pub max_uniform_block_size: usize, + pub uniform_buffer_offset_alignment: usize, +} + +impl Display for ServerCapabilities { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + writeln!( + f, + "\tMax Uniform Block Size: {}", + self.max_uniform_block_size + )?; + writeln!( + f, + "\tUniform Block Offset Alignment: {}", + self.uniform_buffer_offset_alignment + )?; + Ok(()) + } +} + +pub trait GraphicsServer: Any { + fn create_buffer( + &self, + size: usize, + buffer_kind: BufferKind, + buffer_usage: BufferUsage, + ) -> Result, FrameworkError>; + fn create_texture( + &self, + kind: GpuTextureKind, + pixel_kind: PixelKind, + min_filter: MinificationFilter, + mag_filter: MagnificationFilter, + mip_count: usize, + data: Option<&[u8]>, + ) -> Result>, FrameworkError>; + fn create_frame_buffer( + &self, + depth_attachment: Option, + color_attachments: Vec, + ) -> Result, FrameworkError>; + fn back_buffer(&self) -> Box; + fn create_query(&self) -> Result, FrameworkError>; + fn as_any(&self) -> &dyn Any; + fn as_any_mut(&mut self) -> &mut dyn Any; + fn weak(self: Rc) -> Weak; + fn flush(&self); + fn finish(&self); + fn invalidate_resource_bindings_cache(&self); + fn pipeline_statistics(&self) -> PipelineStatistics; + fn swap_buffers(&self) -> Result<(), FrameworkError>; + fn set_frame_size(&self, new_size: (u32, u32)); + fn capabilities(&self) -> ServerCapabilities; +} diff --git a/fyrox-impl/src/renderer/bloom/blur.rs b/fyrox-impl/src/renderer/bloom/blur.rs index 18e7b862f..a2c92d248 100644 --- a/fyrox-impl/src/renderer/bloom/blur.rs +++ b/fyrox-impl/src/renderer/bloom/blur.rs @@ -28,12 +28,13 @@ use crate::{ Attachment, AttachmentKind, FrameBuffer, ResourceBindGroup, ResourceBinding, }, geometry_buffer::GeometryBuffer, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, gpu_texture::{ Coordinate, GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::{GlGraphicsServer, GraphicsServer}, + server::GraphicsServer, uniform::StaticUniformBuffer, DrawParameters, ElementRange, }, diff --git a/fyrox-impl/src/renderer/bloom/mod.rs b/fyrox-impl/src/renderer/bloom/mod.rs index 4464047b2..ca3acb07e 100644 --- a/fyrox-impl/src/renderer/bloom/mod.rs +++ b/fyrox-impl/src/renderer/bloom/mod.rs @@ -29,12 +29,13 @@ use crate::{ Attachment, AttachmentKind, FrameBuffer, ResourceBindGroup, ResourceBinding, }, geometry_buffer::GeometryBuffer, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, gpu_texture::{ Coordinate, GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::{GlGraphicsServer, GraphicsServer}, + server::GraphicsServer, uniform::StaticUniformBuffer, DrawParameters, ElementRange, }, diff --git a/fyrox-impl/src/renderer/bundle.rs b/fyrox-impl/src/renderer/bundle.rs index 910462361..4ebe4eaf0 100644 --- a/fyrox-impl/src/renderer/bundle.rs +++ b/fyrox-impl/src/renderer/bundle.rs @@ -41,9 +41,9 @@ use crate::{ framework::{ error::FrameworkError, framebuffer::FrameBuffer, + gl::server::GlGraphicsServer, gpu_program::{BuiltInUniform, BuiltInUniformBlock, GpuProgramBinding}, gpu_texture::GpuTexture, - state::GlGraphicsServer, uniform::StaticUniformBuffer, ElementRange, }, diff --git a/fyrox-impl/src/renderer/cache/geometry.rs b/fyrox-impl/src/renderer/cache/geometry.rs index 5c7f6ab6a..1f0dd0293 100644 --- a/fyrox-impl/src/renderer/cache/geometry.rs +++ b/fyrox-impl/src/renderer/cache/geometry.rs @@ -23,7 +23,7 @@ use crate::{ renderer::{ cache::{TemporaryCache, TimeToLive}, framework::{ - error::FrameworkError, geometry_buffer::GeometryBuffer, state::GlGraphicsServer, + error::FrameworkError, geometry_buffer::GeometryBuffer, gl::server::GlGraphicsServer, }, }, scene::mesh::surface::{SurfaceData, SurfaceResource}, diff --git a/fyrox-impl/src/renderer/cache/shader.rs b/fyrox-impl/src/renderer/cache/shader.rs index dd9739731..9b4c557ac 100644 --- a/fyrox-impl/src/renderer/cache/shader.rs +++ b/fyrox-impl/src/renderer/cache/shader.rs @@ -23,7 +23,7 @@ use crate::renderer::framework::error::FrameworkError; use crate::{ core::sstorage::ImmutableString, material::shader::{Shader, ShaderResource}, - renderer::framework::{gpu_program::GpuProgram, state::GlGraphicsServer, DrawParameters}, + renderer::framework::{gl::server::GlGraphicsServer, gpu_program::GpuProgram, DrawParameters}, }; use fxhash::FxHashMap; use fyrox_core::log::Log; diff --git a/fyrox-impl/src/renderer/cache/texture.rs b/fyrox-impl/src/renderer/cache/texture.rs index 4e5237804..601a9be5a 100644 --- a/fyrox-impl/src/renderer/cache/texture.rs +++ b/fyrox-impl/src/renderer/cache/texture.rs @@ -24,13 +24,13 @@ use crate::{ cache::{TemporaryCache, TimeToLive}, framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_texture::{Coordinate, GpuTexture, PixelKind}, - state::GlGraphicsServer, }, }, resource::texture::{Texture, TextureResource}, }; -use fyrox_graphics::state::GraphicsServer; +use fyrox_graphics::server::GraphicsServer; use std::{cell::RefCell, rc::Rc}; pub(crate) struct TextureRenderData { diff --git a/fyrox-impl/src/renderer/cache/uniform.rs b/fyrox-impl/src/renderer/cache/uniform.rs index c0ebc2ae4..ac4681fce 100644 --- a/fyrox-impl/src/renderer/cache/uniform.rs +++ b/fyrox-impl/src/renderer/cache/uniform.rs @@ -24,7 +24,7 @@ use crate::renderer::framework::{ buffer::{Buffer, BufferKind, BufferUsage}, error::FrameworkError, - state::GraphicsServer, + server::GraphicsServer, }; use fxhash::FxHashMap; use fyrox_graphics::uniform::{ByteStorage, UniformBuffer}; diff --git a/fyrox-impl/src/renderer/debug_renderer.rs b/fyrox-impl/src/renderer/debug_renderer.rs index 83b14a810..c665cc544 100644 --- a/fyrox-impl/src/renderer/debug_renderer.rs +++ b/fyrox-impl/src/renderer/debug_renderer.rs @@ -40,9 +40,9 @@ use crate::{ AttributeDefinition, AttributeKind, BufferBuilder, GeometryBuffer, GeometryBufferBuilder, }, + gl::server::GlGraphicsServer, gpu_program::GpuProgram, - state::GlGraphicsServer, - state::GraphicsServer, + server::GraphicsServer, uniform::StaticUniformBuffer, CompareFunc, DrawParameters, ElementKind, ElementRange, }, diff --git a/fyrox-impl/src/renderer/flat_shader.rs b/fyrox-impl/src/renderer/flat_shader.rs index edbf8b7e6..582af5331 100644 --- a/fyrox-impl/src/renderer/flat_shader.rs +++ b/fyrox-impl/src/renderer/flat_shader.rs @@ -22,8 +22,8 @@ use crate::{ core::sstorage::ImmutableString, renderer::framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::GlGraphicsServer, }, }; diff --git a/fyrox-impl/src/renderer/forward_renderer.rs b/fyrox-impl/src/renderer/forward_renderer.rs index 5a91b3570..288eea97c 100644 --- a/fyrox-impl/src/renderer/forward_renderer.rs +++ b/fyrox-impl/src/renderer/forward_renderer.rs @@ -39,8 +39,8 @@ use crate::{ bundle::RenderDataBundleStorage, cache::{shader::ShaderCache, texture::TextureCache}, framework::{ - error::FrameworkError, framebuffer::FrameBuffer, gpu_texture::GpuTexture, - state::GlGraphicsServer, + error::FrameworkError, framebuffer::FrameBuffer, gl::server::GlGraphicsServer, + gpu_texture::GpuTexture, }, GeometryCache, LightData, QualitySettings, RenderPassStatistics, }, diff --git a/fyrox-impl/src/renderer/framework/mod.rs b/fyrox-impl/src/renderer/framework/mod.rs index f3a3afecb..5d2aceb3d 100644 --- a/fyrox-impl/src/renderer/framework/mod.rs +++ b/fyrox-impl/src/renderer/framework/mod.rs @@ -37,8 +37,8 @@ use fyrox_graphics::{ geometry_buffer::{ AttributeDefinition, AttributeKind, BufferBuilder, GeometryBuffer, GeometryBufferBuilder, }, + gl::server::GlGraphicsServer, gpu_texture::{GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode}, - state::GlGraphicsServer, }; impl From for GpuTextureKind { diff --git a/fyrox-impl/src/renderer/fxaa.rs b/fyrox-impl/src/renderer/fxaa.rs index 4e082e5cb..954f433a9 100644 --- a/fyrox-impl/src/renderer/fxaa.rs +++ b/fyrox-impl/src/renderer/fxaa.rs @@ -31,9 +31,10 @@ use crate::{ error::FrameworkError, framebuffer::{FrameBuffer, ResourceBindGroup, ResourceBinding}, geometry_buffer::GeometryBuffer, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, gpu_texture::GpuTexture, - state::{GlGraphicsServer, GraphicsServer}, + server::GraphicsServer, uniform::StaticUniformBuffer, DrawParameters, ElementRange, GeometryBufferExt, }, diff --git a/fyrox-impl/src/renderer/gbuffer/decal.rs b/fyrox-impl/src/renderer/gbuffer/decal.rs index ca854f29b..477b820c3 100644 --- a/fyrox-impl/src/renderer/gbuffer/decal.rs +++ b/fyrox-impl/src/renderer/gbuffer/decal.rs @@ -21,8 +21,8 @@ use crate::core::sstorage::ImmutableString; use crate::renderer::framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::GlGraphicsServer, }; pub struct DecalShader { diff --git a/fyrox-impl/src/renderer/gbuffer/mod.rs b/fyrox-impl/src/renderer/gbuffer/mod.rs index 688894595..589edda2c 100644 --- a/fyrox-impl/src/renderer/gbuffer/mod.rs +++ b/fyrox-impl/src/renderer/gbuffer/mod.rs @@ -46,11 +46,11 @@ use crate::{ error::FrameworkError, framebuffer::{Attachment, AttachmentKind, FrameBuffer}, geometry_buffer::GeometryBuffer, + gl::server::GlGraphicsServer, gpu_texture::{ Coordinate, GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::GlGraphicsServer, BlendFactor, BlendFunc, BlendParameters, DrawParameters, ElementRange, }, gbuffer::decal::DecalShader, @@ -67,7 +67,7 @@ use crate::{ use fxhash::FxHashSet; use fyrox_graphics::buffer::{Buffer, BufferUsage}; use fyrox_graphics::framebuffer::{ResourceBindGroup, ResourceBinding}; -use fyrox_graphics::state::GraphicsServer; +use fyrox_graphics::server::GraphicsServer; use fyrox_graphics::uniform::StaticUniformBuffer; use std::{cell::RefCell, rc::Rc}; diff --git a/fyrox-impl/src/renderer/hdr/adaptation.rs b/fyrox-impl/src/renderer/hdr/adaptation.rs index 0755be2e8..f5b468bca 100644 --- a/fyrox-impl/src/renderer/hdr/adaptation.rs +++ b/fyrox-impl/src/renderer/hdr/adaptation.rs @@ -22,9 +22,9 @@ use crate::core::sstorage::ImmutableString; use crate::renderer::{ framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, gpu_texture::GpuTexture, - state::GlGraphicsServer, }, hdr::LumBuffer, }; diff --git a/fyrox-impl/src/renderer/hdr/downscale.rs b/fyrox-impl/src/renderer/hdr/downscale.rs index abaaccbfa..2ee754277 100644 --- a/fyrox-impl/src/renderer/hdr/downscale.rs +++ b/fyrox-impl/src/renderer/hdr/downscale.rs @@ -21,8 +21,8 @@ use crate::core::sstorage::ImmutableString; use crate::renderer::framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::GlGraphicsServer, }; pub struct DownscaleShader { diff --git a/fyrox-impl/src/renderer/hdr/luminance.rs b/fyrox-impl/src/renderer/hdr/luminance.rs index 97eb14196..4d37c94ed 100644 --- a/fyrox-impl/src/renderer/hdr/luminance.rs +++ b/fyrox-impl/src/renderer/hdr/luminance.rs @@ -21,8 +21,8 @@ use crate::core::sstorage::ImmutableString; use crate::renderer::framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::GlGraphicsServer, }; pub struct LuminanceShader { diff --git a/fyrox-impl/src/renderer/hdr/map.rs b/fyrox-impl/src/renderer/hdr/map.rs index 95701b0a1..5307efbe3 100644 --- a/fyrox-impl/src/renderer/hdr/map.rs +++ b/fyrox-impl/src/renderer/hdr/map.rs @@ -21,8 +21,8 @@ use crate::core::sstorage::ImmutableString; use crate::renderer::framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::GlGraphicsServer, }; pub struct MapShader { diff --git a/fyrox-impl/src/renderer/hdr/mod.rs b/fyrox-impl/src/renderer/hdr/mod.rs index 13cb7bf66..a71201599 100644 --- a/fyrox-impl/src/renderer/hdr/mod.rs +++ b/fyrox-impl/src/renderer/hdr/mod.rs @@ -32,10 +32,10 @@ use crate::{ error::FrameworkError, framebuffer::{Attachment, AttachmentKind, FrameBuffer}, geometry_buffer::{DrawCallStatistics, GeometryBuffer}, + gl::server::GlGraphicsServer, gpu_texture::{ GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, }, - state::GlGraphicsServer, DrawParameters, ElementRange, }, hdr::{ @@ -49,7 +49,7 @@ use crate::{ scene::camera::{ColorGradingLut, Exposure}, }; use fyrox_graphics::framebuffer::{ResourceBindGroup, ResourceBinding}; -use fyrox_graphics::state::GraphicsServer; +use fyrox_graphics::server::GraphicsServer; use fyrox_graphics::uniform::StaticUniformBuffer; use std::{cell::RefCell, rc::Rc}; diff --git a/fyrox-impl/src/renderer/light/ambient.rs b/fyrox-impl/src/renderer/light/ambient.rs index 42e8add33..74bf28b9f 100644 --- a/fyrox-impl/src/renderer/light/ambient.rs +++ b/fyrox-impl/src/renderer/light/ambient.rs @@ -21,8 +21,8 @@ use crate::core::sstorage::ImmutableString; use crate::renderer::framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::GlGraphicsServer, }; pub struct AmbientLightShader { diff --git a/fyrox-impl/src/renderer/light/directional.rs b/fyrox-impl/src/renderer/light/directional.rs index 4a05373bb..72114c1ac 100644 --- a/fyrox-impl/src/renderer/light/directional.rs +++ b/fyrox-impl/src/renderer/light/directional.rs @@ -22,8 +22,8 @@ use crate::{ core::sstorage::ImmutableString, renderer::framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::GlGraphicsServer, }, }; diff --git a/fyrox-impl/src/renderer/light/mod.rs b/fyrox-impl/src/renderer/light/mod.rs index 57600dea3..f4f962859 100644 --- a/fyrox-impl/src/renderer/light/mod.rs +++ b/fyrox-impl/src/renderer/light/mod.rs @@ -30,7 +30,7 @@ use crate::{ flat_shader::FlatShader, framework::{ buffer::BufferUsage, error::FrameworkError, framebuffer::FrameBuffer, - geometry_buffer::GeometryBuffer, gpu_texture::GpuTexture, state::GlGraphicsServer, + geometry_buffer::GeometryBuffer, gl::server::GlGraphicsServer, gpu_texture::GpuTexture, BlendFactor, BlendFunc, BlendParameters, ColorMask, CompareFunc, CullFace, DrawParameters, ElementRange, GeometryBufferExt, StencilAction, StencilFunc, StencilOp, }, diff --git a/fyrox-impl/src/renderer/light/point.rs b/fyrox-impl/src/renderer/light/point.rs index 654d30a3e..1d075159d 100644 --- a/fyrox-impl/src/renderer/light/point.rs +++ b/fyrox-impl/src/renderer/light/point.rs @@ -21,8 +21,8 @@ use crate::core::sstorage::ImmutableString; use crate::renderer::framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::GlGraphicsServer, }; pub struct PointLightShader { diff --git a/fyrox-impl/src/renderer/light/spot.rs b/fyrox-impl/src/renderer/light/spot.rs index bacbac514..f5e1c7daf 100644 --- a/fyrox-impl/src/renderer/light/spot.rs +++ b/fyrox-impl/src/renderer/light/spot.rs @@ -21,8 +21,8 @@ use crate::core::sstorage::ImmutableString; use crate::renderer::framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::GlGraphicsServer, }; pub struct SpotLightShader { diff --git a/fyrox-impl/src/renderer/light_volume.rs b/fyrox-impl/src/renderer/light_volume.rs index d8b44db60..82015a795 100644 --- a/fyrox-impl/src/renderer/light_volume.rs +++ b/fyrox-impl/src/renderer/light_volume.rs @@ -33,8 +33,9 @@ use crate::{ error::FrameworkError, framebuffer::{FrameBuffer, ResourceBindGroup, ResourceBinding}, geometry_buffer::GeometryBuffer, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::{GlGraphicsServer, GraphicsServer}, + server::GraphicsServer, uniform::StaticUniformBuffer, BlendFactor, BlendFunc, BlendParameters, ColorMask, CompareFunc, DrawParameters, ElementRange, GeometryBufferExt, StencilAction, StencilFunc, StencilOp, diff --git a/fyrox-impl/src/renderer/mod.rs b/fyrox-impl/src/renderer/mod.rs index 14811aeb2..d23ef4994 100644 --- a/fyrox-impl/src/renderer/mod.rs +++ b/fyrox-impl/src/renderer/mod.rs @@ -86,12 +86,12 @@ use crate::{ Attachment, AttachmentKind, FrameBuffer, ResourceBindGroup, ResourceBinding, }, geometry_buffer::{DrawCallStatistics, GeometryBuffer}, + gl::server::{GlGraphicsServer, SharedPipelineState}, gpu_texture::{ Coordinate, GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::GraphicsServer, - state::{GlGraphicsServer, SharedPipelineState}, + server::GraphicsServer, uniform::StaticUniformBuffer, DrawParameters, ElementRange, GeometryBufferExt, PolygonFace, PolygonFillMode, }, diff --git a/fyrox-impl/src/renderer/occlusion/mod.rs b/fyrox-impl/src/renderer/occlusion/mod.rs index 5f3d56cd4..224ac3b8f 100644 --- a/fyrox-impl/src/renderer/occlusion/mod.rs +++ b/fyrox-impl/src/renderer/occlusion/mod.rs @@ -43,12 +43,13 @@ use crate::{ Attachment, AttachmentKind, FrameBuffer, ResourceBindGroup, ResourceBinding, }, geometry_buffer::GeometryBuffer, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, gpu_texture::{ Coordinate, GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::{GlGraphicsServer, GraphicsServer}, + server::GraphicsServer, uniform::StaticUniformBuffer, BlendEquation, BlendFactor, BlendFunc, BlendMode, BlendParameters, ColorMask, CompareFunc, CullFace, DrawParameters, GeometryBufferExt, diff --git a/fyrox-impl/src/renderer/occlusion/optimizer.rs b/fyrox-impl/src/renderer/occlusion/optimizer.rs index 781415f89..a77ac4555 100644 --- a/fyrox-impl/src/renderer/occlusion/optimizer.rs +++ b/fyrox-impl/src/renderer/occlusion/optimizer.rs @@ -26,19 +26,19 @@ use crate::{ error::FrameworkError, framebuffer::{Attachment, AttachmentKind, FrameBuffer}, geometry_buffer::GeometryBuffer, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, gpu_texture::{ GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, }, pixel_buffer::PixelBuffer, - state::GlGraphicsServer, ColorMask, DrawParameters, ElementRange, }, make_viewport_matrix, }, }; use fyrox_graphics::framebuffer::{ResourceBindGroup, ResourceBinding}; -use fyrox_graphics::state::GraphicsServer; +use fyrox_graphics::server::GraphicsServer; use fyrox_graphics::uniform::StaticUniformBuffer; use std::{cell::RefCell, rc::Rc}; diff --git a/fyrox-impl/src/renderer/shadow/csm.rs b/fyrox-impl/src/renderer/shadow/csm.rs index 0aec5cfe8..ce5b6f474 100644 --- a/fyrox-impl/src/renderer/shadow/csm.rs +++ b/fyrox-impl/src/renderer/shadow/csm.rs @@ -31,11 +31,11 @@ use crate::{ framework::{ error::FrameworkError, framebuffer::{Attachment, AttachmentKind, FrameBuffer}, + gl::server::GlGraphicsServer, gpu_texture::{ Coordinate, GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::GlGraphicsServer, }, RenderPassStatistics, ShadowMapPrecision, DIRECTIONAL_SHADOW_PASS_NAME, }, @@ -46,7 +46,7 @@ use crate::{ }, }; use fyrox_graphics::buffer::Buffer; -use fyrox_graphics::state::GraphicsServer; +use fyrox_graphics::server::GraphicsServer; use std::{cell::RefCell, rc::Rc}; pub struct Cascade { diff --git a/fyrox-impl/src/renderer/shadow/point.rs b/fyrox-impl/src/renderer/shadow/point.rs index 2da1eb83f..e77fbc06f 100644 --- a/fyrox-impl/src/renderer/shadow/point.rs +++ b/fyrox-impl/src/renderer/shadow/point.rs @@ -31,11 +31,11 @@ use crate::{ framework::{ error::FrameworkError, framebuffer::{Attachment, AttachmentKind, FrameBuffer}, + gl::server::GlGraphicsServer, gpu_texture::{ Coordinate, CubeMapFace, GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::GlGraphicsServer, }, shadow::cascade_size, GeometryCache, RenderPassStatistics, ShadowMapPrecision, POINT_SHADOW_PASS_NAME, @@ -43,7 +43,7 @@ use crate::{ scene::graph::Graph, }; use fyrox_graphics::buffer::Buffer; -use fyrox_graphics::state::GraphicsServer; +use fyrox_graphics::server::GraphicsServer; use std::{cell::RefCell, rc::Rc}; pub struct PointShadowMapRenderer { diff --git a/fyrox-impl/src/renderer/shadow/spot.rs b/fyrox-impl/src/renderer/shadow/spot.rs index 1f3a44025..7c57d0868 100644 --- a/fyrox-impl/src/renderer/shadow/spot.rs +++ b/fyrox-impl/src/renderer/shadow/spot.rs @@ -31,11 +31,11 @@ use crate::{ framework::{ error::FrameworkError, framebuffer::{Attachment, AttachmentKind, FrameBuffer}, + gl::server::GlGraphicsServer, gpu_texture::{ Coordinate, GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::GlGraphicsServer, }, shadow::cascade_size, GeometryCache, RenderPassStatistics, ShadowMapPrecision, SPOT_SHADOW_PASS_NAME, @@ -43,7 +43,7 @@ use crate::{ scene::graph::Graph, }; use fyrox_graphics::buffer::Buffer; -use fyrox_graphics::state::GraphicsServer; +use fyrox_graphics::server::GraphicsServer; use std::{cell::RefCell, rc::Rc}; pub struct SpotShadowMapRenderer { diff --git a/fyrox-impl/src/renderer/skybox_shader.rs b/fyrox-impl/src/renderer/skybox_shader.rs index fe28b97d2..9493f8669 100644 --- a/fyrox-impl/src/renderer/skybox_shader.rs +++ b/fyrox-impl/src/renderer/skybox_shader.rs @@ -21,8 +21,8 @@ use crate::core::sstorage::ImmutableString; use crate::renderer::framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, - state::GlGraphicsServer, }; pub struct SkyboxShader { diff --git a/fyrox-impl/src/renderer/ssao/blur.rs b/fyrox-impl/src/renderer/ssao/blur.rs index 950eeb498..914cc37a5 100644 --- a/fyrox-impl/src/renderer/ssao/blur.rs +++ b/fyrox-impl/src/renderer/ssao/blur.rs @@ -29,12 +29,13 @@ use crate::{ Attachment, AttachmentKind, FrameBuffer, ResourceBindGroup, ResourceBinding, }, geometry_buffer::{DrawCallStatistics, GeometryBuffer}, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, gpu_texture::{ Coordinate, GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::{GlGraphicsServer, GraphicsServer}, + server::GraphicsServer, uniform::StaticUniformBuffer, DrawParameters, ElementRange, GeometryBufferExt, }, diff --git a/fyrox-impl/src/renderer/ssao/mod.rs b/fyrox-impl/src/renderer/ssao/mod.rs index d88aed91d..509cef604 100644 --- a/fyrox-impl/src/renderer/ssao/mod.rs +++ b/fyrox-impl/src/renderer/ssao/mod.rs @@ -33,12 +33,13 @@ use crate::{ error::FrameworkError, framebuffer::{Attachment, AttachmentKind, FrameBuffer}, geometry_buffer::GeometryBuffer, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, gpu_texture::{ Coordinate, GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, WrapMode, }, - state::{GlGraphicsServer, GraphicsServer}, + server::GraphicsServer, uniform::StaticUniformBuffer, DrawParameters, ElementRange, GeometryBufferExt, }, diff --git a/fyrox-impl/src/renderer/storage.rs b/fyrox-impl/src/renderer/storage.rs index b34e0f5a2..330e5b39e 100644 --- a/fyrox-impl/src/renderer/storage.rs +++ b/fyrox-impl/src/renderer/storage.rs @@ -26,15 +26,15 @@ use crate::{ bundle::PersistentIdentifier, framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, gpu_texture::{ GpuTexture, GpuTextureKind, MagnificationFilter, MinificationFilter, PixelKind, }, - state::GlGraphicsServer, }, }, }; use fxhash::FxHashMap; -use fyrox_graphics::state::GraphicsServer; +use fyrox_graphics::server::GraphicsServer; use std::{cell::RefCell, collections::hash_map::Entry, rc::Rc}; /// Generic, texture-based, storage for matrices with somewhat unlimited capacity. diff --git a/fyrox-impl/src/renderer/ui_renderer.rs b/fyrox-impl/src/renderer/ui_renderer.rs index 37df4db2a..d31a2639a 100644 --- a/fyrox-impl/src/renderer/ui_renderer.rs +++ b/fyrox-impl/src/renderer/ui_renderer.rs @@ -43,9 +43,9 @@ use crate::{ AttributeDefinition, AttributeKind, BufferBuilder, GeometryBuffer, GeometryBufferBuilder, }, + gl::server::GlGraphicsServer, gpu_program::{GpuProgram, UniformLocation}, gpu_texture::GpuTexture, - state::GlGraphicsServer, BlendFactor, BlendFunc, BlendParameters, ColorMask, CompareFunc, DrawParameters, ElementKind, ElementRange, ScissorBox, StencilAction, StencilFunc, StencilOp, }, diff --git a/fyrox-impl/src/renderer/visibility.rs b/fyrox-impl/src/renderer/visibility.rs index ae028329b..a0b321143 100644 --- a/fyrox-impl/src/renderer/visibility.rs +++ b/fyrox-impl/src/renderer/visibility.rs @@ -25,13 +25,13 @@ use crate::{ graph::BaseSceneGraph, renderer::framework::{ error::FrameworkError, + gl::server::GlGraphicsServer, query::{Query, QueryKind, QueryResult}, - state::GlGraphicsServer, }, scene::{graph::Graph, node::Node}, }; use fxhash::FxHashMap; -use fyrox_graphics::state::GraphicsServer; +use fyrox_graphics::server::GraphicsServer; #[derive(Debug)] struct PendingQuery {