Skip to content

Commit 9a332a2

Browse files
Merge 356fa7b into b7e0df3
2 parents b7e0df3 + 356fa7b commit 9a332a2

File tree

3 files changed

+84
-2
lines changed

3 files changed

+84
-2
lines changed

src/core/libraries/kernel/thread_management.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,16 @@ ScePthread PThreadPool::Create() {
10711071
}
10721072
}
10731073

1074+
#ifdef _WIN64
10741075
auto* ret = new PthreadInternal{};
1076+
#else
1077+
// TODO: Linux specific hack
1078+
static u8* hint_address = reinterpret_cast<u8*>(0x7FFFFC000ULL);
1079+
auto* ret = reinterpret_cast<PthreadInternal*>(
1080+
mmap(hint_address, sizeof(PthreadInternal), PROT_READ | PROT_WRITE,
1081+
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0));
1082+
hint_address += Common::AlignUp(sizeof(PthreadInternal), 4_KB);
1083+
#endif
10751084
ret->is_free = false;
10761085
ret->is_detached = false;
10771086
ret->is_almost_done = false;

src/video_core/renderer_vulkan/vk_compute_pipeline.cpp

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,76 @@ bool ComputePipeline::BindResources(VideoCore::BufferCache& buffer_cache,
107107
Shader::PushData push_data{};
108108
u32 binding{};
109109

110+
if (info->pgm_hash == 0x3d5ebf4e) {
111+
const auto& src = info->texture_buffers[0];
112+
const auto src_sharp = src.GetSharp(*info);
113+
const auto& dst = info->texture_buffers[1];
114+
const auto dst_sharp = dst.GetSharp(*info);
115+
if (dst_sharp.base_address == 0x510e0000 ||
116+
dst_sharp.base_address == 0x1926e0000 || // Release
117+
dst_sharp.base_address == 0x1928e0000 || // ReleaseWithDebInfo
118+
dst_sharp.base_address == 0x1d42e0000) {
119+
VideoCore::ImageViewInfo view_info;
120+
view_info.format = vk::Format::eR8G8B8A8Unorm;
121+
view_info.type = vk::ImageViewType::e2D;
122+
view_info.range.extent.layers = 1;
123+
view_info.range.extent.levels = 1;
124+
AmdGpu::Image src_image;
125+
src_image.base_address = src_sharp.base_address >> 8;
126+
src_image.base_level = 0;
127+
src_image.width = 1920 - 1;
128+
src_image.height = 1080 - 1;
129+
src_image.depth = 1;
130+
src_image.data_format = u64(AmdGpu::DataFormat::Format8_8_8_8);
131+
src_image.num_format = u64(AmdGpu::NumberFormat::Unorm);
132+
src_image.dst_sel_x = 4;
133+
src_image.dst_sel_y = 5;
134+
src_image.dst_sel_z = 6;
135+
src_image.dst_sel_w = 7;
136+
src_image.pitch = 1920 - 1;
137+
src_image.type = u64(AmdGpu::ImageType::Color2D);
138+
src_image.tiling_index = u64(AmdGpu::TilingMode::Display_MacroTiled);
139+
140+
VideoCore::ImageInfo src_info{src_image};
141+
const auto src_id = texture_cache.FindImage(src_info);
142+
auto& src_img = texture_cache.GetImage(src_id);
143+
src_img.Transit(vk::ImageLayout::eTransferSrcOptimal,
144+
vk::AccessFlagBits::eTransferRead);
145+
146+
src_image.base_address = dst_sharp.base_address >> 8;
147+
VideoCore::ImageInfo dst_info{src_image};
148+
const auto dst_id = texture_cache.FindImage(dst_info);
149+
auto& dst_img = texture_cache.GetImage(dst_id);
150+
dst_img.Transit(vk::ImageLayout::eTransferDstOptimal,
151+
vk::AccessFlagBits::eTransferWrite);
152+
153+
const auto cmdbuf = scheduler.CommandBuffer();
154+
scheduler.EndRendering();
155+
const vk::ImageCopy copy = {
156+
.srcSubresource =
157+
{
158+
.aspectMask = vk::ImageAspectFlagBits::eColor,
159+
.mipLevel = 0,
160+
.baseArrayLayer = 0,
161+
.layerCount = 1,
162+
},
163+
.srcOffset = {0, 0, 0},
164+
.dstSubresource =
165+
{
166+
.aspectMask = vk::ImageAspectFlagBits::eColor,
167+
.mipLevel = 0,
168+
.baseArrayLayer = 0,
169+
.layerCount = 1,
170+
},
171+
.dstOffset = {0, 0, 0},
172+
.extent = {1920, 1080, 1},
173+
};
174+
cmdbuf.copyImage(src_img.image, vk::ImageLayout::eTransferSrcOptimal, dst_img.image,
175+
vk::ImageLayout::eTransferDstOptimal, copy);
176+
return false;
177+
}
178+
}
179+
110180
for (const auto& desc : info->buffers) {
111181
const auto vsharp = desc.GetSharp(*info);
112182
const bool is_storage = desc.IsStorage(vsharp);
@@ -166,7 +236,7 @@ bool ComputePipeline::BindResources(VideoCore::BufferCache& buffer_cache,
166236
LOG_WARNING(Render_Vulkan, "Unexpected metadata read by a CS shader (buffer)");
167237
}
168238
}
169-
if (desc.is_written) {
239+
if (desc.is_written && info->pgm_hash != 0xfefebf9f) { // Not skipping 0x3d5ebf4e as well, otherwise video player will be black
170240
texture_cache.InvalidateMemory(address, size);
171241
}
172242
const u32 alignment = instance.TexelBufferMinAlignment();

src/video_core/renderer_vulkan/vk_pipeline_cache.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ const ComputePipeline* PipelineCache::GetComputePipeline() {
6464
}
6565

6666
bool ShouldSkipShader(u64 shader_hash, const char* shader_type) {
67-
static constexpr std::array<u64, 0> skip_hashes = {};
67+
static constexpr std::array<u64, 11> skip_hashes = {0xa509af23, 0x4ca76892, 0xa954e79d,
68+
0x42f2a521, 0x2da7fe60, 0x1635154c,
69+
0x8e3f8dc4, 0xc0cbc309, 0x77d1c63,
70+
0xff7a6d7c, 0xddfbac23};
6871
if (std::ranges::contains(skip_hashes, shader_hash)) {
6972
LOG_WARNING(Render_Vulkan, "Skipped {} shader hash {:#x}.", shader_type, shader_hash);
7073
return true;

0 commit comments

Comments
 (0)