Skip to content

Instantly share code, notes, and snippets.


Jamorn Sriwasansak jamornsriwasansak

View GitHub Profile
View graphics_mega_bibtex.bib
% Some predefined strings for conferences & journals
@string{AAAI = "Conference on Artificial Intelligence (AAAI)"}
@string{AISTATS = "International Conference on Artificial Intelligence and Statistics (AISTATS)"}
@string{Bernoulli = "Bernoulli"}
@string{Biometrika = "Biometrika"}
@string{CandG = "Computers \& Graphics"}
@string{CACM = "Commun. ACM"}
@string{CG_SIGGRAPH = "Comput. Graph. (Proc. SIGGRAPH)"}
@string{CGA = "IEEE Comput. Graph. Appl."}
@string{CGF = "Comput. Graph. Forum"}
cdwfs / vk_cpu_gpu_timestamp.cpp
Last active December 12, 2021 06:01
Vulkan function to get a pair of timestamps (one CPU, one GPU) corresponding to (very nearly) the same point in absolute wall time.
View vk_cpu_gpu_timestamp.cpp
struct CpuGpuTimestampInfo {
VkDevice device;
VkQueue queue;
uint32_t queue_family_index;
float timestamp_period; // Copy from VkPhysicalDeviceLimits::timestampPeriod
uint32_t timestamp_valid_bits; // Copy from VkQueueFamilyProperties::timestampValidBits
VkResult GetCpuGpuTimestamp(const CpuGpuTimestampInfo *info,
std::chrono::high_resolution_clock::time_point *out_cpu_time, uint64_t *out_gpu_time) {
if (info->timestamp_valid_bits == 0) {
tilkinsc / load_dds.c
Last active August 14, 2022 12:20
C OpenGL DDS Loading Tutorial
View load_dds.c
Can load easier and more indepth with
Because a lot of crappy, weird DDS file loader files were found online. The resources are actually VERY VERY limited.
Written in C, can very easily port to C++ through casting mallocs (ensure your imports are correct), goto can be replaced.
^ Two examples of terrible code
View smallgdpt.cpp
// smallgdpt: a simple implementation of gradient domain path tracing
// adapted from smallpt by Kevin Beason
// and a screened poisson solver by Pravin Bhat
// to build, type: g++ -o smallgdpt -fopenmp -O3 smallgdpt.cpp -L/usr/local/lib -lm -lfftw3
// you will need fftw3 to compile
// usage: ./smallgdpt [number of samples per pixel]
#include <fftw3.h>
#include <math.h>
#include <stdlib.h>
rygorous / gist:2156668
Last active September 20, 2023 09:39
float->half variants
View gist:2156668
// float->half variants.
// by Fabian "ryg" Giesen.
// I hereby place this code in the public domain, as per the terms of the
// CC0 license:
// float_to_half_full: This is basically the ISPC stdlib code, except
// I preserve the sign of NaNs (any good reason not to?)