oops forgot optimize off
This commit is contained in:
parent
b9938cb1d8
commit
2c98063e76
|
@ -1056,16 +1056,7 @@ ScePthread PThreadPool::Create() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
auto* ret = new PthreadInternal{};
|
auto* ret = new PthreadInternal{};
|
||||||
#else
|
|
||||||
// TODO: Linux specific hack
|
|
||||||
static u8* hint_address = reinterpret_cast<u8*>(0x7FFFFC000ULL);
|
|
||||||
auto* ret = reinterpret_cast<PthreadInternal*>(
|
|
||||||
mmap(hint_address, sizeof(PthreadInternal), PROT_READ | PROT_WRITE,
|
|
||||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0));
|
|
||||||
hint_address += Common::AlignUp(sizeof(PthreadInternal), 4_KB);
|
|
||||||
#endif
|
|
||||||
ret->is_free = false;
|
ret->is_free = false;
|
||||||
ret->is_detached = false;
|
ret->is_detached = false;
|
||||||
ret->is_almost_done = false;
|
ret->is_almost_done = false;
|
||||||
|
|
|
@ -129,7 +129,7 @@ Id EmitReadConst(EmitContext& ctx) {
|
||||||
Id EmitReadConstBuffer(EmitContext& ctx, u32 handle, Id index) {
|
Id EmitReadConstBuffer(EmitContext& ctx, u32 handle, Id index) {
|
||||||
auto& buffer = ctx.buffers[handle];
|
auto& buffer = ctx.buffers[handle];
|
||||||
if (!Sirit::ValidId(buffer.offset)) {
|
if (!Sirit::ValidId(buffer.offset)) {
|
||||||
buffer.offset = ctx.GetBufferOffset(buffer.global_binding);
|
buffer.offset = ctx.GetBufferOffset(handle);
|
||||||
}
|
}
|
||||||
const Id offset_dwords{ctx.OpShiftRightLogical(ctx.U32[1], buffer.offset, ctx.ConstU32(2U))};
|
const Id offset_dwords{ctx.OpShiftRightLogical(ctx.U32[1], buffer.offset, ctx.ConstU32(2U))};
|
||||||
index = ctx.OpIAdd(ctx.U32[1], index, offset_dwords);
|
index = ctx.OpIAdd(ctx.U32[1], index, offset_dwords);
|
||||||
|
@ -230,7 +230,7 @@ template <u32 N>
|
||||||
static Id EmitLoadBufferF32xN(EmitContext& ctx, u32 handle, Id address) {
|
static Id EmitLoadBufferF32xN(EmitContext& ctx, u32 handle, Id address) {
|
||||||
auto& buffer = ctx.buffers[handle];
|
auto& buffer = ctx.buffers[handle];
|
||||||
if (!Sirit::ValidId(buffer.offset)) {
|
if (!Sirit::ValidId(buffer.offset)) {
|
||||||
buffer.offset = ctx.GetBufferOffset(buffer.global_binding);
|
buffer.offset = ctx.GetBufferOffset(handle);
|
||||||
}
|
}
|
||||||
address = ctx.OpIAdd(ctx.U32[1], address, buffer.offset);
|
address = ctx.OpIAdd(ctx.U32[1], address, buffer.offset);
|
||||||
const Id index = ctx.OpShiftRightLogical(ctx.U32[1], address, ctx.ConstU32(2u));
|
const Id index = ctx.OpShiftRightLogical(ctx.U32[1], address, ctx.ConstU32(2u));
|
||||||
|
@ -412,7 +412,7 @@ template <u32 N>
|
||||||
static Id EmitLoadBufferFormatF32xN(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address) {
|
static Id EmitLoadBufferFormatF32xN(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address) {
|
||||||
auto& buffer = ctx.buffers[handle];
|
auto& buffer = ctx.buffers[handle];
|
||||||
if (!Sirit::ValidId(buffer.offset)) {
|
if (!Sirit::ValidId(buffer.offset)) {
|
||||||
buffer.offset = ctx.GetBufferOffset(buffer.global_binding);
|
buffer.offset = ctx.GetBufferOffset(handle);
|
||||||
}
|
}
|
||||||
address = ctx.OpIAdd(ctx.U32[1], address, buffer.offset);
|
address = ctx.OpIAdd(ctx.U32[1], address, buffer.offset);
|
||||||
if constexpr (N == 1) {
|
if constexpr (N == 1) {
|
||||||
|
@ -446,7 +446,7 @@ template <u32 N>
|
||||||
static void EmitStoreBufferF32xN(EmitContext& ctx, u32 handle, Id address, Id value) {
|
static void EmitStoreBufferF32xN(EmitContext& ctx, u32 handle, Id address, Id value) {
|
||||||
auto& buffer = ctx.buffers[handle];
|
auto& buffer = ctx.buffers[handle];
|
||||||
if (!Sirit::ValidId(buffer.offset)) {
|
if (!Sirit::ValidId(buffer.offset)) {
|
||||||
buffer.offset = ctx.GetBufferOffset(buffer.global_binding);
|
buffer.offset = ctx.GetBufferOffset(handle);
|
||||||
}
|
}
|
||||||
address = ctx.OpIAdd(ctx.U32[1], address, buffer.offset);
|
address = ctx.OpIAdd(ctx.U32[1], address, buffer.offset);
|
||||||
const Id index = ctx.OpShiftRightLogical(ctx.U32[1], address, ctx.ConstU32(2u));
|
const Id index = ctx.OpShiftRightLogical(ctx.U32[1], address, ctx.ConstU32(2u));
|
||||||
|
|
|
@ -352,9 +352,9 @@ void EmitContext::DefineBuffers() {
|
||||||
Decorate(id, spv::Decoration::DescriptorSet, 0U);
|
Decorate(id, spv::Decoration::DescriptorSet, 0U);
|
||||||
Name(id, fmt::format("{}_{}", buffer.is_storage ? "ssbo" : "cbuf", buffer.sgpr_base));
|
Name(id, fmt::format("{}_{}", buffer.is_storage ? "ssbo" : "cbuf", buffer.sgpr_base));
|
||||||
|
|
||||||
|
binding++;
|
||||||
buffers.push_back({
|
buffers.push_back({
|
||||||
.id = id,
|
.id = id,
|
||||||
.global_binding = binding++,
|
|
||||||
.data_types = data_types,
|
.data_types = data_types,
|
||||||
.pointer_type = pointer_type,
|
.pointer_type = pointer_type,
|
||||||
.buffer = buffer.GetVsharp(info),
|
.buffer = buffer.GetVsharp(info),
|
||||||
|
|
|
@ -203,7 +203,6 @@ public:
|
||||||
struct BufferDefinition {
|
struct BufferDefinition {
|
||||||
Id id;
|
Id id;
|
||||||
Id offset;
|
Id offset;
|
||||||
u32 global_binding;
|
|
||||||
const VectorIds* data_types;
|
const VectorIds* data_types;
|
||||||
Id pointer_type;
|
Id pointer_type;
|
||||||
AmdGpu::Buffer buffer;
|
AmdGpu::Buffer buffer;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
#pragma clang optimize off
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
|
|
||||||
#ifndef _WIN64
|
#ifndef _WIN64
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/userfaultfd.h>
|
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#ifdef ENABLE_USERFAULTFD
|
||||||
|
#include <linux/userfaultfd.h>
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -191,7 +193,11 @@ struct PageManager::Impl {
|
||||||
static void GuestFaultSignalHandler(int sig, siginfo_t* info, void* raw_context) {
|
static void GuestFaultSignalHandler(int sig, siginfo_t* info, void* raw_context) {
|
||||||
ucontext_t* ctx = reinterpret_cast<ucontext_t*>(raw_context);
|
ucontext_t* ctx = reinterpret_cast<ucontext_t*>(raw_context);
|
||||||
const VAddr address = reinterpret_cast<VAddr>(info->si_addr);
|
const VAddr address = reinterpret_cast<VAddr>(info->si_addr);
|
||||||
|
#ifdef __APPLE__
|
||||||
|
const u32 err = ctx->uc_mcontext->__es.__err;
|
||||||
|
#else
|
||||||
const greg_t err = ctx->uc_mcontext.gregs[REG_ERR];
|
const greg_t err = ctx->uc_mcontext.gregs[REG_ERR];
|
||||||
|
#endif
|
||||||
if (err & 0x2) {
|
if (err & 0x2) {
|
||||||
rasterizer->InvalidateMemory(address, sizeof(u64));
|
rasterizer->InvalidateMemory(address, sizeof(u64));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -96,7 +96,7 @@ bool ComputePipeline::BindResources(VideoCore::BufferCache& buffer_cache,
|
||||||
Shader::PushData push_data{};
|
Shader::PushData push_data{};
|
||||||
u32 binding{};
|
u32 binding{};
|
||||||
|
|
||||||
for (const auto& buffer : info.buffers) {
|
for (u32 i = 0; const auto& buffer : info.buffers) {
|
||||||
const auto vsharp = buffer.GetVsharp(info);
|
const auto vsharp = buffer.GetVsharp(info);
|
||||||
const VAddr address = vsharp.base_address;
|
const VAddr address = vsharp.base_address;
|
||||||
// Most of the time when a metadata is updated with a shader it gets cleared. It means we
|
// Most of the time when a metadata is updated with a shader it gets cleared. It means we
|
||||||
|
@ -125,7 +125,7 @@ bool ComputePipeline::BindResources(VideoCore::BufferCache& buffer_cache,
|
||||||
const u32 adjust = offset - offset_aligned;
|
const u32 adjust = offset - offset_aligned;
|
||||||
if (adjust != 0) {
|
if (adjust != 0) {
|
||||||
ASSERT(adjust % 4 == 0);
|
ASSERT(adjust % 4 == 0);
|
||||||
push_data.AddOffset(binding, adjust);
|
push_data.AddOffset(i, adjust);
|
||||||
}
|
}
|
||||||
buffer_infos.emplace_back(vk_buffer->Handle(), offset_aligned, size + adjust);
|
buffer_infos.emplace_back(vk_buffer->Handle(), offset_aligned, size + adjust);
|
||||||
set_writes.push_back({
|
set_writes.push_back({
|
||||||
|
@ -137,6 +137,7 @@ bool ComputePipeline::BindResources(VideoCore::BufferCache& buffer_cache,
|
||||||
: vk::DescriptorType::eUniformBuffer,
|
: vk::DescriptorType::eUniformBuffer,
|
||||||
.pBufferInfo = &buffer_infos.back(),
|
.pBufferInfo = &buffer_infos.back(),
|
||||||
});
|
});
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& image_desc : info.images) {
|
for (const auto& image_desc : info.images) {
|
||||||
|
|
|
@ -343,7 +343,7 @@ void GraphicsPipeline::BindResources(const Liverpool::Regs& regs,
|
||||||
push_data.step0 = regs.vgt_instance_step_rate_0;
|
push_data.step0 = regs.vgt_instance_step_rate_0;
|
||||||
push_data.step1 = regs.vgt_instance_step_rate_1;
|
push_data.step1 = regs.vgt_instance_step_rate_1;
|
||||||
}
|
}
|
||||||
for (const auto& buffer : stage.buffers) {
|
for (u32 i = 0; const auto& buffer : stage.buffers) {
|
||||||
const auto vsharp = buffer.GetVsharp(stage);
|
const auto vsharp = buffer.GetVsharp(stage);
|
||||||
if (vsharp) {
|
if (vsharp) {
|
||||||
const VAddr address = vsharp.base_address;
|
const VAddr address = vsharp.base_address;
|
||||||
|
@ -359,7 +359,7 @@ void GraphicsPipeline::BindResources(const Liverpool::Regs& regs,
|
||||||
const u32 adjust = offset - offset_aligned;
|
const u32 adjust = offset - offset_aligned;
|
||||||
if (adjust != 0) {
|
if (adjust != 0) {
|
||||||
ASSERT(adjust % 4 == 0);
|
ASSERT(adjust % 4 == 0);
|
||||||
push_data.AddOffset(binding, adjust);
|
push_data.AddOffset(i, adjust);
|
||||||
}
|
}
|
||||||
buffer_infos.emplace_back(vk_buffer->Handle(), offset_aligned, size + adjust);
|
buffer_infos.emplace_back(vk_buffer->Handle(), offset_aligned, size + adjust);
|
||||||
} else {
|
} else {
|
||||||
|
@ -374,6 +374,7 @@ void GraphicsPipeline::BindResources(const Liverpool::Regs& regs,
|
||||||
: vk::DescriptorType::eUniformBuffer,
|
: vk::DescriptorType::eUniformBuffer,
|
||||||
.pBufferInfo = &buffer_infos.back(),
|
.pBufferInfo = &buffer_infos.back(),
|
||||||
});
|
});
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::container::static_vector<AmdGpu::Image, 16> tsharps;
|
boost::container::static_vector<AmdGpu::Image, 16> tsharps;
|
||||||
|
|
Loading…
Reference in New Issue