Skip to content

Instantly share code, notes, and snippets.

@DGriffin91
DGriffin91 / waw_mip.rs
Created August 29, 2024 20:07
SYNC-HAZARD-WRITE-AFTER-WRITE when writing to multiple mips
mod profile_with_puffin;
use {
bytemuck::cast_slice, inline_spirv::inline_spirv, screen_13::prelude::*,
screen_13_window::Window, std::sync::Arc, winit::dpi::PhysicalSize,
};
// A Vulkan triangle using a graphic pipeline, vertex/fragment shaders, and index/vertex buffers.
fn main() -> anyhow::Result<()> {
pretty_env_logger::init();
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
table.spirt-table-90c2056d-5b38-4644-824a-b4be1c82f14d {
border-collapse: collapse;
}
table.spirt-table-90c2056d-5b38-4644-824a-b4be1c82f14d>tbody>tr>*:not(:only-child) {
@DGriffin91
DGriffin91 / bevy_solar_eclipse.rs
Created December 18, 2023 08:41
Somewhat to scale solar eclipse with point light except the sun is way too close.
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
fn setup(
@DGriffin91
DGriffin91 / deferred_rendering.rs
Created October 28, 2023 22:57
Test Deferred lighting ids
//! This example compares Forward, Forward + Prepass, and Deferred rendering.
use std::f32::consts::*;
use bevy::{
core_pipeline::{
fxaa::Fxaa,
prepass::{DeferredPrepass, DepthPrepass, MotionVectorPrepass, NormalPrepass},
},
pbr::NotShadowReceiver,
@DGriffin91
DGriffin91 / xyz8e5.rs
Created July 31, 2023 09:29
Shared exponent float format
use glam::{vec3, Vec3};
pub const XYZ8E5_EXPONENT_BITS: i32 = 5;
pub const XYZ8E5_MANTISSA_BITS: i32 = 8;
pub const XYZ8E5_MANTISSA_BITSU: u32 = 8;
pub const XYZ8E5_EXP_BIAS: i32 = 15;
pub const XYZ8E5_MAX_VALID_BIASED_EXP: i32 = 31;
/*
pub const MAX_XYZ8E5_EXP: i32 = 16;
@DGriffin91
DGriffin91 / deferred_rendering.rs
Created July 24, 2023 07:41
Normals test for deferred PR
//! This example compares Forward, Forward + Prepass, and Deferred rendering.
use std::f32::consts::*;
use bevy::{
core_pipeline::{
fxaa::Fxaa,
prepass::{DeferredPrepass, DepthPrepass, MotionVectorPrepass, NormalPrepass},
},
pbr::{CascadeShadowConfigBuilder, DirectionalLightShadowMap},
@DGriffin91
DGriffin91 / scene.rs
Created July 24, 2023 07:30
Deferred test but without deferred and setup for testing normals percision
//! This example compares Forward, Forward + Prepass, and Deferred rendering.
use std::f32::consts::*;
use bevy::{
core_pipeline::{
fxaa::Fxaa,
prepass::{DepthPrepass, MotionVectorPrepass, NormalPrepass},
},
pbr::{CascadeShadowConfigBuilder, DirectionalLightShadowMap},
@DGriffin91
DGriffin91 / scene.rs
Last active June 27, 2023 18:47
Deferred test but without deferred
//! This example compares Forward, Forward + Prepass, and Deferred rendering.
use std::f32::consts::*;
use bevy::{
core_pipeline::{
fxaa::Fxaa,
prepass::{DepthPrepass, MotionVectorPrepass, NormalPrepass},
},
pbr::NotShadowCaster,
@DGriffin91
DGriffin91 / lib.rs
Created June 15, 2023 23:09
Automatically resizing an image relative to the viewport size in bevy
// License: Apache-2.0 / MIT
// Bevy main 0.11
use bevy::{asset::Asset, prelude::*, reflect::TypeUuid, utils::Uuid};
///For automatically resizing an image relative to the viewport size
pub trait ImageUpdate {
fn update(&mut self, name: &Uuid, image_h: Handle<Image>);
}
@DGriffin91
DGriffin91 / main.rs
Last active July 15, 2023 20:27 — forked from IceSentry/main.rs
Bevy post processing with prepass 0.10
// License: Apache-2.0 / MIT
// Adapted from https://gist.github.com/IceSentry/3949ee344857c2745dc961a64e6fc28f
//! This example shows how to create a custom render pass that runs after the main pass
//! and reads the color texture generated by the main pass, and also the prepass textures.
//!
//! This is a fairly low level example and assumes some familiarity with rendering concepts and wgpu.
use bevy::{
core_pipeline::{