Skip to content

Instantly share code, notes, and snippets.

@warrenm
warrenm / CreateBiplanarIOSurface.m
Last active April 26, 2022 23:05
Example of creating a biplanar (YUV422) IOSurface
NSUInteger width = 1024;
NSUInteger height = 768;
OSType pixelFormat = kCVPixelFormatType_422YpCbCr8BiPlanarFullRange;
NSUInteger plane0BytesPerPixel = 1;
NSUInteger plane1BytesPerPixel = 1;
NSUInteger plane0BytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, plane0BytesPerPixel * width);
NSUInteger plane0AllocSize = IOSurfaceAlignProperty(kIOSurfaceAllocSize, plane0BytesPerRow * height);
NSUInteger plane1BytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, plane1BytesPerPixel * width);
NSUInteger plane1AllocSize = IOSurfaceAlignProperty(kIOSurfaceAllocSize, plane1BytesPerRow * height);
@snowzurfer
snowzurfer / 3DPointsFromDepth.swift
Last active July 12, 2024 07:39
3D world points from ARKit depth
import ARKit
import SceneKit
let horizontalPoints = 256 / 2
let verticalPoints = 192 / 2
var depthNodes = [SCNNode]()
var parentDebugNodes = SCNNode()
var sceneView: ARSCNView!
// Somewhere during setup
@munrocket
munrocket / wgsl_2d_sdf.md
Last active September 13, 2024 06:29
WGSL 2D SDF Primitives

WGSL 2D SDF Primitives

Revision: 06.08.2023, https://compute.toys/view/398

Circle - exact

fn sdCircle(p: vec2f, r: f32) -> f32 {
  return length(p) - r;
}
@messeb
messeb / URLResponse+HTTP.swift
Created December 5, 2017 21:00
URLResponse as HTTPURLResponse and check if call has status code 2xx
extension URLResponse {
/// Returns casted `HTTPURLResponse`
var http: HTTPURLResponse? {
return self as? HTTPURLResponse
}
}
extension HTTPURLResponse {
/// Returns `true` if `statusCode` is in range 200...299.
/// Otherwise `false`.
@jhaberstro
jhaberstro / gpu_arch_resources
Last active October 26, 2023 00:14
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
@kbenzie
kbenzie / .ycm_extra_conf.py
Last active July 26, 2017 09:55
YouCompleteMe extra configuration file
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
@zenorocha
zenorocha / README.md
Last active August 22, 2024 14:20
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage