Skip to content

Instantly share code, notes, and snippets.

View cwfitzgerald's full-sized avatar
🚀
wgpu is dope, though I'm biased

Connor Fitzgerald cwfitzgerald

🚀
wgpu is dope, though I'm biased
View GitHub Profile
@cwfitzgerald
cwfitzgerald / main.rs
Created May 20, 2024 13:37
D3D12/SDL2 Init
use glam::UVec2;
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
use sdl2::{
event::{Event, WindowEvent},
keyboard::Keycode,
};
use windows::Win32::Foundation::HWND;
#[no_mangle]
pub static D3D12SDKVersion: u32 = 614;
@cwfitzgerald
cwfitzgerald / convert.py
Created April 20, 2022 16:57
BC7-ifier
import argparse
import json
import os
import subprocess
from pathlib import Path
parser = argparse.ArgumentParser(
description="Process gltf into rust-compatible format")
parser.add_argument('file', type=Path)
parser.add_argument('--force', type=bool)
let iad = pollster::block_on(rend3::create_iad(
None,
None,
Some(RendererMode::CPUPowered),
))
.unwrap();
let vert = iad.device.create_shader_module(&ShaderModuleDescriptor {
label: Some("vert"),
source: ShaderSource::Wgsl(
@cwfitzgerald
cwfitzgerald / compress.py
Created November 24, 2021 14:47
Turns a normal gltf into a compressonatored gltf
import argparse
import json
import os
import subprocess
from pathlib import Path
parser = argparse.ArgumentParser(
description="Process gltf into rust-compatible format")
parser.add_argument('file', type=Path)
parser.add_argument('--force', type=bool)
@cwfitzgerald
cwfitzgerald / gist:d538f8f488b5a4da6b479c2c3709d892
Created October 17, 2021 00:24
graphite's list of nv shader recompily
# Things that trigger shader recompiles on NVIDIA GL
* Respecifying input assembly via `glVertexAttrib*` for any vertex array
* Clearing an individual color attachment with `glClearBuffer*`
* Clearing an FBO with `glClear` without specifying all attachments in
the clear, e.g if the FBO has color + depth but you only pass `GL_COLOR_BUFFER_BIT`
* Attaching shaders to a program
* Changing sampler uniforms (all textures are bindless on NV, changing sampler index is bad)
* Respecifying `glClearColor` more than once per frame per FBO
* Changing depth function more than once per bound program
@cwfitzgerald
cwfitzgerald / libconv.rs
Created September 24, 2021 17:41
Mint Workaround
use nalgebra as na;
macro_rules! conversions {
($trait1:ident, $conv1:ident, $trait2:ident, $conv2:ident, $(($src:ty, $mint:ty, $dst:ty)),* $(,)?) => {
$(
impl $trait1 for $src {
type Target = $dst;
fn $conv1(self) -> Self::Target {
let m: $mint = self.into();
m.into()
/* automatically generated by rust-bindgen */
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
#[repr(C)]
pub struct __BindgenUnionField<T>(::core::marker::PhantomData<T>);
impl<T> __BindgenUnionField<T> {
#[inline]
pub const fn new() -> Self {
__BindgenUnionField(::core::marker::PhantomData)
@app.route("/s/<path:url>")
def ret_hosted_file(url):
return send_from_directory("s/", url)
@app.route("/api/fdel/<path:url>", methods=['POST'])
def delete_file(url):
form_data = request.form
filename = os.path.abspath(os.path.join("s/", url))
/*
Loading C:\Users\connor\Downloads\models\lucy.obj.
Duration: 640.7ms
Verts: 14027872
Faces: 28055728
Verts/s: 21895759.2
Faces/s: 43791493.5
MB/s: 1841.7
*/
/*
Loading C:\Users\connor\Downloads\models\lucy.obj.
Duration: 1833.9ms
Verts: 14027872
Faces: 28055728
Verts/s: 7649115.7
Faces/s: 15298222.7
MB/s: 643.4
*/