Compare commits

..

3 commits

Author SHA1 Message Date
Alex Janka 0974254c0e shaders can be either a path or a string 2024-02-09 10:15:48 +11:00
chyyran 923bc165b2 rt(vk): fix double free in RawVulkanBuffer 2024-02-08 18:09:23 -05:00
chyyran 44aa5fab7d dep: update glslang and bitflags 2024-02-08 18:08:23 -05:00
4 changed files with 21 additions and 18 deletions

10
Cargo.lock generated
View file

@ -1343,9 +1343,9 @@ dependencies = [
[[package]]
name = "glslang"
version = "0.2.3"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffa3b9c49e9b4270061e25e7e3946d979a9394a21ac51edcb72e7c17874d3a54"
checksum = "c5df6491e5d4c222a6373b892c1bea8d697fca0c087890f64f0e2975b3f8bb48"
dependencies = [
"glslang-sys",
"once_cell",
@ -1355,9 +1355,9 @@ dependencies = [
[[package]]
name = "glslang-sys"
version = "0.2.1"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3c81cefc876b4fd65354162037a464768bc5bada8b02d93b64e18186ae5cb7e"
checksum = "6d76f2d75ad6e8a12c26e77ed6443a9369ef7957daf361e751c3489a97f8b816"
dependencies = [
"cc",
"glob",
@ -1843,7 +1843,7 @@ dependencies = [
name = "librashader-reflect"
version = "0.2.0-beta.7"
dependencies = [
"bitflags 1.3.2",
"bitflags 2.4.2",
"bytemuck",
"glslang",
"indexmap 2.2.2",

View file

@ -12,11 +12,11 @@ keywords = ["shader", "retroarch", "SPIR-V"]
description = "RetroArch shaders for all."
[dependencies]
glslang = "0.2"
glslang = "0.3"
bytemuck = "1.13.0"
thiserror = "1.0.37"
bitflags = "1.3.2"
bitflags = "2.4.2"
rustc-hash = "1.1.0"
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.7" }

View file

@ -1,6 +1,5 @@
use glslang::{CompilerOptions, ShaderInput};
use crate::error::ShaderCompileError;
use glslang::input::{CompilerOptions, ShaderInput};
use glslang::limits::ResourceLimits;
use librashader_preprocess::ShaderSource;
#[cfg(feature = "serialize")]
@ -34,28 +33,31 @@ pub(crate) fn compile_spirv(
source: &ShaderSource,
) -> Result<GlslangCompilation, ShaderCompileError> {
let compiler = glslang::Compiler::acquire().ok_or(ShaderCompileError::CompilerInitError)?;
let options = CompilerOptions {
source_language: glslang::SourceLanguage::GLSL,
target: glslang::Target::Vulkan {
version: glslang::VulkanVersion::Vulkan1_0,
spirv_version: glslang::SpirvVersion::SPIRV1_0
},
version_profile: None,
};
let limits = ResourceLimits::default();
let options = CompilerOptions::default();
let vertex = glslang::input::ShaderSource::from(source.vertex.as_str());
let vertex = glslang::ShaderSource::from(source.vertex.as_str());
let vertex = ShaderInput::new(
&vertex,
&limits,
glslang::ShaderStage::Vertex,
&options,
None,
);
)?;
let vertex = compiler.create_shader(vertex)?;
let fragment = glslang::input::ShaderSource::from(source.fragment.as_str());
let fragment = glslang::ShaderSource::from(source.fragment.as_str());
let fragment = ShaderInput::new(
&fragment,
&limits,
glslang::ShaderStage::Fragment,
&options,
None,
);
)?;
let fragment = compiler.create_shader(fragment)?;
let vertex = Vec::from(vertex.compile()?);

View file

@ -162,6 +162,7 @@ pub struct Semantic<T, I = usize> {
bitflags! {
/// The pipeline stage for which a uniform is bound.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct BindingStage: u8 {
const NONE = 0b00000000;
const VERTEX = 0b00000001;