Skip to content

Instantly share code, notes, and snippets.

View djg's full-sized avatar
💭
I may be slow to respond.

Dan Glastonbury djg

💭
I may be slow to respond.
View GitHub Profile
The GL_TRANSFORM_FEEDBACK_BUFFER buffer binding point may be
passed to glBindBuffer, but will not directly affect transform
feedback state. Instead, the indexed GL_TRANSFORM_FEEDBACK_BUFFER
bindings must be used through a call to glBindBufferBase or
glBindBufferRange. This will affect the generic
GL_TRANSFORM_FEEDBACK_BUFFER binding.
Likewise, the GL_UNIFORM_BUFFER buffer binding point may be used,
but does not directly affect uniform buffer
state. glBindBufferBase or glBindBufferRange must be used to bind
@djg
djg / ugh
Created May 12, 2014 07:51
GLSL 1.2 -> GLSL 1.5
#version 150
out vec4 gl_FragColor
#ifdef GL_ES
precision mediump float;
#define COLOR_PRECISION lowp
#else
#define COLOR_PRECISION
#endif
uniform COLOR_PRECISION vec4 uRenderColor;
uniform sampler2D uTexture;
// -----------------------------------------------------------------------------
// PUBLIC
public:
@djg
djg / pilots
Created February 17, 2014 00:27
Truly superior pilots are those who use their superior judgment to avoid those situations where they might have to use their superior skills.
— cliché
if (texture() && texture()->SomeMethod()) {
texture()->SomeOtherMethod()->FooBar();
}
vs
Texture* tex = texture();
if (tex && tex->SomeMethod()) {
tex->SomeOtherMethod()->FooBar();
}
@djg
djg / gist:8531923
Created January 21, 2014 00:08
I don't see free() here ...
D3DCompiler_43.dll!CBaseProgram::DeleteArgsAbove(unsigned int) Unknown
D3DCompiler_43.dll!CCompiler::Reset(unsigned int,unsigned int,class CArgument * const *,class CTrackVarMapChanges *) Unknown
D3DCompiler_43.dll!CCompiler::ApplySFPSRange(class CInstruction *,unsigned int,class CArgument * const *,bool) Unknown
D3DCompiler_43.dll!CCompiler::EmitInstAll(struct ArSourceLocation const *,unsigned int,class CArgument * *,class CArgument * const *,class CArgument * const *,unsigned __int64,enum ArRangeFlags,enum ArBasicKind) Unknown
D3DCompiler_43.dll!CCompiler::EmitBinaryInst(struct ArSourceLocation const *,unsigned int,class CArgument * *,class CArgument * const *,class CArgument * const *,enum ArRangeFlags) Unknown
D3DCompiler_43.dll!CCompiler::EmitDot(struct ArSourceLocation const *,unsigned int,unsigned int,class CArgument * *,class CArgument * const *,class CArgument * const *,enum ArRangeFlags) Unknown
D3DCompiler_43.dll!CCompiler::EmitIntrinsic(class CNode *,class CArgument * *,bool) Unknown
@djg
djg / gist:7798142
Created December 5, 2013 00:26
Sad Panda.
djg in ~/Mozilla/hg/mozilla-central
$ export HGMERGE=p4merge
djg in ~/Mozilla/hg/mozilla-central
$ mhg qpush
applying bug-942506-refactor-ApplyFilterToBoundTexture
patching file gfx/gl/GLContext.cpp
Hunk #1 FAILED at 1325
1 out of 1 hunks FAILED -- saving rejects to file gfx/gl/GLContext.cpp.rej
patching file gfx/gl/GLContextProviderGLX.cpp
@djg
djg / uncompressETC2Block.js
Created November 28, 2013 21:37
Yeah, umm. Thanks to @BrendanEich for <<,>>>,&,| ;-)
function uncompressETC2Block(destBuffer, destX, destY, destWidth, src) {
'use strict';
var xx, yy, basecols;
function extend_4to8bits(r, g, b) {
return [
(r & 0xf0) | ((r >> 4) & 0x0f),
(g & 0xf0) | ((g >> 4) & 0x0f),
(b & 0xf0) | ((b >> 4) & 0x0f),
255
@djg
djg / woah.js
Last active December 29, 2015 12:09
Yeah, umm. WAT?!
function base_colors(src, mode) {
var col_1, col_2;
function compare(c1, c2) {
return (c1[0] * 16384 + c1[1] * 256 + c1[2]) >=
(c2[0] * 16384 + c2[1] * 256 + c2[2]);
}
if (mode === 'I') {
col_1 = extend_4to8bits(src[7], src[6], src[5]),
col_2 = extend_4to8bits(src[7] << 4, src[6] << 4, src[5] << 4)
return [ col_1, col_2 ];
@djg
djg / crap3b.crap
Created November 24, 2013 23:37
crap3b.crap - Supports 4 character labels! (crap3 dialect)
#
# CRAP3b for Darwin-i386-MachO
# Copyright (C) 2013, Dan Glastonbury <[email protected]>
#
# Labels are 4 chars. Labels are stores in a symbol table stored in
# BSS section. The labels form a list of 32-bit label name and address
# pairs.
#
# Errors are signaled by return code:
# 1: Syntax Error