VideoCore: Implement DispatchIndirect

This commit is contained in:
Fernando Sahmkow
2023-08-27 02:58:00 +02:00
parent 710ca3ca49
commit 115792158d
11 changed files with 119 additions and 13 deletions

View File

@ -380,6 +380,17 @@ void RasterizerOpenGL::DispatchCompute() {
pipeline->SetEngine(kepler_compute, gpu_memory);
pipeline->Configure();
const auto& qmd{kepler_compute->launch_description};
auto indirect_address = kepler_compute->GetIndirectComputeAddress();
if (indirect_address) {
// DispatchIndirect
static constexpr auto sync_info = VideoCommon::ObtainBufferSynchronize::FullSynchronize;
const auto post_op = VideoCommon::ObtainBufferOperation::DiscardWrite;
const auto [buffer, offset] =
buffer_cache.ObtainBuffer(*indirect_address, 12, sync_info, post_op);
glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, buffer->Handle());
glDispatchComputeIndirect(static_cast<GLintptr>(offset));
return;
}
glDispatchCompute(qmd.grid_dim_x, qmd.grid_dim_y, qmd.grid_dim_z);
++num_queued_commands;
has_written_global_memory |= pipeline->WritesGlobalMemory();