Skip to content

Instantly share code, notes, and snippets.

View darksylinc's full-sized avatar

Matias N. Goldberg darksylinc

View GitHub Profile

Godot Shader System Proposal

Godot 4's current shader/PSO system assumes the following:

  1. Specialization Constants reduce compilation time (true) but are not free.
  2. Specialization Constants are well optimized by Driver (blatantly false on Android),
  3. Uniform Static branches are free. They're very cheap but I am seeing incremental improvements when removed entirely via #ifdef. Sometimes major improvements.

Godot 4 wants these assumptions to be true because they help reduce the number of shader & PSO variants, which are key to reducing compilation stutter.

@darksylinc
darksylinc / TripleBufferGpuWorkSimulator.cpp
Created August 21, 2023 02:56
Triple Buffer vs Double buffer simulator
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <algorithm>
#include <deque>
@darksylinc
darksylinc / GodotCompositors.md
Last active August 6, 2023 19:32
Godot & Compositors

What this proposal is about

  • Creating a Compositor that will handle rendering and compute
  • Make ordering tasks around MUCH easier
  • Fixing barrier problem

What this proposal isn't

  • It's not about exposing the Compositor to the user
// Compiling this code with:
// fxc.exe /T ps_5_0 /O0 /E main broken_min16float.hlsl
// Will result in the following:
// error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Incompatible min precision type for operand #1 of opcode #6 (counts are 1-based). Expected int or uint.
//
// Works if compiled with Od for no optimizations
#define _h( x ) min16float( ( x ) )
cbuffer PassBuffer : register( b0 )
@darksylinc
darksylinc / build_ogre_2_1_macOS.sh
Created December 13, 2021 19:41
Build script for Ogre 2.1 on macOS (first `brew instal sdl2`)
#!/bin/bash
OGRE_BRANCH_NAME="v2-1"
if test ! -d ogre-next-deps; then
mkdir ogre-next-deps
echo "--- Cloning ogre-next-deps ---"
git clone --recurse-submodules --shallow-submodules https://github.com/OGRECave/ogre-next-deps || exit $?
else
echo "--- ogre-next-deps repo detected. Cloning skipped ---"
@darksylinc
darksylinc / FullRGB_5.13.7.patch
Created August 3, 2021 15:32
Full RGB Kernel 5.13.7 patch
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 2a4cd7d377bf..62c6934a6244 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -1215,6 +1215,33 @@ static const struct drm_prop_enum_list amdgpu_dither_enum_list[] =
{ AMDGPU_FMT_DITHER_ENABLE, "on" },
};
+static const struct drm_prop_enum_list amdgpu_user_pixenc_list[] = {
+ { 0, "auto" },