Skip to content

Instantly share code, notes, and snippets.

View ALEXMORF's full-sized avatar

Chen Huang ALEXMORF

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ALEXMORF on github.
  • I am chenhuang (https://keybase.io/chenhuang) on keybase.
  • I have a public key whose fingerprint is 3FC2 F355 E436 C92F D52F 7B67 C277 6F08 E462 C64B

To claim this, I am signing this object:

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <d3d12.h>
#include <dxgi1_2.h>
#include <dxgi1_3.h>
#include <dxgi1_4.h>
#include <d3dcompiler.h>
#define ARRAY_COUNT(Array) (sizeof(Array)/sizeof((Array)[0]))
@ALEXMORF
ALEXMORF / rayTrace.hlsl
Created March 14, 2020 21:53
a ray traversal shader that triggers dxc's validation error
#define RS "DescriptorTable(UAV(u0)), UAV(u1), UAV(u2), SRV(t0), SRV(t1), RootConstants(num32BitConstants=10, b0)"
typedef row_major float4x4 float4x4;
struct mat4
{
float4x4 Data;
};
struct prim
ray_result RayTraceBottomLevel(float3 Ro, float3 Rd, float3 InvRd,
bool StopOnAnyHit,
ray_result RayState, uint Stack[STACK_SIZE],
int StackIndex,
RWStructuredBuffer<bvh_node> BLASBuffer,
RWStructuredBuffer<prim> PrimBuffer,
int InstanceIndex,
int NodeOffset, int PrimOffset)
{
@ALEXMORF
ALEXMORF / stable_dynamic_array.h
Created April 11, 2021 23:18
simple stable growable array
#pragma once
#include "common.h"
#include "dynamic_array.h"
template <typename T>
struct Stable_Dynamic_Array {
// this is your usual unstable growable array like std::vector
Dynamic_Array<T *> blocks;
int count;
int cap;