rt: use bytemuck::offset_of instead of std::mem::offset_of

This commit is contained in:
chyyran 2024-02-14 00:54:30 -05:00 committed by Ronny Chan
parent 5c08205360
commit ad4e72f359
4 changed files with 38 additions and 37 deletions

68
Cargo.lock generated
View file

@ -1503,14 +1503,14 @@ dependencies = [
[[package]] [[package]]
name = "librashader" name = "librashader"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"ash", "ash",
"icrate 0.1.0", "icrate 0.1.0",
"librashader-cache", "librashader-cache",
"librashader-common 0.2.0-beta.9", "librashader-common 0.2.0-beta.11",
"librashader-preprocess", "librashader-preprocess",
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.11",
"librashader-reflect", "librashader-reflect",
"librashader-runtime", "librashader-runtime",
"librashader-runtime-d3d11", "librashader-runtime-d3d11",
@ -1535,7 +1535,7 @@ dependencies = [
[[package]] [[package]]
name = "librashader-cache" name = "librashader-cache"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"bincode", "bincode",
"blake3", "blake3",
@ -1551,7 +1551,7 @@ dependencies = [
[[package]] [[package]]
name = "librashader-capi" name = "librashader-capi"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"ash", "ash",
"gl", "gl",
@ -1576,7 +1576,7 @@ dependencies = [
[[package]] [[package]]
name = "librashader-common" name = "librashader-common"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"ash", "ash",
"gl", "gl",
@ -1588,11 +1588,11 @@ dependencies = [
[[package]] [[package]]
name = "librashader-preprocess" name = "librashader-preprocess"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"encoding_rs", "encoding_rs",
"glob", "glob",
"librashader-common 0.2.0-beta.9", "librashader-common 0.2.0-beta.11",
"librashader-presets 0.1.4", "librashader-presets 0.1.4",
"nom", "nom",
"rayon", "rayon",
@ -1615,10 +1615,10 @@ dependencies = [
[[package]] [[package]]
name = "librashader-presets" name = "librashader-presets"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"glob", "glob",
"librashader-common 0.2.0-beta.9", "librashader-common 0.2.0-beta.11",
"nom", "nom",
"nom_locate", "nom_locate",
"num-traits", "num-traits",
@ -1632,15 +1632,15 @@ dependencies = [
[[package]] [[package]]
name = "librashader-reflect" name = "librashader-reflect"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.4.2",
"bytemuck", "bytemuck",
"glslang", "glslang",
"indexmap 2.2.3", "indexmap 2.2.3",
"librashader-common 0.2.0-beta.9", "librashader-common 0.2.0-beta.11",
"librashader-preprocess", "librashader-preprocess",
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.11",
"librashader-spirv-cross", "librashader-spirv-cross",
"matches", "matches",
"naga", "naga",
@ -1654,13 +1654,13 @@ dependencies = [
[[package]] [[package]]
name = "librashader-runtime" name = "librashader-runtime"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"image", "image",
"librashader-common 0.2.0-beta.9", "librashader-common 0.2.0-beta.11",
"librashader-preprocess", "librashader-preprocess",
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.11",
"librashader-reflect", "librashader-reflect",
"num-traits", "num-traits",
"rustc-hash", "rustc-hash",
@ -1668,15 +1668,15 @@ dependencies = [
[[package]] [[package]]
name = "librashader-runtime-d3d11" name = "librashader-runtime-d3d11"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"array-concat", "array-concat",
"bytemuck", "bytemuck",
"gfx-maths", "gfx-maths",
"librashader-cache", "librashader-cache",
"librashader-common 0.2.0-beta.9", "librashader-common 0.2.0-beta.11",
"librashader-preprocess", "librashader-preprocess",
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.11",
"librashader-reflect", "librashader-reflect",
"librashader-runtime", "librashader-runtime",
"rayon", "rayon",
@ -1687,7 +1687,7 @@ dependencies = [
[[package]] [[package]]
name = "librashader-runtime-d3d12" name = "librashader-runtime-d3d12"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"array-concat", "array-concat",
"array-init", "array-init",
@ -1695,9 +1695,9 @@ dependencies = [
"bytemuck", "bytemuck",
"gfx-maths", "gfx-maths",
"librashader-cache", "librashader-cache",
"librashader-common 0.2.0-beta.9", "librashader-common 0.2.0-beta.11",
"librashader-preprocess", "librashader-preprocess",
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.11",
"librashader-reflect", "librashader-reflect",
"librashader-runtime", "librashader-runtime",
"parking_lot", "parking_lot",
@ -1710,16 +1710,16 @@ dependencies = [
[[package]] [[package]]
name = "librashader-runtime-gl" name = "librashader-runtime-gl"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"concat-arrays", "concat-arrays",
"gl", "gl",
"glfw 0.47.0", "glfw 0.47.0",
"librashader-cache", "librashader-cache",
"librashader-common 0.2.0-beta.9", "librashader-common 0.2.0-beta.11",
"librashader-preprocess", "librashader-preprocess",
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.11",
"librashader-reflect", "librashader-reflect",
"librashader-runtime", "librashader-runtime",
"librashader-spirv-cross", "librashader-spirv-cross",
@ -1731,14 +1731,14 @@ dependencies = [
[[package]] [[package]]
name = "librashader-runtime-mtl" name = "librashader-runtime-mtl"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"array-concat", "array-concat",
"bytemuck", "bytemuck",
"icrate 0.1.0", "icrate 0.1.0",
"librashader-common 0.2.0-beta.9", "librashader-common 0.2.0-beta.11",
"librashader-preprocess", "librashader-preprocess",
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.11",
"librashader-reflect", "librashader-reflect",
"librashader-runtime", "librashader-runtime",
"objc2 0.5.0", "objc2 0.5.0",
@ -1749,7 +1749,7 @@ dependencies = [
[[package]] [[package]]
name = "librashader-runtime-vk" name = "librashader-runtime-vk"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"array-concat", "array-concat",
"ash", "ash",
@ -1758,9 +1758,9 @@ dependencies = [
"glfw 0.49.1", "glfw 0.49.1",
"gpu-allocator 0.22.0", "gpu-allocator 0.22.0",
"librashader-cache", "librashader-cache",
"librashader-common 0.2.0-beta.9", "librashader-common 0.2.0-beta.11",
"librashader-preprocess", "librashader-preprocess",
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.11",
"librashader-reflect", "librashader-reflect",
"librashader-runtime", "librashader-runtime",
"num", "num",
@ -1774,16 +1774,16 @@ dependencies = [
[[package]] [[package]]
name = "librashader-runtime-wgpu" name = "librashader-runtime-wgpu"
version = "0.2.0-beta.9" version = "0.2.0-beta.11"
dependencies = [ dependencies = [
"array-concat", "array-concat",
"bytemuck", "bytemuck",
"config", "config",
"env_logger", "env_logger",
"image", "image",
"librashader-common 0.2.0-beta.9", "librashader-common 0.2.0-beta.11",
"librashader-preprocess", "librashader-preprocess",
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.11",
"librashader-reflect", "librashader-reflect",
"librashader-runtime", "librashader-runtime",
"log", "log",

View file

@ -1,7 +1,7 @@
use crate::gl::FINAL_VBO_DATA; use crate::gl::FINAL_VBO_DATA;
use crate::gl::{DrawQuad, OpenGLVertex}; use crate::gl::{DrawQuad, OpenGLVertex};
use gl::types::{GLsizei, GLsizeiptr, GLuint}; use gl::types::{GLsizei, GLsizeiptr, GLuint};
use std::mem::offset_of; use bytemuck::offset_of;
pub struct Gl3DrawQuad { pub struct Gl3DrawQuad {
vbo: GLuint, vbo: GLuint,

View file

@ -1,7 +1,8 @@
use crate::gl::FINAL_VBO_DATA; use crate::gl::FINAL_VBO_DATA;
use crate::gl::{DrawQuad, OpenGLVertex}; use crate::gl::{DrawQuad, OpenGLVertex};
use gl::types::{GLint, GLsizeiptr, GLuint}; use gl::types::{GLint, GLsizeiptr, GLuint};
use std::mem::offset_of; use bytemuck::offset_of;
pub struct Gl46DrawQuad { pub struct Gl46DrawQuad {
vbo: GLuint, vbo: GLuint,
vao: GLuint, vao: GLuint,

View file

@ -16,7 +16,7 @@ use librashader_reflect::back::ShaderCompilerOutput;
use librashader_runtime::render_target::RenderTarget; use librashader_runtime::render_target::RenderTarget;
use objc2::rc::Id; use objc2::rc::Id;
use objc2::runtime::ProtocolObject; 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. /// 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; pub const VERTEX_BUFFER_INDEX: usize = 4;