Skip to content

Instantly share code, notes, and snippets.

@gomson
gomson / java-8-lambdas-streams
Created January 19, 2017 19:57 — forked from mmonti/java-8-lambdas-streams
Oracle Massive Open Online Course: Java SE 8 Lambdas and Streams
Lesson 1: Lambda Expressions
This week covers the new lambda expressions feature added to Java SE 8. The lessons cover:
Why lambda expressions are needed in Java.
Why this feature was added to Java after twenty years.
The syntax of lambda expressions.
How to use lambda expressions and the rules that govern their use.
Examples of classes and methods that use lambda expressions like the new removeIf and replaceAll methods in the Collections API.
We provide video instruction along with written tutorials that guide you through the process. Please watch each video carefully to ensure that you have your system properly set up to complete this lesson. The videos and tutorials are listed sequentially, and we recommend that you use the instructional materials in that order.
@gomson
gomson / adders.c
Created February 12, 2017 22:12 — forked from pervognsen/adders.c
typedef struct { uint64_t b[4]; } uint4x64_t;
// Bitsliced 4-bit adder
uint4x64_t add_sliced(uint4x64_t x, uint4x64_t y) {
uint4x64_t s;
uint64_t c = 0;
for (int i = 0; i < 4; i++) {
s.b[i] = x.b[i] ^ y.b[i] ^ c;
c = (x.b[i] & y.b[i]) | (x.b[i] & c) | (y.b[i] & c);
@gomson
gomson / broken_shader.fs
Created February 20, 2017 16:46 — forked from Erkaman/broken_shader.fs
broken_shader.vs is the broken shader.
// empty fragment shader.
void main()
{
}
@gomson
gomson / gpu_arch_resources
Created March 6, 2017 22:09 — forked from jhaberstro/gpu_arch_resources
GPU Architecture Learning Resources
http://courses.cms.caltech.edu/cs179/
http://www.amd.com/Documents/GCN_Architecture_whitepaper.pdf
https://community.arm.com/graphics/b/blog
http://cdn.imgtec.com/sdk-documentation/PowerVR+Hardware.Architecture+Overview+for+Developers.pdf
http://cdn.imgtec.com/sdk-documentation/PowerVR+Series5.Architecture+Guide+for+Developers.pdf
https://www.imgtec.com/blog/a-look-at-the-powervr-graphics-architecture-tile-based-rendering/
https://www.imgtec.com/blog/the-dr-in-tbdr-deferred-rendering-in-rogue/
http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/opencl-optimization-guide/#50401334_pgfId-412605
https://fgiesen.wordpress.com/2011/07/09/a-trip-through-the-graphics-pipeline-2011-index/
https://community.arm.com/graphics/b/documents/posts/moving-mobile-graphics#siggraph2015

Trying out Rust for Graphics Programming (March 1st, 2017)

This post is a brain-dump of my experience jumping into Rust, where I took time off my regular job for the Blender Foundation to spend 7 months of uninterrupted time learning Rust.

My general goal is to use Rust for graphics application development, as an alternative to C/C++ which is dominant in this area.

@gomson
gomson / gist:6cb9cf3b03c6a77148c06fce4010e13f
Created March 18, 2017 18:45 — forked from rygorous/gist:e0f055bfb74e3d5f0af20690759de5a7
A bit of background on compilers exploiting signed overflow
Why do compilers even bother with exploiting undefinedness signed overflow? And what are those
mysterious cases where it helps?
A lot of people (myself included) are against transforms that aggressively exploit undefined behavior, but
I think it's useful to know what compiler writers are accomplishing by this.
TL;DR: C doesn't work very well if int!=register width, but (for backwards compat) int is 32-bit on all
major 64-bit targets, and this causes quite hairy problems for code generation and optimization in some
fairly common cases. The signed overflow UB exploitation is an attempt to work around this.
BubbleSort PROC
;//performs the bubble sort algorithm
;//recieves ESI: offset of myarray and ECX: The length
push eax
L1:
mov eax, [esi]
mov edx, [esi + 4]
cmp edx, eax
jg swapo
jmp ending
@gomson
gomson / kotaku_hzd.txt
Created April 19, 2017 06:55 — forked from nothings/kotaku_hzd.md
Why Frustum Culling Matters, and Why It's Not Important
There is a nice GIF illustrating a technique called "frustum culling" in this
Kotaku article: http://kotaku.com/horizon-zero-dawn-uses-all-sorts-of-clever-tricks-to-lo-1794385026
The interwebs being what they are, this has also led to some controversy.
Some people have interpreted the opening sentence "Every time you move the camera in
Horizon Zero Dawn, the game is doing all sorts of under-the-hood calculations, loading
and unloading chunks of world to ensure that it all runs properly," as being about the
GIF; that's not what frustum culling does, but that's probably not what the article's
author meant anyway.
@gomson
gomson / static_if.cc
Created May 4, 2017 08:46 — forked from lichray/static_if.cc
Implement static_if using C11 generic selection
#include <type_traits>
#include <tuple>
#include <iostream>
// Link: https://github.com/aeyakovenko/notes
//count arguments
//COUNT_ARGS :: ... -> Int
#define COUNT_ARGS(...) COUNT_ARGS_(,##__VA_ARGS__,6,5,4,3,2,1,0)
#define COUNT_ARGS_(z,a,b,c,d,e,f,cnt,...) cnt