Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d15da20
Update README
Pipetto-crypto May 9, 2026
7eae644
spirv_patcher: improve OpConstantComposite SPIRV pass
May 20, 2026
786355b
added vkd3d support to mali
Jul 4, 2026
b403caf
transcode BCn textures to ASTC and fix vkd3d D3D12 resource validatio…
Jul 4, 2026
f5dac02
dual-plane ASTC for alpha textures and transcode vkd3d's CmdCopyBuffe…
Jul 4, 2026
1a73025
speed up ASTC endpoint quantization with a lookup table and fix BCn d…
Jul 4, 2026
cd3377c
transcode BC1/BC7 to ASTC on the GPU via a compute shader, memory-cap…
Jul 4, 2026
a66f4b8
transcode BCn to configurable ASTC 8x8 blocks on the GPU or CPU
Jul 4, 2026
b6fb711
default BCn->ASTC transcode to the CPU encoder
Jul 4, 2026
3d8ab06
add WRAPPER_DIAG device-capability report for cross-device debugging
Jul 5, 2026
17ce11c
write WRAPPER_DIAG report to a per-game file
Jul 5, 2026
46cb04b
diag: append device reports instead of truncating
Jul 5, 2026
8efa432
diag: add WRAPPER_DIAG_TEX texture-path dump
Jul 5, 2026
8a60416
diag: write the texture dump into the same per-game diag file
Jul 5, 2026
b4e6f6e
diag: fold texture dump under WRAPPER_DIAG (drop WRAPPER_DIAG_TEX)
Jul 5, 2026
3319dea
diag: log every tracked buffer->image copy, not just emulated BCn
Jul 5, 2026
6debec1
Merge branch 'wrapper-25' into vkd3d-mali
Jul 5, 2026
a521e3a
Fake VK_EXT_dynamic_rendering_unused_attachments for xclipse
Jul 5, 2026
e151aac
wrapper: emulate maintenance5 + bump push constants for DXVK >2.4.1 o…
Jul 5, 2026
f62265b
diag: capture the whole D3D process (vkd3d/DXVK/wine) into one diag file
Jul 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Source
------

This repository lives at https://gitlab.freedesktop.org/mesa/mesa.
Other repositories are likely forks, and code found there is not supported. This particular repository has moved to https://github.com/Pipetto-crypto/mesa
Other repositories are likely forks, and code found there is not supported. This is a fork of https://github.com/xMeM/mesa


Build & install
Expand Down
43 changes: 37 additions & 6 deletions src/vulkan/wrapper/spirv_patcher.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <vector>
#include <map>
#include <unordered_set>

#include "spirv_patcher.hpp"
#include "wrapper_log.h"
Expand All @@ -20,10 +21,17 @@ namespace OpCode {
static const uint32_t OpCapability = 17;
static const uint32_t OpConstantComposite = 44;
static const uint32_t OpSpecConstantTrue = 48;
static const uint32_t OpSpecConstantFalse = 49;
static const uint32_t OpSpecConstant = 50;
static const uint32_t OpSpecConstantComposite = 51;
static const uint32_t OpDecorate = 71;
}

namespace OpType {
static const uint32_t OpTypeBool = 20;
static const uint32_t OpTypeVector = 23;
}

void
remove_ClipDistance(uint32_t *pCode, size_t *codeSize)
{
Expand Down Expand Up @@ -70,7 +78,9 @@ remove_ClipDistance(uint32_t *pCode, size_t *codeSize)
void
patch_OpConstantComposite_to_OpSpecConstantComposite(uint32_t *pCode, uint32_t codeSize)
{
std::vector <uint32_t> true_bool_constants;
std::unordered_set<uint32_t> bool_constants;
std::unordered_map<uint32_t, uint32_t> vector_bool_constants;
std::unordered_set<uint32_t> spec_constants;
uint32_t offset = 5;

while (offset < codeSize) {
Expand All @@ -81,13 +91,34 @@ patch_OpConstantComposite_to_OpSpecConstantComposite(uint32_t *pCode, uint32_t c
if (length == 0 || offset + length > codeSize)
break;

if (opcode == OpCode::OpSpecConstantTrue)
true_bool_constants.push_back(pCode[offset + 2]);
if (opcode == OpType::OpTypeBool)
bool_constants.insert(pCode[offset + 1]);

if (opcode == OpType::OpTypeVector) {
uint32_t variable_id = pCode[offset + 1];
uint32_t component_type = pCode[offset + 2];
uint32_t component_number = pCode[offset + 3];
if (bool_constants.count(component_type))
vector_bool_constants[variable_id] = component_number;
}

if (opcode == OpCode::OpSpecConstantTrue || opcode == OpCode::OpSpecConstantFalse || opcode == OpCode::OpSpecConstant)
spec_constants.insert(pCode[offset + 2]);

if (opcode == OpCode::OpConstantComposite) {
uint32_t component = pCode[offset + 3];
if (std::find(true_bool_constants.begin(), true_bool_constants.end(), component) != true_bool_constants.end())
pCode[offset] = (pCode[offset] & ~0xffffu) | (OpCode::OpSpecConstantComposite & 0xffffu);
uint32_t component_type = pCode[offset + 1];
auto it = vector_bool_constants.find(component_type);
if (it != vector_bool_constants.end()) {
uint32_t component_number = it->second;
uint32_t matches = 0;
for (uint32_t index = 0; index < component_number; index ++) {
uint32_t component = pCode[offset + 3 + index];
if (spec_constants.count(component))
matches++;
}
if (matches == component_number)
pCode[offset] = (pCode[offset] & ~0xffffu) | (OpCode::OpSpecConstantComposite & 0xffffu);
}
}

offset += length;
Expand Down
Loading
Loading