diff --git a/.idea/rg3d-core.iml b/.idea/rg3d-core.iml
index c90a7b7cd..8c01d26da 100644
--- a/.idea/rg3d-core.iml
+++ b/.idea/rg3d-core.iml
@@ -49,6 +49,7 @@
+
diff --git a/Cargo.toml b/Cargo.toml
index 58284a5c1..a473fd3fd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,7 +22,7 @@ members = [
"fyrox-texture",
"fyrox-autotile",
"fyrox-material"
-]
+, "fyrox-graphics-gl"]
resolver = "2"
[profile.dev]
diff --git a/fyrox-graphics-gl/Cargo.toml b/fyrox-graphics-gl/Cargo.toml
new file mode 100644
index 000000000..3da81103c
--- /dev/null
+++ b/fyrox-graphics-gl/Cargo.toml
@@ -0,0 +1,29 @@
+[package]
+name = "fyrox-graphics-gl"
+version = "0.36.0"
+edition = "2021"
+license = "MIT"
+description = "OpenGL-based graphics server for Fyrox Game Engine"
+keywords = ["graphics", "gapi"]
+categories = ["graphics", "rendering::graphics-api"]
+include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md"]
+homepage = "https://fyrox.rs"
+documentation = "https://docs.rs/fyrox-graphics-gl"
+repository = "https://github.com/FyroxEngine/Fyrox"
+rust-version = "1.86"
+
+[dependencies]
+winit = { version = "0.29.2", features = ["serde"] }
+fyrox-graphics = { version = "0.36", path = "../fyrox-graphics" }
+fyrox-core = { version = "0.36", path = "../fyrox-core" }
+fxhash = "0.2.1"
+regex = "1"
+glow = "0.16"
+
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+glutin = "0.31"
+glutin-winit = "0.4.2"
+raw-window-handle = "0.5.0"
+
+[target.'cfg(target_arch = "wasm32")'.dependencies]
+serde-wasm-bindgen = "0.6.3"
\ No newline at end of file
diff --git a/fyrox-graphics/src/gl/buffer.rs b/fyrox-graphics-gl/src/buffer.rs
similarity index 98%
rename from fyrox-graphics/src/gl/buffer.rs
rename to fyrox-graphics-gl/src/buffer.rs
index e4c00ada0..9865bd6ff 100644
--- a/fyrox-graphics/src/gl/buffer.rs
+++ b/fyrox-graphics-gl/src/buffer.rs
@@ -18,9 +18,9 @@
// 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::{
+use crate::ToGlConstant;
+use crate::server::GlGraphicsServer;
+use fyrox_graphics::{
buffer::{BufferKind, BufferUsage, GpuBufferTrait},
error::FrameworkError,
};
diff --git a/fyrox-graphics/src/gl/framebuffer.rs b/fyrox-graphics-gl/src/framebuffer.rs
similarity index 98%
rename from fyrox-graphics/src/gl/framebuffer.rs
rename to fyrox-graphics-gl/src/framebuffer.rs
index 564020567..219b4e25a 100644
--- a/fyrox-graphics/src/gl/framebuffer.rs
+++ b/fyrox-graphics-gl/src/framebuffer.rs
@@ -18,7 +18,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-use crate::{
+use crate::texture::PixelDescriptor;
+pub use crate::{
+ ToGlConstant, buffer::GlBuffer, geometry_buffer::GlGeometryBuffer, program::GlProgram,
+ sampler::GlSampler, server::GlGraphicsServer, texture::GlTexture,
+};
+use fyrox_graphics::{
+ ColorMask, DrawParameters, ElementRange,
buffer::GpuBufferTrait,
core::{color::Color, math::Rect},
error::FrameworkError,
@@ -28,15 +34,9 @@ use crate::{
GpuFrameBufferTrait, ResourceBindGroup, ResourceBinding,
},
geometry_buffer::GpuGeometryBuffer,
- gl::sampler::GlSampler,
- gl::{
- buffer::GlBuffer, geometry_buffer::GlGeometryBuffer, program::GlProgram,
- server::GlGraphicsServer, texture::GlTexture, ToGlConstant,
- },
gpu_program::GpuProgram,
gpu_texture::image_2d_size_bytes,
gpu_texture::{CubeMapFace, GpuTextureKind, GpuTextureTrait, PixelElementKind},
- ColorMask, DrawParameters, ElementRange,
};
use glow::{HasContext, PixelPackData};
use std::rc::Weak;
@@ -274,7 +274,7 @@ impl GpuFrameBufferTrait for GlFrameBuffer {
if let GpuTextureKind::Rectangle { width, height } = texture.kind() {
let pixel_kind = texture.pixel_kind();
- let pixel_info = pixel_kind.pixel_descriptor();
+ let pixel_info = PixelDescriptor::from(pixel_kind);
let mut buffer = vec![0; image_2d_size_bytes(pixel_kind, width, height)];
unsafe {
server.gl.read_pixels(
diff --git a/fyrox-graphics/src/gl/geometry_buffer.rs b/fyrox-graphics-gl/src/geometry_buffer.rs
similarity index 96%
rename from fyrox-graphics/src/gl/geometry_buffer.rs
rename to fyrox-graphics-gl/src/geometry_buffer.rs
index b7f6dfdc5..4e2c498d0 100644
--- a/fyrox-graphics/src/gl/geometry_buffer.rs
+++ b/fyrox-graphics-gl/src/geometry_buffer.rs
@@ -18,21 +18,21 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-use crate::{
+use crate::{ToGlConstant, buffer::GlBuffer, server::GlGraphicsServer};
+use fyrox_graphics::{
+ ElementKind,
buffer::{BufferKind, GpuBufferTrait},
core::{array_as_u8_slice, math::TriangleDefinition},
error::FrameworkError,
geometry_buffer::{
AttributeKind, ElementsDescriptor, GeometryBufferDescriptor, GpuGeometryBufferTrait,
},
- gl::{buffer::GlBuffer, server::GlGraphicsServer, ToGlConstant},
- ElementKind,
};
use glow::HasContext;
use std::{cell::Cell, marker::PhantomData, rc::Weak};
-impl AttributeKind {
- fn gl_type(self) -> u32 {
+impl ToGlConstant for AttributeKind {
+ fn into_gl(self) -> u32 {
match self {
AttributeKind::Float => glow::FLOAT,
AttributeKind::UnsignedByte => glow::UNSIGNED_BYTE,
@@ -94,7 +94,7 @@ impl GlGeometryBuffer {
server.gl.vertex_attrib_pointer_f32(
definition.location,
definition.component_count as i32,
- definition.kind.gl_type(),
+ definition.kind.into_gl(),
definition.normalized,
buffer.data.element_size as i32,
offset as i32,
diff --git a/fyrox-graphics/src/gl/mod.rs b/fyrox-graphics-gl/src/lib.rs
similarity index 100%
rename from fyrox-graphics/src/gl/mod.rs
rename to fyrox-graphics-gl/src/lib.rs
diff --git a/fyrox-graphics/src/gl/program.rs b/fyrox-graphics-gl/src/program.rs
similarity index 94%
rename from fyrox-graphics/src/gl/program.rs
rename to fyrox-graphics-gl/src/program.rs
index 71583767f..028ed3cbe 100644
--- a/fyrox-graphics/src/gl/program.rs
+++ b/fyrox-graphics-gl/src/program.rs
@@ -19,12 +19,12 @@
// SOFTWARE.
use crate::{
+ ToGlConstant,
+ server::{GlGraphicsServer, GlKind},
+};
+use fyrox_graphics::{
core::log::{Log, MessageKind},
error::FrameworkError,
- gl::{
- server::{GlGraphicsServer, GlKind},
- ToGlConstant,
- },
gpu_program::{
GpuProgramTrait, GpuShaderTrait, SamplerKind, ShaderKind, ShaderPropertyKind,
ShaderResourceDefinition, ShaderResourceKind,
@@ -33,18 +33,16 @@ use crate::{
use glow::HasContext;
use std::{marker::PhantomData, ops::Range, rc::Weak};
-impl SamplerKind {
- pub fn glsl_name(&self) -> &str {
- match self {
- SamplerKind::Sampler1D => "sampler1D",
- SamplerKind::Sampler2D => "sampler2D",
- SamplerKind::Sampler3D => "sampler3D",
- SamplerKind::SamplerCube => "samplerCube",
- SamplerKind::USampler1D => "usampler1D",
- SamplerKind::USampler2D => "usampler2D",
- SamplerKind::USampler3D => "usampler3D",
- SamplerKind::USamplerCube => "usamplerCube",
- }
+fn glsl_sampler_name(sampler: SamplerKind) -> &'static str {
+ match sampler {
+ SamplerKind::Sampler1D => "sampler1D",
+ SamplerKind::Sampler2D => "sampler2D",
+ SamplerKind::Sampler3D => "sampler3D",
+ SamplerKind::SamplerCube => "samplerCube",
+ SamplerKind::USampler1D => "usampler1D",
+ SamplerKind::USampler2D => "usampler2D",
+ SamplerKind::USampler3D => "usampler3D",
+ SamplerKind::USamplerCube => "usamplerCube",
}
}
@@ -187,7 +185,7 @@ impl GlShader {
let resource_name = &property.name;
match property.kind {
ShaderResourceKind::Texture { kind, .. } => {
- let glsl_name = kind.glsl_name();
+ let glsl_name = glsl_sampler_name(kind);
texture_bindings += &format!("uniform {glsl_name} {resource_name};\n");
}
ShaderResourceKind::PropertyGroup(ref fields) => {
@@ -264,7 +262,9 @@ impl GlShader {
}
}
block += "};\n";
- block += &format!("layout(std140) uniform U{resource_name} {{ T{resource_name} {resource_name}; }};\n");
+ block += &format!(
+ "layout(std140) uniform U{resource_name} {{ T{resource_name} {resource_name}; }};\n"
+ );
source.insert_str(0, &block);
line_offset -= count_lines(&block);
}
@@ -304,7 +304,9 @@ impl GlShader {
{
format!("Shader {name} compiled successfully!")
} else {
- format!("Shader {name} compiled successfully!\nAdditional info: {compilation_message}")
+ format!(
+ "Shader {name} compiled successfully!\nAdditional info: {compilation_message}"
+ )
};
Log::writeln(MessageKind::Information, msg);
@@ -497,7 +499,7 @@ impl Drop for GlProgram {
#[cfg(test)]
mod test {
- use crate::gl::program::{patch_error_message, Vendor};
+ use crate::program::{Vendor, patch_error_message};
#[test]
fn test_line_correction() {
diff --git a/fyrox-graphics/src/gl/query.rs b/fyrox-graphics-gl/src/query.rs
similarity index 98%
rename from fyrox-graphics/src/gl/query.rs
rename to fyrox-graphics-gl/src/query.rs
index 9b242dd64..14bb181bf 100644
--- a/fyrox-graphics/src/gl/query.rs
+++ b/fyrox-graphics-gl/src/query.rs
@@ -18,9 +18,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-use crate::{
+use crate::server::GlGraphicsServer;
+use fyrox_graphics::{
error::FrameworkError,
- gl::server::GlGraphicsServer,
query::{GpuQueryTrait, QueryKind, QueryResult},
};
use glow::HasContext;
diff --git a/fyrox-graphics/src/gl/read_buffer.rs b/fyrox-graphics-gl/src/read_buffer.rs
similarity index 95%
rename from fyrox-graphics/src/gl/read_buffer.rs
rename to fyrox-graphics-gl/src/read_buffer.rs
index f55ec5496..ba70d41c0 100644
--- a/fyrox-graphics/src/gl/read_buffer.rs
+++ b/fyrox-graphics-gl/src/read_buffer.rs
@@ -18,13 +18,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-use crate::{
+use crate::texture::PixelDescriptor;
+use crate::{ToGlConstant, buffer::GlBuffer, framebuffer::GlFrameBuffer, server::GlGraphicsServer};
+use fyrox_graphics::{
buffer::{BufferKind, BufferUsage, GpuBufferTrait},
core::{algebra::Vector2, math::Rect},
error::FrameworkError,
framebuffer::GpuFrameBufferTrait,
- gl::{buffer::GlBuffer, framebuffer::GlFrameBuffer, server::GlGraphicsServer, ToGlConstant},
- gpu_texture::{image_2d_size_bytes, GpuTextureKind},
+ gpu_texture::{GpuTextureKind, image_2d_size_bytes},
read_buffer::GpuAsyncReadBufferTrait,
};
use glow::{HasContext, PixelPackData};
@@ -97,7 +98,7 @@ impl GpuAsyncReadBufferTrait for GlAsyncReadBuffer {
})?
.texture;
- let attachment_pixel_descriptor = color_attachment.pixel_kind().pixel_descriptor();
+ let attachment_pixel_descriptor = PixelDescriptor::from(color_attachment.pixel_kind());
let color_attachment_size =
if let GpuTextureKind::Rectangle { width, height } = color_attachment.kind() {
diff --git a/fyrox-graphics/src/gl/sampler.rs b/fyrox-graphics-gl/src/sampler.rs
similarity index 95%
rename from fyrox-graphics/src/gl/sampler.rs
rename to fyrox-graphics-gl/src/sampler.rs
index 272f8ca99..c10c19409 100644
--- a/fyrox-graphics/src/gl/sampler.rs
+++ b/fyrox-graphics-gl/src/sampler.rs
@@ -18,11 +18,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-use crate::sampler::{Coordinate, MagnificationFilter, MinificationFilter, WrapMode};
-use crate::{
+use crate::{ToGlConstant, server::GlGraphicsServer};
+use fyrox_graphics::{
error::FrameworkError,
- gl::{server::GlGraphicsServer, ToGlConstant},
- sampler::{GpuSamplerDescriptor, GpuSamplerTrait},
+ sampler::{
+ Coordinate, GpuSamplerDescriptor, GpuSamplerTrait, MagnificationFilter, MinificationFilter,
+ WrapMode,
+ },
};
use glow::HasContext;
use std::rc::Weak;
diff --git a/fyrox-graphics/src/gl/server.rs b/fyrox-graphics-gl/src/server.rs
similarity index 97%
rename from fyrox-graphics/src/gl/server.rs
rename to fyrox-graphics-gl/src/server.rs
index 17f8ddd2b..19da7d335 100644
--- a/fyrox-graphics/src/gl/server.rs
+++ b/fyrox-graphics-gl/src/server.rs
@@ -18,23 +18,23 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+use crate::buffer::GlBuffer;
use crate::{
+ framebuffer::GlFrameBuffer,
+ geometry_buffer::GlGeometryBuffer,
+ program::{GlProgram, GlShader},
+ query::GlQuery,
+ read_buffer::GlAsyncReadBuffer,
+ sampler::GlSampler,
+ texture::GlTexture,
+ ToGlConstant,
+};
+use fyrox_graphics::{
buffer::{BufferKind, BufferUsage, GpuBuffer},
core::{color::Color, log::Log, math::Rect},
error::FrameworkError,
framebuffer::{Attachment, GpuFrameBuffer},
geometry_buffer::{GeometryBufferDescriptor, GpuGeometryBuffer},
- gl::{
- self,
- framebuffer::GlFrameBuffer,
- geometry_buffer::GlGeometryBuffer,
- program::{GlProgram, GlShader},
- query::GlQuery,
- read_buffer::GlAsyncReadBuffer,
- sampler::GlSampler,
- texture::GlTexture,
- ToGlConstant,
- },
gpu_program::{GpuProgram, GpuShader, ShaderKind, ShaderResourceDefinition},
gpu_texture::{GpuTexture, GpuTextureDescriptor},
query::GpuQuery,
@@ -367,7 +367,8 @@ impl GlGraphicsServer {
let gl_surface = gl_config
.display()
- .create_window_surface(&gl_config, &attrs)?;
+ .create_window_surface(&gl_config, &attrs)
+ .map_err(|err| FrameworkError::Custom(format!("{err:?}")))?;
let (non_current_gl_context, gl_kind) = if let Ok(gl3_3_core_context) =
gl_display.create_context(&gl_config, &gl3_3_core_context_attributes)
@@ -375,12 +376,16 @@ impl GlGraphicsServer {
(gl3_3_core_context, GlKind::OpenGL)
} else {
(
- gl_display.create_context(&gl_config, &gles3_context_attributes)?,
+ gl_display
+ .create_context(&gl_config, &gles3_context_attributes)
+ .map_err(|err| FrameworkError::Custom(format!("{err:?}")))?,
GlKind::OpenGLES,
)
};
- let gl_context = non_current_gl_context.make_current(&gl_surface)?;
+ let gl_context = non_current_gl_context
+ .make_current(&gl_surface)
+ .map_err(|err| FrameworkError::Custom(format!("{err:?}")))?;
if vsync {
Log::verify(gl_surface.set_swap_interval(
@@ -499,7 +504,7 @@ impl GlGraphicsServer {
#[cfg(debug_assertions)]
{
- use crate::core::log::{Log, MessageKind};
+ use fyrox_core::log::{Log, MessageKind};
if context.supported_extensions().contains("GL_KHR_debug") {
context.debug_message_callback(|source, msg_type, id, severity, message| {
@@ -1001,7 +1006,7 @@ impl GraphicsServer for GlGraphicsServer {
buffer_kind: BufferKind,
buffer_usage: BufferUsage,
) -> Result {
- Ok(GpuBuffer(Rc::new(gl::buffer::GlBuffer::new(
+ Ok(GpuBuffer(Rc::new(GlBuffer::new(
self,
size,
buffer_kind,
@@ -1138,7 +1143,10 @@ impl GraphicsServer for GlGraphicsServer {
#[cfg(not(target_arch = "wasm32"))]
{
let state = self.state.borrow();
- Ok(state.gl_surface.swap_buffers(&state.gl_context)?)
+ state
+ .gl_surface
+ .swap_buffers(&state.gl_context)
+ .map_err(|err| FrameworkError::Custom(format!("{err:?}")))
}
#[cfg(target_arch = "wasm32")]
diff --git a/fyrox-graphics/src/gl/shaders/shared.glsl b/fyrox-graphics-gl/src/shaders/shared.glsl
similarity index 100%
rename from fyrox-graphics/src/gl/shaders/shared.glsl
rename to fyrox-graphics-gl/src/shaders/shared.glsl
diff --git a/fyrox-graphics/src/gl/texture.rs b/fyrox-graphics-gl/src/texture.rs
similarity index 97%
rename from fyrox-graphics/src/gl/texture.rs
rename to fyrox-graphics-gl/src/texture.rs
index a4aecd47d..97fd93c22 100644
--- a/fyrox-graphics/src/gl/texture.rs
+++ b/fyrox-graphics-gl/src/texture.rs
@@ -18,23 +18,23 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-use crate::{
+use crate::{ToGlConstant, server::GlGraphicsServer};
+use fyrox_graphics::{
error::FrameworkError,
- gl::{server::GlGraphicsServer, ToGlConstant},
gpu_texture::{
- image_1d_size_bytes, image_2d_size_bytes, image_3d_size_bytes, CubeMapFace,
- GpuTextureDescriptor, GpuTextureKind, GpuTextureTrait, PixelKind,
+ CubeMapFace, GpuTextureDescriptor, GpuTextureKind, GpuTextureTrait, PixelKind,
+ image_1d_size_bytes, image_2d_size_bytes, image_3d_size_bytes,
},
};
-use glow::{HasContext, PixelUnpackData, COMPRESSED_RED_RGTC1, COMPRESSED_RG_RGTC2};
+use glow::{COMPRESSED_RED_RGTC1, COMPRESSED_RG_RGTC2, HasContext, PixelUnpackData};
use std::cell::Cell;
use std::{
marker::PhantomData,
rc::{Rc, Weak},
};
-impl GpuTextureKind {
- pub fn gl_texture_target(&self) -> u32 {
+impl ToGlConstant for GpuTextureKind {
+ fn into_gl(self) -> u32 {
match self {
Self::Line { .. } => glow::TEXTURE_1D,
Self::Rectangle { .. } => glow::TEXTURE_2D,
@@ -78,9 +78,9 @@ pub struct PixelDescriptor {
pub swizzle_mask: Option<[i32; 4]>,
}
-impl PixelKind {
- pub(crate) fn pixel_descriptor(self) -> PixelDescriptor {
- let (data_type, format, internal_format, swizzle_mask) = match self {
+impl From for PixelDescriptor {
+ fn from(value: PixelKind) -> Self {
+ let (data_type, format, internal_format, swizzle_mask) = match value {
PixelKind::R32F => (glow::FLOAT, glow::RED, glow::R32F, None),
PixelKind::R32UI => (glow::UNSIGNED_INT, glow::RED_INTEGER, glow::R32UI, None),
PixelKind::R16F => (glow::FLOAT, glow::RED, glow::R16F, None),
@@ -198,7 +198,7 @@ impl TempBinding {
let unit = server
.free_texture_unit()
.expect("Texture units limit exceeded!");
- let target = texture.kind.get().gl_texture_target();
+ let target = texture.kind.get().into_gl();
server.set_texture(unit, target, Some(texture.texture));
Self {
server,
@@ -284,11 +284,7 @@ impl GlTexture {
}
pub fn bind(&self, server: &GlGraphicsServer, sampler_index: u32) {
- server.set_texture(
- sampler_index,
- self.kind.get().gl_texture_target(),
- Some(self.texture),
- );
+ server.set_texture(sampler_index, self.kind.get().into_gl(), Some(self.texture));
}
fn make_temp_binding(&self) -> TempBinding {
@@ -385,7 +381,7 @@ impl GpuTextureTrait for GlTexture {
let mut temp_binding = self.make_temp_binding();
temp_binding.set_max_level(mip_count.saturating_sub(1));
- let target = kind.gl_texture_target();
+ let target = kind.into_gl();
unsafe {
let PixelDescriptor {
@@ -393,7 +389,7 @@ impl GpuTextureTrait for GlTexture {
format,
internal_format,
swizzle_mask,
- } = pixel_kind.pixel_descriptor();
+ } = PixelDescriptor::from(pixel_kind);
let is_compressed = pixel_kind.is_compressed();
diff --git a/fyrox-graphics/Cargo.toml b/fyrox-graphics/Cargo.toml
index c8f93aa50..325a3baca 100644
--- a/fyrox-graphics/Cargo.toml
+++ b/fyrox-graphics/Cargo.toml
@@ -8,25 +8,14 @@ keywords = ["graphics", "gapi"]
categories = ["graphics", "rendering::graphics-api"]
include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md"]
homepage = "https://fyrox.rs"
-documentation = "https://docs.rs/fyrox-ui"
+documentation = "https://docs.rs/fyrox-graphics"
repository = "https://github.com/FyroxEngine/Fyrox"
rust-version = "1.86"
[dependencies]
fyrox-core = { path = "../fyrox-core", version = "0.36.2", features = ["serde"] }
-glow = "0.16"
+
serde = { version = "1", features = ["derive"] }
strum = "0.26.1"
strum_macros = "0.26.1"
-winit = { version = "0.29.2", features = ["serde"] }
-bytemuck = { version = "1.16.1", features = ["derive"] }
-fxhash = "0.2.1"
-regex = "1"
-
-[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
-glutin = "0.31"
-glutin-winit = "0.4.2"
-raw-window-handle = "0.5.0"
-
-[target.'cfg(target_arch = "wasm32")'.dependencies]
-serde-wasm-bindgen = "0.6.3"
\ No newline at end of file
+bytemuck = { version = "1.16.1", features = ["derive"] }
\ No newline at end of file
diff --git a/fyrox-graphics/src/error.rs b/fyrox-graphics/src/error.rs
index 8ca513455..223d4251b 100644
--- a/fyrox-graphics/src/error.rs
+++ b/fyrox-graphics/src/error.rs
@@ -167,13 +167,6 @@ impl From for FrameworkError {
}
}
-#[cfg(not(target_arch = "wasm32"))]
-impl From for FrameworkError {
- fn from(err: glutin::error::Error) -> Self {
- Self::Custom(format!("{err:?}"))
- }
-}
-
impl From for FrameworkError {
fn from(v: String) -> Self {
Self::Custom(v)
diff --git a/fyrox-graphics/src/gpu_texture.rs b/fyrox-graphics/src/gpu_texture.rs
index 5f65dcf6b..4bea46416 100644
--- a/fyrox-graphics/src/gpu_texture.rs
+++ b/fyrox-graphics/src/gpu_texture.rs
@@ -147,7 +147,8 @@ pub enum PixelElementKind {
}
impl PixelKind {
- pub(crate) fn unpack_alignment(self) -> Option {
+ #[doc(hidden)]
+ pub fn unpack_alignment(self) -> Option {
match self {
Self::RGBA16
| Self::RGBA16F
diff --git a/fyrox-graphics/src/lib.rs b/fyrox-graphics/src/lib.rs
index 879abd258..1810ec8e6 100644
--- a/fyrox-graphics/src/lib.rs
+++ b/fyrox-graphics/src/lib.rs
@@ -31,7 +31,6 @@ pub mod buffer;
pub mod error;
pub mod framebuffer;
pub mod geometry_buffer;
-pub mod gl;
pub mod gpu_program;
pub mod gpu_texture;
pub mod query;
@@ -569,7 +568,7 @@ pub enum ElementKind {
}
impl ElementKind {
- fn index_per_element(self) -> usize {
+ pub fn index_per_element(self) -> usize {
match self {
ElementKind::Triangle => 3,
ElementKind::Line => 2,
diff --git a/fyrox-graphics/src/query.rs b/fyrox-graphics/src/query.rs
index e27d38797..254727949 100644
--- a/fyrox-graphics/src/query.rs
+++ b/fyrox-graphics/src/query.rs
@@ -8,14 +8,13 @@ use fyrox_core::define_as_any_trait;
use std::fmt::Debug;
/// Kind of a GPU query.
-#[repr(u32)]
#[derive(Copy, Clone, Debug)]
pub enum QueryKind {
/// Queries a number of rendered pixels; any pixel that passed all pipeline tests counts.
- SamplesPassed = glow::SAMPLES_PASSED,
+ SamplesPassed,
/// Queries a flag that defines whether the rendering operation produced any pixels or not.
- AnySamplesPassed = glow::ANY_SAMPLES_PASSED,
+ AnySamplesPassed,
}
/// Result of a query.
diff --git a/fyrox-impl/Cargo.toml b/fyrox-impl/Cargo.toml
index d9c55df19..db97b3146 100644
--- a/fyrox-impl/Cargo.toml
+++ b/fyrox-impl/Cargo.toml
@@ -23,6 +23,7 @@ fyrox-resource = { path = "../fyrox-resource", version = "0.36.2" }
fyrox-animation = { path = "../fyrox-animation", version = "0.36.2" }
fyrox-graph = { path = "../fyrox-graph", version = "0.36.2" }
fyrox-graphics = { path = "../fyrox-graphics", version = "0.36.2" }
+fyrox-graphics-gl = { path = "../fyrox-graphics-gl", version = "0.36" }
fyrox-texture = { path = "../fyrox-texture", version = "0.36.2" }
fyrox-autotile = { path = "../fyrox-autotile", version = "0.36.0" }
fyrox-material = { path = "../fyrox-material", version = "0.36" }
diff --git a/fyrox-impl/src/engine/mod.rs b/fyrox-impl/src/engine/mod.rs
index 2cb09675f..bd5e3791d 100644
--- a/fyrox-impl/src/engine/mod.rs
+++ b/fyrox-impl/src/engine/mod.rs
@@ -104,7 +104,8 @@ use crate::{
use fxhash::{FxHashMap, FxHashSet};
use fyrox_animation::AnimationTracksData;
use fyrox_core::visitor::error::VisitError;
-use fyrox_graphics::{gl::server::GlGraphicsServer, server::SharedGraphicsServer};
+use fyrox_graphics::server::SharedGraphicsServer;
+use fyrox_graphics_gl::server::GlGraphicsServer;
use fyrox_sound::{
buffer::{loader::SoundBufferLoader, SoundBuffer},
renderer::hrtf::{HrirSphereLoader, HrirSphereResourceData},