Skip to content

Instantly share code, notes, and snippets.

View HansKristian-Work's full-sized avatar

Hans-Kristian Arntzen HansKristian-Work

  • Arntzen Software AS
  • Trondheim, Norway
View GitHub Profile
@HansKristian-Work
HansKristian-Work / gs.hpp
Created March 20, 2025 18:46
PlayStation 2 GS Dump - HelloTriangle
// SPDX-FileCopyrightText: 2024 Arntzen Software AS
// SPDX-FileContributor: Hans-Kristian Arntzen
// SPDX-FileContributor: Runar Heyer
// SPDX-License-Identifier: LGPL-3.0+
// Simplified header for standalone demo purposes :)
#pragma once
#include <stdint.h>
@HansKristian-Work
HansKristian-Work / WaveActiveAllEqual.txt
Created June 16, 2023 14:38
SM 6.0 strict wave op tests
== With helper lanes ==
Representation: NIR Shader(s) (The optimized NIR shader(s))
shader: MESA_SHADER_FRAGMENT
source_sha1: {0xac104c1f, 0x83f461d4, 0x782a7d10, 0x760c676a, 0x9f393254}
stage: 4
next_stage: 0
num_textures: 2
inputs_read: 32
outputs_written: 4
@HansKristian-Work
HansKristian-Work / heaplog.py
Last active April 11, 2023 11:35
Trace Rtl allocations from Wine log
#!/usr/bin/env python3
import sys
import re
def main():
allocations = {}
total_high_watermark = 0
size_match = re.compile('[0-9a-fA-F]+\)')
ptr_match = re.compile('ptr ([0-9a-fA-F]+)')
struct VSOut { float4 pos : SV_Position; float4 uv : UV; };
#define MyRS "RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT), DescriptorTable(SRV(t0), SRV(t1), SRV(t2), CBV(b0)), DescriptorTable(Sampler(s0))"
[RootSignature(MyRS)]
VSOut vs_main(float4 pos : POSITION, float2 uv : TEXCOORD)
{
VSOut vsout;
vsout.pos = pos;
vsout.uv = float4(uv, pos.xy * uv);
return vsout;
// HLSL
Texture2D<float4> Tex : register(t2, space1);
SamplerState Samp : register(s1, space3);
cbuffer Buf : register(b1)
{
float4 constant_data;
int iterations;
float4 values[16];
};
else if (program.get_pipeline_layout()->get_hash() != current_layout->get_hash())
{
auto &new_layout = program.get_pipeline_layout()->get_resource_layout();
auto &old_layout = current_layout->get_resource_layout();
// If the push constant layout changes, all descriptor sets
// are invalidated.
if (new_layout.push_constant_layout_hash != old_layout.push_constant_layout_hash)
{
dirty_sets = ~0u;
gl_SubgroupEqMask = 1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96));
if (WaveGetLaneIndex() >= 32) gl_SubgroupEqMask.x = 0;
if (WaveGetLaneIndex() >= 64 || WaveGetLaneIndex() < 32) gl_SubgroupEqMask.y = 0;
if (WaveGetLaneIndex() >= 96 || WaveGetLaneIndex() < 64) gl_SubgroupEqMask.z = 0;
if (WaveGetLaneIndex() < 96) gl_SubgroupEqMask.w = 0;
gl_SubgroupGeMask = ~(1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96)) - 1u);
if (WaveGetLaneIndex() >= 32) gl_SubgroupGeMask.x = 0u;
if (WaveGetLaneIndex() >= 64) gl_SubgroupGeMask.y = 0u;
if (WaveGetLaneIndex() >= 96) gl_SubgroupGeMask.z = 0u;
if (WaveGetLaneIndex() < 32) gl_SubgroupGeMask.y = ~0u;
// Buffer Definitions:
//
// cbuffer c
// {
//
// struct Foo
// {
//
// float3 a; // Offset: 0
// float3 b; // Offset: 16
#0 0x00007ffff40b373c in __lll_lock_wait () from /usr/lib/libpthread.so.0 <-- Deadlock
(gdb) up
#1 0x00007ffff40aca55 in pthread_mutex_lock () from /usr/lib/libpthread.so.0
(gdb)
#2 0x00007fff85f5b67d in ?? () from /usr/lib64/amdvlk64.so <-- why does fork() end up in amdvlk64.so? :|
(gdb)
#3 0x00007ffff34c5bdd in fork () from /usr/lib/libc.so.6
(gdb)
#4 0x00007ffff4778d15 in ?? () from /usr/lib/libQt5Core.so.5
(gdb)
From b13c7f0090055f5c0277355fb86640b517841d5a Mon Sep 17 00:00:00 2001
From: Hans-Kristian Arntzen <[email protected]>
Date: Mon, 31 Jul 2017 15:19:26 +0200
Subject: [PATCH] Some fixes, clarifications and cleanups of the
synchronization page.
---
Synchronization-Examples.md | 105 +++++++++++++++++++++++---------------------
1 file changed, 56 insertions(+), 49 deletions(-)