Skip to content

Instantly share code, notes, and snippets.

View slimsag's full-sized avatar
😸
Herding cats

Stephen Gutekanst slimsag

😸
Herding cats
View GitHub Profile
// avxSupport uses CPUID to check if the CPU supports AVX
// func avxSupport() bool
// Return: +0(FP)
TEXT ·avxSupport(SB),$0
MOVL $0x1, AX
CPUID
// AND ECX, 0x18000000
BYTE $0x81; BYTE $0xE1; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x18;
@slimsag
slimsag / gist:d0e018fdfb7f9785fada
Created September 8, 2014 07:12
Cursor events in main loop
package main
import (
"image"
"azul3d.org/gfx.v1"
"azul3d.org/gfx/window.v2"
"azul3d.org/keyboard.v1"
"azul3d.org/lmath.v1"
"azul3d.org/mouse.v1"
@slimsag
slimsag / gist:0b7c40e8fb6b566e491f
Last active August 29, 2015 14:08
(gopherjs) Channel Based Main Thread Ownership
package main
import (
"fmt"
"github.com/gopherjs/gopherjs/js"
)
var MainLoopChan = make(chan func(), 1)
type Window struct{}
@slimsag
slimsag / gist:a26d838ccc4480ce21bc
Created November 28, 2014 07:07
Ubuntu 14.04 libxcb v1.11 Upgrade Script
sudo apt-get install autoconf
wget http://xcb.freedesktop.org/dist/xcb-proto-1.11.tar.gz
tar xzvf xcb-proto-1.11.tar.gz
cd xcb-proto-1.11
./autogen.sh
./configure
sudo make install
cd ..
*** Loading state from LOZ.nst
nes.state is Running
runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow
runtime stack:
runtime.throw(0xfe6a19)
/home/stephen/go/src/runtime/panic.go:491 +0xad
runtime.newstack()
/home/stephen/go/src/runtime/stack.c:784 +0x555
#version 120
varying vec2 tc0;
uniform sampler2D Texture0;
uniform vec4 palette[64];
void main() {
vec4 t = texture2D(Texture0, tc0);
int i = int(t.b * 15.0) * 16 + int(t.a * 15.0);
var glslVert = []byte(`
#version 120
attribute vec3 Vertex;
attribute vec2 TexCoord0;
uniform mat4 MVP;
uniform vec3 shift;
uniform vec3 scale;
gc1(1): 3+2+186+4 us, 2 -> 128 MB, 1016 (1016-0) objects, 12 goroutines, 57/0/0 sweeps, 0(0) handoff, 0(0) steal, 0/0/0 yields
gc2(1): 405+2+174+1 us, 128 -> 128 MB, 1016 (1016-0) objects, 12 goroutines, 57/0/0 sweeps, 0(0) handoff, 0(0) steal, 0/0/0 yields
gc3(1): 4+4+263+2 us, 0 -> 2 MB, 958 (1416-458) objects, 13 goroutines, 58/1/0 sweeps, 0(0) handoff, 0(0) steal, 0/0/0 yields
gc4(1): 474+2+192+2 us, 2 -> 2 MB, 958 (1416-458) objects, 13 goroutines, 58/0/0 sweeps, 0(0) handoff, 0(0) steal, 0/0/0 yields
gc5(1): 2+2+198+2 us, 2 -> 10 MB, 2564 (3125-561) objects, 13 goroutines, 67/3/0 sweeps, 0(0) handoff, 0(0) steal, 0/0/0 yields
gc6(1): 404+2+182+1 us, 10 -> 10 MB, 2564 (3125-561) objects, 13 goroutines, 67/0/0 sweeps, 0(0) handoff, 0(0) steal, 0/0/0 yields
^^^^^ Application initializes ^^^^^
-- Runs without GC here for ~5s --
GL
==
This repository holds Go bindings to various OpenGL versions. They are auto-generated using [Glow](github.com/go-gl/glow).
Features:
- Go functions that mirror the C specification using Go types.
- Support for multiple OpenGL APIs (GL/GLES/EGL/WGL/GLX/EGL), versions, and profiles.
- Support for extensions (including debug callbacks).
// Copyright 2014 The Azul3D Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Example - Demonstrates receiving window events.
package main
import (
"azul3d.org/gfx.v1"
"azul3d.org/gfx/window.v2"