Skip to content

Instantly share code, notes, and snippets.

View btipling's full-sized avatar
:shipit:
shipping code

Bjorn btipling

:shipit:
shipping code
  • ConductorOne
  • Bay Area, California
  • 09:07 (UTC -08:00)
View GitHub Profile

A good way to think about a buffer or an image descriptor is to imagine it as a very fat pointer. This is, in fact, not too far removed from reality, as we shall see.

Taking a peek at radv, we find the uniform buffer and storage buffer descriptors to be a 4-word tuple, where the first two words make up the address, followed by length in bytes for bounds checking and an extra word, which holds format information and bounds checking behavior [^1].

Similarly, the sampled image descriptor is a 16-word tuple containing an

@btipling
btipling / gist:90f0b00235f391a5b5e989ee419036fa
Created June 1, 2024 08:57 — forked from Madsy/gist:6980061
Working multi-threading two-context OpenGL example with GLFW 3.0.3 and GLEW 1.8
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <vector>
#include <cmath>
#include <cstdio>
#include <limits>
#include <chrono>
#include <thread>
#include <mutex>
@btipling
btipling / troubleshoot.gl.md
Created May 26, 2024 20:16 — forked from deccer/troubleshoot.gl.md
Troubleshoot - OpenGL

i was wondering if we should/could list common errors in the gl get started thing too, after debugcallback/renderdoc chapters or probably in some appendix, if you have more of those, let me know then we can compile those together into some comprehensive unfuck gl list

  • nothing works:

    • get rid of GLCALL/GLCHECK macros, most of them use glGetError incorrectly anyway
    • setup glDebugMessageCallback see here
    • your shaders could contain errors, make sure you check compile and linking state and fix according to what the error was highlighting
  • renderdoc crashes when i try to capture something from my project:

    • most likely some of your code is fucked, its rarely renderdoc being fucked in that case
  • make sure to hookup glDebugMessageCallback as stated above

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

indexes: [
{
using: 'GIN',
fields: ['field']
}
]
// CREATE INDEX field ON $modelTable USING gin (field);
indexes: [
#!/usr/bin/env sh
SPATH="$(cd $(dirname "$0") && pwd -P)"
SECRET_NAME=${1:-docker-registry-secret}
CONFIG_PATH=${2:-$SPATH/localkube.json}
if [[ ! -f $CONFIG_PATH ]]; then
echo "Unable to locate service account config JSON: $CONFIG_PATH";
exit 1;
fi
@btipling
btipling / libPNGOpenGL.cpp
Created May 3, 2016 04:19 — forked from mortennobel/ libPNGOpenGL.cpp
Updated to libpng 1.5.15
#ifdef _WIN32
#include <GL/glut.h>
#else
#include <GLUT/glut.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <png.h>
#include <iostream>
@btipling
btipling / graphics.cpp
Created April 6, 2016 06:06 — forked from xaxxon/graphics.cpp
gl error checker
void Graphics::check_error(const char * filename, int line_number) {
GLenum error;
while ((error = glGetError()) != 0) {
printf("GL Error %x: %s:%d\n", error, filename, line_number);
exit(1);
}
}
@btipling
btipling / graphics.cpp
Created April 6, 2016 06:06 — forked from xaxxon/graphics.cpp
shader builder
GLuint Graphics::build_shader_program(const char * vertex_shader_source, const char * fragment_shader_source) {
// printf("Compiling shaders %s and %s\n", vertex_shader_source, fragment_shader_source);
/* create program object and attach shaders */
GLuint program = glCreateProgram();
shaderAttach(program, GL_VERTEX_SHADER, vertex_shader_source);
check_error(__FILE__, __LINE__);
shaderAttach(program, GL_FRAGMENT_SHADER, fragment_shader_source);
check_error(__FILE__, __LINE__);
@btipling
btipling / connect.rs
Created December 27, 2015 23:57 — forked from mathieulegrand/connect.rs
simple connect to server:443 in Rust
// Rust 0.10-pre (Tue Mar 18, 2014)
// $ rustc -L rust-openssl/build/ -L rust-toml/lib doing.rs
// assuming https://github.com/sfackler/rust-openssl is cloned and compiled,
// and https://github.com/mneumann/rust-tom is cloned and compiled
#[feature(macro_rules)];
#[allow(deprecated_owned_vector)];
extern crate openssl;
extern crate serialize;