Skip to content

Instantly share code, notes, and snippets.

View nadult's full-sized avatar
:octocat:

Krzysztof Jakubowski nadult

:octocat:
View GitHub Profile
@nadult
nadult / point_sampler_dxt.cpp
Last active February 9, 2020 09:37
Point sampler class for textures in DXT1 format. It was used in my realtime ray-tracer project. It's using SSE through custom SIMD vector classes.
#include "sampling/point_sampler_dxt.h"
namespace sampling {
PointSamplerDXT::PointSamplerDXT(const gfxlib::Texture &t) :tex(t) {
if(tex.Width() & (tex.Width() - 1) || tex.Height() & (tex.Height() - 1))
THROW("Texture width & height must be a power of 2");
if(tex.GetFormat().GetIdent()!=gfxlib::TI_DXT1)
THROW("DXT sampler requires DXT1 texture");
@nadult
nadult / parser.hs
Created November 3, 2013 11:38
C-like language parser in Haskell.
module Parser(parseProgram) where
import Text.Parsec.Expr
import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Error
import qualified Text.ParserCombinators.Parsec.Token as P
import Text.ParserCombinators.Parsec.Language
import Control.Monad
import Tokens
@nadult
nadult / cuda_simulation.cu
Created November 3, 2013 11:33
Molecular dynamics on GPU
#include <stdio.h>
#include <assert.h>
#include "config.h"
#include <thrust/sort.h>
#include <thrust/tuple.h>
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/iterator/zip_iterator.h>
#define GL_GLEXT_PROTOTYPES 1