Get naga_oil shaders working

This commit is contained in:
Aaron Hill 2023-01-18 22:17:54 -05:00 committed by Nathan Adams
parent 6fe7af58d5
commit 0fe8ef6c2d
8 changed files with 10 additions and 8 deletions

4
Cargo.lock generated
View File

@ -2621,14 +2621,16 @@ dependencies = [
[[package]]
name = "naga_oil"
version = "0.4.2"
source = "git+https://github.com/Dinnerbone/naga_oil?rev=c073f6fdf0560a74480140abc50295f9e0d9aa57#c073f6fdf0560a74480140abc50295f9e0d9aa57"
source = "git+https://github.com/robtfm/naga_oil?rev=7976b701fdf4069802f380f0f58acb99abc167ec#7976b701fdf4069802f380f0f58acb99abc167ec"
dependencies = [
"bit-set",
"codespan-reporting",
"data-encoding",
"naga",
"once_cell",
"regex",
"regex-syntax",
"rustc-hash",
"thiserror",
"tracing",
]

View File

@ -18,7 +18,7 @@ enum-map = "2.4.2"
fnv = "1.0.7"
swf = { path = "../../swf" }
image = { version = "0.24.5", default-features = false }
naga_oil = { git = "https://github.com/Dinnerbone/naga_oil", rev = "c073f6fdf0560a74480140abc50295f9e0d9aa57" }
naga_oil = { git = "https://github.com/robtfm/naga_oil", rev = "7976b701fdf4069802f380f0f58acb99abc167ec", features = ["override_any"] }
ouroboros = "0.15.5"
typed-arena = "2.0.2"
once_cell = "1.17.0"

View File

@ -25,7 +25,7 @@ fn main_vertex(in: common::VertexInput) -> VertexOutput {
#if use_push_constants == true
var transforms = pc.transforms;
#endif
let matrix_ = textureTransforms.matrix_;
let matrix_ = textureTransforms.texture_matrix;
let uv = (mat3x3<f32>(matrix_[0].xyz, matrix_[1].xyz, matrix_[2].xyz) * vec3<f32>(in.position, 1.0)).xy;
let pos = common::globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
return VertexOutput(pos, uv);

View File

@ -28,7 +28,7 @@ struct ColorTransforms {
struct TextureTransforms {
/// The transform matrix of the gradient or texture.
/// Transforms from object space to UV space.
matrix_: mat4x4<f32>,
texture_matrix: mat4x4<f32>,
};
struct PushConstants {

View File

@ -21,7 +21,7 @@ struct VertexOutput {
@vertex
fn main_vertex(in: common::VertexInput) -> VertexOutput {
let matrix_ = textureTransforms.matrix_;
let matrix_ = textureTransforms.texture_matrix;
let uv = (mat3x3<f32>(matrix_[0].xyz, matrix_[1].xyz, matrix_[2].xyz) * vec3<f32>(in.position, 1.0)).xy;
let pos = common::globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
return VertexOutput(pos, uv);

View File

@ -21,7 +21,7 @@ struct VertexOutput {
@vertex
fn main_vertex(in: common::VertexInput) -> VertexOutput {
let matrix_ = textureTransforms.matrix_;
let matrix_ = textureTransforms.texture_matrix;
let uv = (mat3x3<f32>(matrix_[0].xyz, matrix_[1].xyz, matrix_[2].xyz) * vec3<f32>(in.position, 1.0)).xy;
let pos = common::globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
return VertexOutput(pos, uv);

View File

@ -64,7 +64,7 @@ fn main_vertex(in: common::VertexInput) -> VertexOutput {
#if use_push_constants == true
var transforms = pc.transforms;
#endif
let matrix_ = textureTransforms.matrix_;
let matrix_ = textureTransforms.texture_matrix;
let uv = (mat3x3<f32>(matrix_[0].xyz, matrix_[1].xyz, matrix_[2].xyz) * vec3<f32>(in.position, 1.0)).xy;
let pos = common::globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
return VertexOutput(pos, uv);

View File

@ -122,7 +122,7 @@ fn make_shader(
shader_defs: shader_defs.clone(),
..Default::default()
})
.unwrap_or_else(|_| panic!("{name} failed to compile")),
.unwrap_or_else(|e| panic!("{name} failed to compile: {e}\n{e:?}")),
)),
})
}