From ad4e72f3594a0f8568fc10697c7b98c8d882571a Mon Sep 17 00:00:00 2001 From: chyyran Date: Wed, 14 Feb 2024 00:54:30 -0500 Subject: [PATCH] rt: use bytemuck::offset_of instead of std::mem::offset_of --- Cargo.lock | 68 +++++++++---------- .../src/gl/gl3/draw_quad.rs | 2 +- .../src/gl/gl46/draw_quad.rs | 3 +- .../src/graphics_pipeline.rs | 2 +- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4360aed..af80b88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1503,14 +1503,14 @@ dependencies = [ [[package]] name = "librashader" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "ash", "icrate 0.1.0", "librashader-cache", - "librashader-common 0.2.0-beta.9", + "librashader-common 0.2.0-beta.11", "librashader-preprocess", - "librashader-presets 0.2.0-beta.9", + "librashader-presets 0.2.0-beta.11", "librashader-reflect", "librashader-runtime", "librashader-runtime-d3d11", @@ -1535,7 +1535,7 @@ dependencies = [ [[package]] name = "librashader-cache" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "bincode", "blake3", @@ -1551,7 +1551,7 @@ dependencies = [ [[package]] name = "librashader-capi" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "ash", "gl", @@ -1576,7 +1576,7 @@ dependencies = [ [[package]] name = "librashader-common" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "ash", "gl", @@ -1588,11 +1588,11 @@ dependencies = [ [[package]] name = "librashader-preprocess" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "encoding_rs", "glob", - "librashader-common 0.2.0-beta.9", + "librashader-common 0.2.0-beta.11", "librashader-presets 0.1.4", "nom", "rayon", @@ -1615,10 +1615,10 @@ dependencies = [ [[package]] name = "librashader-presets" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "glob", - "librashader-common 0.2.0-beta.9", + "librashader-common 0.2.0-beta.11", "nom", "nom_locate", "num-traits", @@ -1632,15 +1632,15 @@ dependencies = [ [[package]] name = "librashader-reflect" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "bitflags 2.4.2", "bytemuck", "glslang", "indexmap 2.2.3", - "librashader-common 0.2.0-beta.9", + "librashader-common 0.2.0-beta.11", "librashader-preprocess", - "librashader-presets 0.2.0-beta.9", + "librashader-presets 0.2.0-beta.11", "librashader-spirv-cross", "matches", "naga", @@ -1654,13 +1654,13 @@ dependencies = [ [[package]] name = "librashader-runtime" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "bytemuck", "image", - "librashader-common 0.2.0-beta.9", + "librashader-common 0.2.0-beta.11", "librashader-preprocess", - "librashader-presets 0.2.0-beta.9", + "librashader-presets 0.2.0-beta.11", "librashader-reflect", "num-traits", "rustc-hash", @@ -1668,15 +1668,15 @@ dependencies = [ [[package]] name = "librashader-runtime-d3d11" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "array-concat", "bytemuck", "gfx-maths", "librashader-cache", - "librashader-common 0.2.0-beta.9", + "librashader-common 0.2.0-beta.11", "librashader-preprocess", - "librashader-presets 0.2.0-beta.9", + "librashader-presets 0.2.0-beta.11", "librashader-reflect", "librashader-runtime", "rayon", @@ -1687,7 +1687,7 @@ dependencies = [ [[package]] name = "librashader-runtime-d3d12" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "array-concat", "array-init", @@ -1695,9 +1695,9 @@ dependencies = [ "bytemuck", "gfx-maths", "librashader-cache", - "librashader-common 0.2.0-beta.9", + "librashader-common 0.2.0-beta.11", "librashader-preprocess", - "librashader-presets 0.2.0-beta.9", + "librashader-presets 0.2.0-beta.11", "librashader-reflect", "librashader-runtime", "parking_lot", @@ -1710,16 +1710,16 @@ dependencies = [ [[package]] name = "librashader-runtime-gl" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "bytemuck", "concat-arrays", "gl", "glfw 0.47.0", "librashader-cache", - "librashader-common 0.2.0-beta.9", + "librashader-common 0.2.0-beta.11", "librashader-preprocess", - "librashader-presets 0.2.0-beta.9", + "librashader-presets 0.2.0-beta.11", "librashader-reflect", "librashader-runtime", "librashader-spirv-cross", @@ -1731,14 +1731,14 @@ dependencies = [ [[package]] name = "librashader-runtime-mtl" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "array-concat", "bytemuck", "icrate 0.1.0", - "librashader-common 0.2.0-beta.9", + "librashader-common 0.2.0-beta.11", "librashader-preprocess", - "librashader-presets 0.2.0-beta.9", + "librashader-presets 0.2.0-beta.11", "librashader-reflect", "librashader-runtime", "objc2 0.5.0", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "librashader-runtime-vk" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "array-concat", "ash", @@ -1758,9 +1758,9 @@ dependencies = [ "glfw 0.49.1", "gpu-allocator 0.22.0", "librashader-cache", - "librashader-common 0.2.0-beta.9", + "librashader-common 0.2.0-beta.11", "librashader-preprocess", - "librashader-presets 0.2.0-beta.9", + "librashader-presets 0.2.0-beta.11", "librashader-reflect", "librashader-runtime", "num", @@ -1774,16 +1774,16 @@ dependencies = [ [[package]] name = "librashader-runtime-wgpu" -version = "0.2.0-beta.9" +version = "0.2.0-beta.11" dependencies = [ "array-concat", "bytemuck", "config", "env_logger", "image", - "librashader-common 0.2.0-beta.9", + "librashader-common 0.2.0-beta.11", "librashader-preprocess", - "librashader-presets 0.2.0-beta.9", + "librashader-presets 0.2.0-beta.11", "librashader-reflect", "librashader-runtime", "log", diff --git a/librashader-runtime-gl/src/gl/gl3/draw_quad.rs b/librashader-runtime-gl/src/gl/gl3/draw_quad.rs index d506d4a..adfa291 100644 --- a/librashader-runtime-gl/src/gl/gl3/draw_quad.rs +++ b/librashader-runtime-gl/src/gl/gl3/draw_quad.rs @@ -1,7 +1,7 @@ use crate::gl::FINAL_VBO_DATA; use crate::gl::{DrawQuad, OpenGLVertex}; use gl::types::{GLsizei, GLsizeiptr, GLuint}; -use std::mem::offset_of; +use bytemuck::offset_of; pub struct Gl3DrawQuad { vbo: GLuint, diff --git a/librashader-runtime-gl/src/gl/gl46/draw_quad.rs b/librashader-runtime-gl/src/gl/gl46/draw_quad.rs index 4ba0656..ca9327b 100644 --- a/librashader-runtime-gl/src/gl/gl46/draw_quad.rs +++ b/librashader-runtime-gl/src/gl/gl46/draw_quad.rs @@ -1,7 +1,8 @@ use crate::gl::FINAL_VBO_DATA; use crate::gl::{DrawQuad, OpenGLVertex}; use gl::types::{GLint, GLsizeiptr, GLuint}; -use std::mem::offset_of; +use bytemuck::offset_of; + pub struct Gl46DrawQuad { vbo: GLuint, vao: GLuint, diff --git a/librashader-runtime-mtl/src/graphics_pipeline.rs b/librashader-runtime-mtl/src/graphics_pipeline.rs index ff43d7e..61d97c9 100644 --- a/librashader-runtime-mtl/src/graphics_pipeline.rs +++ b/librashader-runtime-mtl/src/graphics_pipeline.rs @@ -16,7 +16,7 @@ use librashader_reflect::back::ShaderCompilerOutput; use librashader_runtime::render_target::RenderTarget; use objc2::rc::Id; use objc2::runtime::ProtocolObject; -use std::mem::offset_of; +use bytemuck::offset_of; /// This is only really plausible for SPIRV-Cross, for Naga we need to supply the next plausible binding. pub const VERTEX_BUFFER_INDEX: usize = 4;