Skip to content

Instantly share code, notes, and snippets.

block_1:
if ... goto block_2 else block_4
block_2:
a_1 = ...
if ... goto block_3 else block_5
block_3:
a_2 = ...
... = a_1 // !!!
#!amber
# Copyright 2019 The Amber Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
In order to run these experiments, you'll need a laptop running Linux with Intel
integrated graphics. We need access to the underlying graphics device, so you
can't just use a VM. In order to build the OpenGL driver, first you need to
download my Git branch:
$ git clone git://people.freedesktop.org/~cwabbott0/mesa
$ cd mesa
$ git checkout shader-time-hacks
To build Mesa, you need to download the build dependencies first. You should use
@cwabbott0
cwabbott0 / gist:5746437
Created June 10, 2013 03:49
really simple vertex shader disassembled
attribute.load(0), mul[0].complex2(attribute.w, attribute.w), complex.rcp(attribute.w);
mul.complex1(complex.out[1], mul[0].out[1], complex.out[1], attrib.w[1]);
uniform.load(0), acc[0].pass(uniform.z), acc[1].pass(uniform.y);
uniform.load(2), attribute.load(0), mul[0].mul(attribute.z, acc[0].out[1]), mul[1].mul(attribute.y, acc[1].out[1]), pass.clamp(mul[0].out[2]);
uniform.load(0), attribute.load(0), mul[0].mul(attribute.x, uniform.x), mul[1].mul(mul[0].out[1], pass.out[1]);
uniform.load(1), mul[0].mul(mul[1].out[2], pass.out[2]), mul[1].mul(mul[0].out[1], pass.out[2]), acc[0].pass(pass.out[2]), acc[1].add(mul[1].out[1], uniform.z);
uniform.load(1), mul[1].pass(acc[0].out[1]), acc[0].add(mul[0].out[1], uniform.y), acc[1].add(mul[1].out[1], uniform.x), complex.pass(acc[1].out[1]), store[0].varying(0, acc[1].out, acc[0].out), store[1].varying(0, complex.out, mul[1].out);
@cwabbott0
cwabbott0 / gist:5746331
Created June 10, 2013 03:23
really simple vertex shader transformed
attribute vec4 aPosition;
uniform vec4 gl_mali_ViewportTransform[2];
void main() {
gl_Position.w = clamp(1.0 / aPosition.w, -1e10, 1e10);
gl_Position.xyz = aPosition.xyz * gl_Position.w * gl_mali_ViewportTransform[0].xyz + gl_mali_ViewportTransform[1].xyz;
}
@cwabbott0
cwabbott0 / gist:5746212
Created June 10, 2013 02:44
really simple vertex shader
attribute vec4 aPosition;
void main() {
gl_Position = aPosition;
}