Skip to content

Commit

Permalink
Migrate type to alias
Browse files Browse the repository at this point in the history
Following the spec, via: <gfx-rs/naga#2299>
  • Loading branch information
HeroicKatora authored and cwfitzgerald committed Jul 16, 2023
1 parent bddd9c8 commit 73b48cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions rend3-routine/shaders/src/depth.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ fn vs_main(@builtin(instance_index) shadow_number: u32, @builtin(vertex_index) v
}

{{#if (eq profile "GpuDriven")}}
type Material = GpuMaterialData;
alias Material = GpuMaterialData;

fn has_albedo_texture(material: ptr<function, Material>) -> bool { return (*material).albedo_tex != 0u; }

fn albedo_texture(material: ptr<function, Material>, samp: sampler, coords: vec2<f32>, ddx: vec2<f32>, ddy: vec2<f32>) -> vec4<f32> { return textureSampleGrad(textures[(*material).albedo_tex - 1u], samp, coords, ddx, ddy); }
{{else}}
type Material = CpuMaterialData;
alias Material = CpuMaterialData;

fn has_albedo_texture(material: ptr<function, Material>) -> bool { return bool(((*material).texture_enable >> 0u) & 0x1u); }

Expand Down Expand Up @@ -112,4 +112,4 @@ fn fs_main(vs_out: VertexOutput) {
discard;
}
{{/if}}
}
}
4 changes: 2 additions & 2 deletions rend3-routine/shaders/src/opaque.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
}

{{#if (eq profile "GpuDriven")}}
type Material = GpuMaterialData;
alias Material = GpuMaterialData;

fn has_albedo_texture(material: ptr<function, Material>) -> bool { return (*material).albedo_tex != 0u; }
fn has_normal_texture(material: ptr<function, Material>) -> bool { return (*material).normal_tex != 0u; }
Expand All @@ -143,7 +143,7 @@ fn emissive_texture(material: ptr<function, Material>, samp: sampler, coords: ve
fn anisotropy_texture(material: ptr<function, Material>, samp: sampler, coords: vec2<f32>, ddx: vec2<f32>, ddy: vec2<f32>) -> vec4<f32> { return textureSampleGrad(textures[(*material).anisotropy_tex - 1u], samp, coords, ddx, ddy); }
fn ambient_occlusion_texture(material: ptr<function, Material>, samp: sampler, coords: vec2<f32>, ddx: vec2<f32>, ddy: vec2<f32>) -> vec4<f32> { return textureSampleGrad(textures[(*material).ambient_occlusion_tex - 1u], samp, coords, ddx, ddy); }
{{else}}
type Material = CpuMaterialData;
alias Material = CpuMaterialData;

fn has_albedo_texture(material: ptr<function, Material>) -> bool { return bool(((*material).texture_enable >> 0u) & 0x1u); }
fn has_normal_texture(material: ptr<function, Material>) -> bool { return bool(((*material).texture_enable >> 1u) & 0x1u); }
Expand Down

0 comments on commit 73b48cb

Please sign in to comment.