Skip to content

Commit

Permalink
Correctness pass for texture types, builtin usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Shfty committed Mar 19, 2023
1 parent 77de1f2 commit 4b0e3d1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/mesh/entry_points.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ pub fn vertex(
#[spirv(fragment)]
#[allow(unused_variables)]
pub fn fragment(
#[spirv(position)] in_clip_position: Vec4,
in_world_position: Vec4,
in_world_normal: Vec3,
in_uv: Vec2,
Expand Down
4 changes: 2 additions & 2 deletions src/mesh_view/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ pub type TextureDepthCube = Image!(cube, type = f32, sampled = true, depth = tru
pub type TextureDepthCubeArray =
Image!(cube, type = f32, sampled = true, depth = true, arrayed = true);

pub type TextureDepth2d = Image!(2D, type = f32, sampled = true, depth = true);
pub type TextureDepth2d = Image!(2D, format = r32f, sampled = false, depth = true, arrayed = false, multisampled = false);
pub type TextureDepth2dArray = Image!(2D, type = f32, sampled = true, depth = true, arrayed = true);

pub type TextureMultisampled2d = Image!(2D, type = f32, sampled = true, multisampled = true);
pub type TextureDepthMultisampled2d =
Image!(2D, type = f32, sampled = true, multisampled = true, depth = true);
Image!(type = f32, 2D, depth = true, arrayed = true, multisampled = true, sampled = false);

pub trait DepthPrepassTexture {}

Expand Down
10 changes: 5 additions & 5 deletions src/pbr/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use spirv_std::{spirv, Image, Sampler};

use crate::prelude::StandardMaterial;

pub type BaseColorTexture = Image!(2D, type = f32);
pub type EmissiveTexture = Image!(2D, type = f32);
pub type MetallicRoughnessTexture = Image!(2D, type = f32);
pub type OcclusionTexture = Image!(2D, type = f32);
pub type NormalMapTexture = Image!(2D, type = f32);
pub type BaseColorTexture = Image!(2D, type = f32, sampled = true);
pub type EmissiveTexture = Image!(2D, type = f32, sampled = true);
pub type MetallicRoughnessTexture = Image!(2D, type = f32, sampled = true);
pub type OcclusionTexture = Image!(2D, type = f32, sampled = true);
pub type NormalMapTexture = Image!(2D, type = f32, sampled = true);

#[allow(unused_variables)]
#[spirv(fragment)]
Expand Down
2 changes: 1 addition & 1 deletion src/pbr/entry_points.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ pub fn fragment(
#[spirv(front_facing)]
in_is_front: bool,

#[spirv(position)] in_frag_coord: Vec4,
#[spirv(frag_coord)] in_frag_coord: Vec4,
in_world_position: Vec4,
in_world_normal: Vec3,
#[allow(unused_variables)] in_uv: Vec2,
Expand Down
8 changes: 4 additions & 4 deletions src/shadows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub trait DirectionalShadowTextures {
) -> f32;
}

pub type DirectionalShadowTexture = Image!(2D, type = f32, depth = true);
pub type DirectionalShadowTexture = Image!(2D, type = f32, depth = true, sampled = true);

impl DirectionalShadowTextures for DirectionalShadowTexture {
fn sample_depth_reference(
Expand All @@ -29,7 +29,7 @@ impl DirectionalShadowTextures for DirectionalShadowTexture {
}
}

pub type DirectionalShadowTextureArray = Image!(2D, type = f32, depth = true, arrayed = true);
pub type DirectionalShadowTextureArray = Image!(2D, type = f32, depth = true, arrayed = true, sampled = true);

impl DirectionalShadowTextures for DirectionalShadowTextureArray {
fn sample_depth_reference(
Expand Down Expand Up @@ -59,15 +59,15 @@ pub trait PointShadowTextures {
) -> f32;
}

pub type PointShadowTexture = Image!(cube, type = f32, depth = true);
pub type PointShadowTexture = Image!(cube, type = f32, depth = true, sampled = true);

impl PointShadowTextures for PointShadowTexture {
fn sample_depth_reference(&self, sampler: &Sampler, frag_ls: Vec3, depth: f32, _: u32) -> f32 {
self.sample_depth_reference_by_lod(*sampler, frag_ls, depth, 0.0)
}
}

pub type PointShadowTextureArray = Image!(cube, type = f32, depth = true, arrayed = true);
pub type PointShadowTextureArray = Image!(cube, type = f32, depth = true, arrayed = true, sampled = true);

impl PointShadowTextures for PointShadowTextureArray {
fn sample_depth_reference(
Expand Down

0 comments on commit 4b0e3d1

Please sign in to comment.