ci: emit github warnings on failure
This commit is contained in:
parent
c7dd7796db
commit
b5bc3c11e1
2
.github/workflows/full-test.yml
vendored
2
.github/workflows/full-test.yml
vendored
|
@ -32,4 +32,4 @@ jobs:
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
override: true
|
override: true
|
||||||
- name: Test
|
- name: Test
|
||||||
run: cargo test -p librashader --test reflect -- --nocapture
|
run: cargo test -p librashader --features=github-ci --test reflect -- --nocapture
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
use glob::glob;
|
|
||||||
use librashader_preprocess::ShaderSource;
|
|
||||||
use librashader_presets::ShaderPreset;
|
|
||||||
use rayon::prelude::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn preprocess_all_slang_presets_parsed() {
|
|
||||||
for entry in glob("../test/slang-shaders/**/*.slangp").unwrap() {
|
|
||||||
if let Ok(path) = entry {
|
|
||||||
if let Ok(preset) = ShaderPreset::try_parse(&path) {
|
|
||||||
preset.shaders.into_par_iter().for_each(|shader| {
|
|
||||||
if let Err(e) = ShaderSource::load(&shader.name) {
|
|
||||||
println!(
|
|
||||||
"Failed to preprocess shader {} from preset {}: {:?}",
|
|
||||||
shader.name.display(),
|
|
||||||
path.display(),
|
|
||||||
e
|
|
||||||
);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,17 +5,22 @@ pub trait OutputTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Shader compiler target for GLSL.
|
/// Shader compiler target for GLSL.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct GLSL;
|
pub struct GLSL;
|
||||||
/// Shader compiler target for HLSL.
|
/// Shader compiler target for HLSL.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct HLSL;
|
pub struct HLSL;
|
||||||
/// Shader compiler target for SPIR-V.
|
/// Shader compiler target for SPIR-V.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct SPIRV;
|
pub struct SPIRV;
|
||||||
/// Shader compiler target for MSL.
|
/// Shader compiler target for MSL.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct MSL;
|
pub struct MSL;
|
||||||
/// Shader compiler target for DXIL.
|
/// Shader compiler target for DXIL.
|
||||||
///
|
///
|
||||||
/// The resulting DXIL object is always unvalidated and
|
/// The resulting DXIL object is always unvalidated and
|
||||||
/// must be validated using platform APIs before usage.
|
/// must be validated using platform APIs before usage.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct DXIL;
|
pub struct DXIL;
|
||||||
|
|
||||||
/// Shader compiler target for WGSL.
|
/// Shader compiler target for WGSL.
|
||||||
|
|
|
@ -36,8 +36,8 @@ mod test {
|
||||||
use crate::reflect::semantics::{Semantic, ShaderSemantics, UniformSemantic, UniqueSemantics};
|
use crate::reflect::semantics::{Semantic, ShaderSemantics, UniformSemantic, UniqueSemantics};
|
||||||
use crate::reflect::ReflectShader;
|
use crate::reflect::ReflectShader;
|
||||||
use bitflags::Flags;
|
use bitflags::Flags;
|
||||||
|
use librashader_common::map::FastHashMap;
|
||||||
use librashader_preprocess::ShaderSource;
|
use librashader_preprocess::ShaderSource;
|
||||||
use rustc_hash::FxHashMap;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_into() {
|
pub fn test_into() {
|
||||||
|
@ -45,7 +45,7 @@ mod test {
|
||||||
// let result = ShaderSource::load("../test/shaders_slang/crt/shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.slang").unwrap();
|
// let result = ShaderSource::load("../test/shaders_slang/crt/shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.slang").unwrap();
|
||||||
let result = ShaderSource::load("../test/basic.slang").unwrap();
|
let result = ShaderSource::load("../test/basic.slang").unwrap();
|
||||||
|
|
||||||
let mut uniform_semantics: FxHashMap<String, UniformSemantic> = Default::default();
|
let mut uniform_semantics: FastHashMap<String, UniformSemantic> = Default::default();
|
||||||
|
|
||||||
for (_index, param) in result.parameters.iter().enumerate() {
|
for (_index, param) in result.parameters.iter().enumerate() {
|
||||||
uniform_semantics.insert(
|
uniform_semantics.insert(
|
||||||
|
|
|
@ -11,6 +11,7 @@ use crate::reflect::semantics::{
|
||||||
MAX_BINDINGS_COUNT, MAX_PUSH_BUFFER_SIZE,
|
MAX_BINDINGS_COUNT, MAX_PUSH_BUFFER_SIZE,
|
||||||
};
|
};
|
||||||
use crate::reflect::{align_uniform_size, ReflectShader};
|
use crate::reflect::{align_uniform_size, ReflectShader};
|
||||||
|
use std::fmt::{Debug};
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use spirv_cross::spirv::{Ast, Decoration, Module, Resource, ShaderResources, Type};
|
use spirv_cross::spirv::{Ast, Decoration, Module, Resource, ShaderResources, Type};
|
||||||
|
@ -19,6 +20,7 @@ use spirv_cross::ErrorCode;
|
||||||
use crate::reflect::helper::{SemanticErrorBlame, TextureData, UboData};
|
use crate::reflect::helper::{SemanticErrorBlame, TextureData, UboData};
|
||||||
|
|
||||||
/// Reflect shaders under SPIRV-Cross semantics.
|
/// Reflect shaders under SPIRV-Cross semantics.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct SpirvCross;
|
pub struct SpirvCross;
|
||||||
|
|
||||||
// This is "probably" OK.
|
// This is "probably" OK.
|
||||||
|
|
|
@ -3,6 +3,7 @@ pub mod spirv;
|
||||||
pub mod wgsl;
|
pub mod wgsl;
|
||||||
|
|
||||||
use crate::error::{SemanticsErrorKind, ShaderReflectError};
|
use crate::error::{SemanticsErrorKind, ShaderReflectError};
|
||||||
|
use std::fmt::{Debug};
|
||||||
|
|
||||||
use crate::front::SpirvCompilation;
|
use crate::front::SpirvCompilation;
|
||||||
use naga::{
|
use naga::{
|
||||||
|
@ -27,8 +28,8 @@ use crate::reflect::{align_uniform_size, ReflectShader, ShaderReflection};
|
||||||
///
|
///
|
||||||
/// The Naga reflector will lower combined image samplers to split,
|
/// The Naga reflector will lower combined image samplers to split,
|
||||||
/// with the same bind point on descriptor group 1.
|
/// with the same bind point on descriptor group 1.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Naga;
|
pub struct Naga;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct NagaReflect {
|
pub(crate) struct NagaReflect {
|
||||||
pub(crate) vertex: Module,
|
pub(crate) vertex: Module,
|
||||||
|
|
|
@ -164,15 +164,15 @@ mod test {
|
||||||
use crate::reflect::semantics::{Semantic, ShaderSemantics, UniformSemantic, UniqueSemantics};
|
use crate::reflect::semantics::{Semantic, ShaderSemantics, UniformSemantic, UniqueSemantics};
|
||||||
use crate::reflect::ReflectShader;
|
use crate::reflect::ReflectShader;
|
||||||
use bitflags::Flags;
|
use bitflags::Flags;
|
||||||
|
use librashader_common::map::FastHashMap;
|
||||||
use librashader_preprocess::ShaderSource;
|
use librashader_preprocess::ShaderSource;
|
||||||
use rustc_hash::FxHashMap;
|
|
||||||
use spirv_cross::msl;
|
use spirv_cross::msl;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_into() {
|
pub fn test_into() {
|
||||||
let result = ShaderSource::load("../test/basic.slang").unwrap();
|
let result = ShaderSource::load("../test/basic.slang").unwrap();
|
||||||
|
|
||||||
let mut uniform_semantics: FxHashMap<String, UniformSemantic> = Default::default();
|
let mut uniform_semantics: FastHashMap<String, UniformSemantic> = Default::default();
|
||||||
|
|
||||||
for (_index, param) in result.parameters.iter().enumerate() {
|
for (_index, param) in result.parameters.iter().enumerate() {
|
||||||
uniform_semantics.insert(
|
uniform_semantics.insert(
|
||||||
|
|
|
@ -3,8 +3,8 @@ use crate::util;
|
||||||
use librashader_reflect::back::wgsl::NagaWgslContext;
|
use librashader_reflect::back::wgsl::NagaWgslContext;
|
||||||
use librashader_reflect::back::ShaderCompilerOutput;
|
use librashader_reflect::back::ShaderCompilerOutput;
|
||||||
use librashader_reflect::reflect::ShaderReflection;
|
use librashader_reflect::reflect::ShaderReflection;
|
||||||
use librashader_runtime::render_target::RenderTarget;
|
|
||||||
use librashader_runtime::quad::VertexInput;
|
use librashader_runtime::quad::VertexInput;
|
||||||
|
use librashader_runtime::render_target::RenderTarget;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use wgpu::{
|
use wgpu::{
|
||||||
|
|
|
@ -74,6 +74,9 @@ full = ["runtime-all", "reflect-all", "preprocess", "presets"]
|
||||||
# cache hack
|
# cache hack
|
||||||
docsrs = ["librashader-cache/docsrs", "objc2/unstable-docsrs"]
|
docsrs = ["librashader-cache/docsrs", "objc2/unstable-docsrs"]
|
||||||
|
|
||||||
|
# emits warning messages in tests
|
||||||
|
github-ci = []
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
glob = "0.3.1"
|
glob = "0.3.1"
|
||||||
rayon = "1.6.1"
|
rayon = "1.6.1"
|
||||||
|
|
|
@ -25,9 +25,18 @@ fn collect_all_slang_presets() -> Vec<(PathBuf, ShaderPreset)> {
|
||||||
.into_par_iter()
|
.into_par_iter()
|
||||||
.filter_map(|entry| {
|
.filter_map(|entry| {
|
||||||
if let Ok(path) = entry {
|
if let Ok(path) = entry {
|
||||||
if let Ok(preset) = ShaderPreset::try_parse(&path) {
|
match ShaderPreset::try_parse(&path) {
|
||||||
println!("[INFO] Parsing preset {path:?}");
|
Ok(preset) => {
|
||||||
return Some((path, preset));
|
println!("[INFO] Parsing preset {path:?}");
|
||||||
|
return Some((path, preset));
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
#[cfg(feature = "github-ci")]
|
||||||
|
println!(
|
||||||
|
"::warning file={},title=Failed to parse preset::{e:?}",
|
||||||
|
path.display()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return None;
|
return None;
|
||||||
|
@ -62,28 +71,80 @@ pub fn preprocess_all_slang_presets_parsed() {
|
||||||
path.display(),
|
path.display(),
|
||||||
e
|
e
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#[cfg(feature = "github-ci")]
|
||||||
|
println!(
|
||||||
|
"::warning file={},title=Failed to preprocess shader::{e:?}",
|
||||||
|
path.display()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compile_presets<O: OutputTarget, R>()
|
trait TypeDebug {
|
||||||
|
const DEBUG: &'static str;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TypeDebug for Naga {
|
||||||
|
const DEBUG: &'static str = "Naga";
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TypeDebug for SpirvCross {
|
||||||
|
const DEBUG: &'static str = "SpirvCross";
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TypeDebug for DXIL {
|
||||||
|
const DEBUG: &'static str = "DXIL";
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TypeDebug for HLSL {
|
||||||
|
const DEBUG: &'static str = "HLSL";
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TypeDebug for WGSL {
|
||||||
|
const DEBUG: &'static str = "WGSL";
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TypeDebug for SPIRV {
|
||||||
|
const DEBUG: &'static str = "SPIRV";
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TypeDebug for GLSL {
|
||||||
|
const DEBUG: &'static str = "GLSL";
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TypeDebug for MSL {
|
||||||
|
const DEBUG: &'static str = "MSL";
|
||||||
|
}
|
||||||
|
|
||||||
|
fn compile_presets<O: OutputTarget, R: TypeDebug>()
|
||||||
where
|
where
|
||||||
O: Sized,
|
O: Sized,
|
||||||
O: FromCompilation<SpirvCompilation, R>,
|
O: FromCompilation<SpirvCompilation, R>,
|
||||||
|
O: TypeDebug,
|
||||||
{
|
{
|
||||||
let presets = ALL_SLANG_PRESETS.read().unwrap();
|
let presets = ALL_SLANG_PRESETS.read().unwrap();
|
||||||
presets.par_iter().for_each(|(path, preset)| {
|
presets.par_iter().for_each(|(path, preset)| {
|
||||||
println!(
|
println!(
|
||||||
"[INFO] Compiling {path:?} into {} reflecting with {}",
|
"[INFO] Compiling {} into {} reflecting with {}",
|
||||||
std::any::type_name::<O>(),
|
path.display(),
|
||||||
std::any::type_name::<R>()
|
O::DEBUG,
|
||||||
|
R::DEBUG
|
||||||
);
|
);
|
||||||
if let Err(e) = O::compile_preset_passes::<SpirvCompilation, R, Box<dyn Error>>(
|
if let Err(e) = O::compile_preset_passes::<SpirvCompilation, R, Box<dyn Error>>(
|
||||||
preset.shaders.clone(),
|
preset.shaders.clone(),
|
||||||
&preset.textures,
|
&preset.textures,
|
||||||
) {
|
) {
|
||||||
eprintln!("[ERROR] {:?} ({path:?})", e);
|
eprintln!("[ERROR] {:?} ({path:?})", e);
|
||||||
|
|
||||||
|
#[cfg(feature = "github-ci")]
|
||||||
|
println!(
|
||||||
|
"::warning file={},title=Failed to reflect {} with {}::{e}",
|
||||||
|
path.display(),
|
||||||
|
O::DEBUG,
|
||||||
|
R::DEBUG
|
||||||
|
)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue