mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 19:07:01 +02:00
shader: materialize exact buffer capacity through shared clean reads
Co-authored-by: shadowbeat070 <70843316+shadowbeat070@users.noreply.github.com>
This commit is contained in:
@@ -805,8 +805,7 @@ void RenderExecutor::PrepareBindings(const ShaderStageRuntime& runtime,
|
||||
}
|
||||
}
|
||||
|
||||
void RenderExecutor::FindBuffers(PreparedBindings& prepared, uint64_t dispatch_threads_x,
|
||||
uint32_t group_size_x) {
|
||||
void RenderExecutor::FindBuffers(PreparedBindings& prepared) {
|
||||
KYTY_PROFILER_FUNCTION();
|
||||
EXIT_IF(prepared.runtime == nullptr || !*prepared.runtime);
|
||||
const auto& program = *prepared.runtime->program;
|
||||
@@ -823,23 +822,8 @@ void RenderExecutor::FindBuffers(PreparedBindings& prepared, uint64_t dispatch_t
|
||||
for (const auto resource: resources) {
|
||||
auto descriptor = DecodeNativeDescriptor<ShaderBufferResource>(snapshot.buffers[resource]);
|
||||
const auto address = descriptor.Base48();
|
||||
if (address == 0u) {
|
||||
prepared.buffer_sources.push_back({});
|
||||
continue;
|
||||
}
|
||||
auto requested_size = descriptor.GetSize();
|
||||
const auto& buffer = program.info.buffers[resource];
|
||||
if (buffer.dispatch_stride != 0u) {
|
||||
if (dispatch_threads_x == 0u || dispatch_threads_x > uint64_t{UINT32_MAX} + 1u ||
|
||||
buffer.dispatch_stride != group_size_x) {
|
||||
EXIT("GPU-sized buffer requires a known matching X dispatch extent\n");
|
||||
}
|
||||
requested_size = (dispatch_threads_x - 1u) * descriptor.Stride() + buffer.max_byte_extent;
|
||||
if (requested_size > uint64_t{UINT32_MAX} + 1u) {
|
||||
EXIT("GPU-sized buffer dispatch wraps its 32-bit byte address\n");
|
||||
}
|
||||
}
|
||||
if (requested_size == 0) {
|
||||
const auto requested_size = descriptor.GetSize();
|
||||
if (address == 0 || requested_size == 0) {
|
||||
prepared.buffer_sources.push_back({});
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -161,9 +161,7 @@ public:
|
||||
uint32_t mode);
|
||||
|
||||
void PrepareBindings(const ShaderStageRuntime& runtime, PreparedBindings& prepared);
|
||||
void FindBuffers(PreparedBindings& bindings,
|
||||
uint64_t dispatch_threads_x = 0,
|
||||
uint32_t group_size_x = 0);
|
||||
void FindBuffers(PreparedBindings& bindings);
|
||||
void RebindBuffers(PreparedBindings& bindings);
|
||||
void RebindImages(PreparedBindings& bindings);
|
||||
void CommitBindings(CommandBuffer& buffer, vk::PipelineBindPoint pipeline_bind_point,
|
||||
|
||||
@@ -306,10 +306,7 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer,
|
||||
std::copy(std::begin(input_info.dispatch_threads_num), std::end(input_info.dispatch_threads_num),
|
||||
bindings.shader_data.begin() + program.bindings.dispatch_thread_dword);
|
||||
}
|
||||
const auto dispatch_threads_x = use_thread_dimensions
|
||||
? uint64_t{input_info.dispatch_threads_num[0]}
|
||||
: uint64_t{thread_group_x} * input_info.threads_num[0];
|
||||
FindBuffers(bindings, dispatch_threads_x, input_info.threads_num[0]);
|
||||
FindBuffers(bindings);
|
||||
if (program.info.uses_dma) {
|
||||
m_context.PrepareBda();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user