Skip to content

Instantly share code, notes, and snippets.


Dario Manesku dariomanesku

View GitHub Profile
View fibers.c
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <string.h>
#define streq(a, b) (!strcmp((a), (b)))
#ifndef __USE_GNU
#define __USE_GNU
dariomanesku / main.cpp
Last active Jun 5, 2017
Different output between GCC and MSVC. What is going on here?
View main.cpp
#include <stdio.h>
#include <stdint.h>
#include <new>
struct Empty { }; // implicitly-defined default ctor
struct Foo : Empty
uint8_t a;
uint8_t b;
dariomanesku / Tex2DCatmullRom.hlsl
Created Sep 19, 2016 — forked from TheRealMJP/Tex2DCatmullRom.hlsl
An HLSL function for sampling a 2D texture with Catmull-Rom filtering, using 9 texture samples instead of 16
View Tex2DCatmullRom.hlsl
// Samples a texture with Catmull-Rom filtering, using 9 texture fetches instead of 16.
// See for more details
float4 SampleTextureCatmullRom(in Texture2D<float4> tex, in SamplerState linearSampler, in float2 uv, in float2 texSize)
// We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding
// down the sample location to get the exact center of our "starting" texel. The starting texel will be at
// location [1, 1] in the grid, where [0, 0] is the top left corner.
float2 samplePos = uv * texSize;
float2 texPos1 = floor(samplePos - 0.5f) + 0.5f;
dariomanesku /
Last active Apr 22, 2016
Fix diff for examples/xx_arealights/ to avoid " error C7528: OpenGL reserves names containing '__' ".
< vec3 FetchDiffuseFilteredTexture(sampler2D texLightFiltered, vec3 _p1, vec3 _p2, vec3 _p3, vec3 _p4)
> vec3 FetchDiffuseFilteredTexture(sampler2D texLightFiltered, vec3 p1_, vec3 p2_, vec3 p3_, vec3 p4_)
< vec3 V1 = _p2 - _p1;
< vec3 V2 = _p4 - _p1;
> vec3 V1 = p2_ - p1_;
> vec3 V2 = p4_ - p1_;