Skip to content

Instantly share code, notes, and snippets.

View leegao's full-sized avatar
💭
Backpacking the 🌍

Lee Gao leegao

💭
Backpacking the 🌍
View GitHub Profile
@leegao
leegao / cmds.txt
Created July 21, 2025 13:14
ACC.exe spirv shader causing Mali G715 to fail CreateGraphicsPipeline
CreateFramebuffer
in: device: VkDevice (handle) = 0xb4000075a4e69010
in: pCreateInfo: VkFramebufferCreateInfo*
.flags: VkFramebufferCreateFlags = 0x0
.renderPass: VkRenderPass (handle) = 0xb400007454e8d0d0
.attachmentCount: uint32_t = 0x1
.pAttachments[0]: VkImageView* = 0xb40000746501b800
.width: uint32_t = 0x500
.height: uint32_t = 0x2d0
.layers: uint32_t = 0x1

From AI Studio analysis of https://github.com/google/angle/blob/6a04a50f98cac71b25464d10289ce7a013841caf/src/libANGLE/renderer/vulkan/vk_renderer.cpp#L4879

1. ARM / Mali

These workarounds apply to GPUs designed by ARM (Mali), found in chipsets like Samsung Exynos, Google Tensor, and MediaTek Dimensity.

Feature / Workaround mFeatures Flag Condition / Driver Version Reason & Impact
Protected Memory Restriction supportsProtectedMemory Blocked if: isARM && !pipelineProtectedAccess Bug: On older ARM platforms, enabling VK_KHR_protected_memory causes excessive, unnecessary load/store unit activity. Workaround: Only enabled on ARM if the newer VK_EXT_pipeline_protected_access extension is also present, indicating a fixed driver. (b/208458772)
Mixed Load Op Restriction disallowMixedDepthStencilLoadOpNoneAndLoad Enabled if: isARM && driverVersion < r38.1.0 Bug: ARM drivers older than r38p1 are bug
@leegao
leegao / gist:e24afbb5f55fe678139197d703d7f600
Last active July 17, 2025 14:16
dxvk 1.10.3 features
[REQUIRED] robustBufferAccess / CORE10 (feature)
FL=9.1 - Always enabled if supported by Vulkan. Used for robustness and constant buffer range checks.
ImgTec
+ unsupported (0/42): []
+ supported (42/42): ['0.1017-139.3 (41/41)']
Mali Proprietary
+ unsupported (0/66): []
+ supported (66/66): ['25.1-50.0 (65/65)']
Qcom Proprietary
+ unsupported (0/157): []
@leegao
leegao / dxvk_1_10_3_feature_support.json
Created July 17, 2025 08:23
Vulkan features and extension features requirements and coverage on Android devices for those requested by dxvk 1.10.3
[
{
"name": "robustBufferAccess",
"type": "feature",
"extension": "CORE10",
"required": true,
"feature_level": "9.1",
"notes": "Always enabled if supported by Vulkan. Used for robustness and constant buffer range checks.",
"supported_driver_versions": {
"Qcom Proprietary": [
@leegao
leegao / winlator.diff
Created June 12, 2025 12:01
Diff of recent Winlator Bionic changes
diff --git a/app/build.gradle b/app/build.gradle
index f0f10e9..0abcde4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -21,18 +21,18 @@ plugins {
tasks.register("prepareKotlinBuildScriptModel"){}
android {
- namespace 'com.winlator'
+ namespace 'com.winlator.cmod'
#include <string.h>
#include <jni.h>
#include <vulkan/vulkan.h>
#include <dlfcn.h>
#include <android/log.h>
#include <stdio.h>
#include <__algorithm/find_if.h>
#include <assert.h>
#include <android/log.h>
#include <iostream>
@leegao
leegao / CMakeLists.txt
Last active June 3, 2025 21:49
Workaround to enable Vulkan validation layer in Vortek on Winlator
add_library(${CMAKE_PROJECT_NAME} SHARED
# List C/C++ source files with relative paths to this CMakeLists.txt.
dummyvk.cpp)
# Specifies libraries CMake should link to your target library. You
# can link libraries from various origins, such as libraries defined in this
# build script, prebuilt third-party libraries, or Android system libraries.
target_link_libraries(${CMAKE_PROJECT_NAME}
# List libraries link to the target library
android
@leegao
leegao / ai.sh
Created April 16, 2025 22:42
Pair Bashing with Gemini
#!/bin/bash
PPID1=$(ps -o ppid= "$$" | tr -d ' ')
PPID2=$(ps -o ppid= "$PPID1" | tr -d ' ')
PARENT=$(ps -p "$PPID2" -o comm=)
if [ -z "$1" ]; then
if [ "$PARENT" != "script" ] ; then
export HISTORY_FILE=$(mktemp)
echo "Run with history ($HISTORY_FILE), don't forget to ctrl+D"
@leegao
leegao / RPNJit.py
Created November 10, 2016 23:31
Ahead-of-time RPN compiler.
import ctypes, mmap, struct
DEBUG = True
try:
VirtualAlloc = ctypes.windll.kernel32.VirtualAlloc
raise Exception("Windows not supported.")
except(AttributeError):
libc = ctypes.CDLL("libc.so.6")
libc.valloc.restype = ctypes.c_void_p
def valloc(size):
addr = libc.valloc(size)
@leegao
leegao / RPNJit.py
Created November 10, 2016 23:05
Ahead-of-time compiled RPN for /r/DailyProgrammer
import ctypes, mmap, struct
DEBUG = True
try:
VirtualAlloc = ctypes.windll.kernel32.VirtualAlloc
raise Exception("Windows not supported.")
except(AttributeError):
libc = ctypes.CDLL("libc.so.6")
libc.valloc.restype = ctypes.c_void_p
def valloc(size):
addr = libc.valloc(size)