Skip to content

Commit b767e6f

Browse files
committed
2 parents d947f38 + 345d556 commit b767e6f

File tree

6 files changed

+112
-7
lines changed

6 files changed

+112
-7
lines changed

src/core/libraries/pad/pad.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerIn
104104
pInfo->touchPadInfo.pixelDensity = 1;
105105
pInfo->touchPadInfo.resolution.x = 1920;
106106
pInfo->touchPadInfo.resolution.y = 950;
107-
pInfo->stickInfo.deadZoneLeft = 20;
108-
pInfo->stickInfo.deadZoneRight = 20;
107+
pInfo->stickInfo.deadZoneLeft = 2;
108+
pInfo->stickInfo.deadZoneRight = 2;
109109
pInfo->connectionType = ORBIS_PAD_PORT_TYPE_STANDARD;
110110
pInfo->connectedCount = 1;
111111
pInfo->connected = true;

src/video_core/host_shaders/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set(SHADER_FILES
77
detile_m32x1.comp
88
detile_m32x2.comp
99
detile_m32x4.comp
10+
detile_macro8x1.comp
1011
detile_macro32x1.comp
1112
detile_macro32x2.comp
1213
fs_tri.vert

src/video_core/host_shaders/detile_macro32x2.comp

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void main() {
8787
uint offs = slice_offs + tile_offs + (idx * BPP / 8);
8888

8989
uint p0 = in_data[(offs >> 2) + 0];
90-
uint p1 = in_data[(offs >> 2) + 1];
90+
uint p1 = in_data[(offs >> 2) + 1];
9191
out_data[2 * gl_GlobalInvocationID.x + 0] = p0;
92-
out_data[2 * gl_GlobalInvocationID.x + 1] = p1;
92+
out_data[2 * gl_GlobalInvocationID.x + 1] = p1;
9393
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#version 450
5+
6+
layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
7+
8+
layout(std430, binding = 0) buffer input_buf {
9+
uint in_data[];
10+
};
11+
layout(std430, binding = 1) buffer output_buf {
12+
uint out_data[];
13+
};
14+
15+
layout(push_constant) uniform image_info {
16+
uint num_levels;
17+
uint pitch;
18+
uint height;
19+
uint c0;
20+
uint c1;
21+
} info;
22+
23+
const uint lut_8bpp[][16] = {
24+
{
25+
0x05040100, 0x45444140,
26+
0x07060302, 0x47464342,
27+
0x0d0c0908, 0x4d4c4948,
28+
0x0f0e0b0a, 0x4f4e4b4a,
29+
0x85848180, 0xc5c4c1c0,
30+
0x87868382, 0xc7c6c3c2,
31+
0x8d8c8988, 0xcdccc9c8,
32+
0x8f8e8b8a, 0xcfcecbca,
33+
},
34+
{
35+
0x15141110, 0x55545150,
36+
0x17161312, 0x57565352,
37+
0x1d1c1918, 0x5d5c5958,
38+
0x1f1e1b1a, 0x5f5e5b5a,
39+
0x95949190, 0xd5d4d1d0,
40+
0x97969392, 0xd7d6d3d2,
41+
0x9d9c9998, 0xdddcd9d8,
42+
0x9f9e9b9a, 0xdfdedbda,
43+
},
44+
{
45+
0x25242120, 0x65646160,
46+
0x27262322, 0x67666362,
47+
0x2d2c2928, 0x6d6c6968,
48+
0x2f2e2b2a, 0x6f6e6b6a,
49+
0xa5a4a1a0, 0xe5e4e1e0,
50+
0xa7a6a3a2, 0xe7e6e3e2,
51+
0xadaca9a8, 0xedece9e8,
52+
0xafaeabaa, 0xefeeebea,
53+
},
54+
{
55+
0x35343130, 0x75747170,
56+
0x37363332, 0x77767372,
57+
0x3d3c3938, 0x7d7c7978,
58+
0x3f3e3b3a, 0x7f7e7b7a,
59+
0xb5b4b1b0, 0xf5f4f1f0,
60+
0xb7b6b3b2, 0xf7f6f3f2,
61+
0xbdbcb9b8, 0xfdfcf9f8,
62+
0xbfbebbba, 0xfffefbfa,
63+
},
64+
};
65+
66+
#define MICRO_TILE_DIM (8)
67+
#define MICRO_TILE_SZ (256)
68+
#define TEXELS_PER_ELEMENT (1)
69+
#define BPP (8)
70+
71+
shared uint scratch[16];
72+
73+
void main() {
74+
uint slot = gl_LocalInvocationID.x >> 2u;
75+
atomicAnd(scratch[slot], 0);
76+
77+
uint x = gl_GlobalInvocationID.x % info.pitch;
78+
uint y = (gl_GlobalInvocationID.x / info.pitch) % info.height;
79+
uint z = gl_GlobalInvocationID.x / (info.pitch * info.height);
80+
81+
uint col = bitfieldExtract(x, 0, 3);
82+
uint row = bitfieldExtract(y, 0, 3);
83+
uint lut = bitfieldExtract(z, 0, 2);
84+
uint idx_dw = lut_8bpp[lut][(col + row * MICRO_TILE_DIM) >> 2u];
85+
uint byte_ofs = (gl_LocalInvocationID.x & 3u) * 8;
86+
uint idx = bitfieldExtract(idx_dw >> byte_ofs, 0, 8);
87+
88+
uint slice_offs = (z >> 2u) * info.c1 * MICRO_TILE_SZ;
89+
uint tile_row = y / MICRO_TILE_DIM;
90+
uint tile_column = x / MICRO_TILE_DIM;
91+
uint tile_offs = ((tile_row * info.c0) + tile_column) * MICRO_TILE_SZ;
92+
uint offs = (slice_offs + tile_offs) + (idx * BPP / 8);
93+
94+
uint p0 = in_data[offs >> 2u];
95+
uint byte = bitfieldExtract(p0 >> (offs * 8), 0, 8);
96+
atomicOr(scratch[slot], byte << byte_ofs);
97+
98+
if (byte_ofs == 0) {
99+
out_data[gl_GlobalInvocationID.x >> 2u] = scratch[slot];
100+
}
101+
}

src/video_core/texture_cache/tile_manager.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "video_core/host_shaders/detile_m8x2_comp.h"
1616
#include "video_core/host_shaders/detile_macro32x1_comp.h"
1717
#include "video_core/host_shaders/detile_macro32x2_comp.h"
18+
#include "video_core/host_shaders/detile_macro8x1_comp.h"
1819

1920
#include <boost/container/static_vector.hpp>
2021
#include <magic_enum/magic_enum.hpp>
@@ -108,6 +109,8 @@ const DetilerContext* TileManager::GetDetiler(const ImageInfo& info) const {
108109
}
109110
case AmdGpu::TilingMode::Texture_Volume:
110111
switch (format) {
112+
case vk::Format::eR8Uint:
113+
return &detilers[DetilerType::Macro8x1];
111114
case vk::Format::eR32Uint:
112115
return &detilers[DetilerType::Macro32x1];
113116
case vk::Format::eR32G32Uint:
@@ -133,8 +136,8 @@ TileManager::TileManager(const Vulkan::Instance& instance, Vulkan::Scheduler& sc
133136
static const std::array detiler_shaders{
134137
HostShaders::DETILE_M8X1_COMP, HostShaders::DETILE_M8X2_COMP,
135138
HostShaders::DETILE_M32X1_COMP, HostShaders::DETILE_M32X2_COMP,
136-
HostShaders::DETILE_M32X4_COMP, HostShaders::DETILE_MACRO32X1_COMP,
137-
HostShaders::DETILE_MACRO32X2_COMP,
139+
HostShaders::DETILE_M32X4_COMP, HostShaders::DETILE_MACRO8X1_COMP,
140+
HostShaders::DETILE_MACRO32X1_COMP, HostShaders::DETILE_MACRO32X2_COMP,
138141
};
139142

140143
boost::container::static_vector<vk::DescriptorSetLayoutBinding, 2> bindings{
@@ -323,7 +326,6 @@ std::pair<vk::Buffer, u32> TileManager::TryDetile(vk::Buffer in_buffer, u32 in_o
323326
params.height = info.size.height;
324327
if (info.tiling_mode == AmdGpu::TilingMode::Texture_Volume) {
325328
ASSERT(info.resources.levels == 1);
326-
ASSERT(info.num_bits >= 32);
327329
const auto tiles_per_row = info.pitch / 8u;
328330
const auto tiles_per_slice = tiles_per_row * ((info.size.height + 7u) / 8u);
329331
params.sizes[0] = tiles_per_row;

src/video_core/texture_cache/tile_manager.h

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ enum DetilerType : u32 {
1818
Micro32x2,
1919
Micro32x4,
2020

21+
Macro8x1,
2122
Macro32x1,
2223
Macro32x2,
2324

0 commit comments

Comments
 (0)