Skip to content

Instantly share code, notes, and snippets.

View philipturner's full-sized avatar
🏠
Working from home

Philip Turner philipturner

🏠
Working from home
View GitHub Profile
@philipturner
philipturner / main.swift
Created June 9, 2025 12:35
Important notes about run loop structure
// Next steps:
// - Understand the structure of the run loop better. [DONE]
// - Write the SwapChain utility for Windows.
// - Reproduce the 1st 3DGEP tutorial using empty render passes.
// - Reproduce the StackOverflow comment (https://stackoverflow.com/a/78501260)
// about rendering with entirely compute commands.
import MolecularRenderer
#if os(macOS)
@philipturner
philipturner / VectorAddition.swift
Created June 4, 2025 21:17
Fifth set of files saved for easy reference, while cleaning up an iteration of the Windows port of Molecular Renderer
#if os(Windows)
import MolecularRenderer
/// Utility code for setting up a vector addition test.
class VectorAddition {
let inputBuffer0: Buffer
let inputBuffer1: Buffer
let nativeBuffer0: Buffer
let nativeBuffer1: Buffer
@philipturner
philipturner / main.swift
Created May 27, 2025 20:21
Fourth set of files saved for easy reference, while cleaning up an iteration of the Windows port of Molecular Renderer
// Next steps:
// - Access the GPU.
// - Modify it to get Metal rendering. [DONE]
// - Clean up and simplify the code as much as possible. [DONE]
// - Get timestamps synchronizing properly (moving rainbow banner
// scene). [DONE]
// - Repeat the same process with COM / D3D12 on Windows.
// - Get some general experience with C++ DirectX sample code.
// - Modify the files one-by-one to support Windows.
@philipturner
philipturner / main.swift
Created May 23, 2025 17:49
Third set of files saved for easy reference, while cleaning up an iteration of the Windows port of Molecular Renderer
// Next steps:
// - Access the GPU.
// - Modify it to get Metal rendering. [DONE]
// - Clean up and simplify the code as much as possible. [DONE]
// - Get timestamps synchronizing properly (moving rainbow banner
// scene). [DONE]
// - Repeat the same process with COM / D3D12 on Windows.
// - Get some general experience with C++ DirectX sample code.
// - Modify the files one-by-one to support Windows.
@philipturner
philipturner / SiliconCarbide.md
Last active May 24, 2025 14:53
First attempt at a matter compiler, mapping an arbitrary crystalline product to a sequence of tips

Silicon Carbide

Define the goals of this project:

  • Formalize the SiC layer initiation and lattice extension.
  • Create a method to compile matter into a sequence of tips.
  • As a result, I can quantify the slowness from tip randomization.

End goal is to exactly know the building speed of SiC vs. amorphous carbon.

@philipturner
philipturner / CommandQueue.swift
Created May 9, 2025 11:59
More files saved for easy reference, while cleaning up an iteration of the Windows port of Molecular Renderer
#if false
import SwiftCOM
import WinSDK
// Exercise in usage of the DirectX 12 API.
// Implementing the CommandQueue API design from:
// https://www.3dgep.com/learning-directx-12-2/#The_Command_Queue_Class
// As literal of a translation as possible from the C++ origin.
public class CommandQueue {
@philipturner
philipturner / CommandQueue.swift
Last active April 30, 2025 16:02
Files saved for easy reference, while cleaning up an iteration of the Windows port of Molecular Renderer
#if os(Windows)
// Exercise in usage of the DirectX 12 API.
// Implementing the CommandQueue API design from:
// https://www.3dgep.com/learning-directx-12-2/#The_Command_Queue_Class
#endif
// Imports for DXC symbols.
#include "dxcapi.h"
#include <d3d12shader.h>
// Imports for ComPtr<>.
#include <wrl.h>
using namespace Microsoft::WRL;
// Imports for debugging.
#include <iostream>
#include <iostream>
#include "dxcapi.h"
#include <wrl.h>
using namespace Microsoft::WRL;
int main() {
int8_t* shaderSource = (int8_t*)malloc(5);
shaderSource[0] = 'h';
shaderSource[1] = 'j';
shaderSource[2] = 'k';
import DXCompiler
import WinSDK
import WinSDK.DirectX
/*
// MARK: - DirectX Experimentation