mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-10-07 22:29:48 +00:00
Adjustments from the previous change for pipelines
This commit is contained in:
@@ -237,7 +237,7 @@ RasterizerVulkan::~RasterizerVulkan() {
|
||||
}
|
||||
|
||||
template <typename Func>
|
||||
void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) {
|
||||
void RasterizerVulkan::PrepareDraw(bool is_indexed, bool skip_empty, Func&& draw_func) {
|
||||
|
||||
SCOPE_EXIT {
|
||||
gpu.TickWork();
|
||||
@@ -245,6 +245,17 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) {
|
||||
FlushWork();
|
||||
gpu_memory->FlushCaching();
|
||||
|
||||
if (skip_empty) {
|
||||
const auto& draw_state = maxwell3d->draw_manager.draw_state;
|
||||
u32 count = draw_state.vertex_buffer.count;
|
||||
if (is_indexed) {
|
||||
count = draw_state.index_buffer.count;
|
||||
}
|
||||
if (count == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GraphicsPipeline* const pipeline{pipeline_cache.CurrentGraphicsPipeline()};
|
||||
if (!pipeline) {
|
||||
return;
|
||||
@@ -264,7 +275,7 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) {
|
||||
}
|
||||
|
||||
void RasterizerVulkan::Draw(bool is_indexed, u32 instance_count) {
|
||||
PrepareDraw(is_indexed, [this, is_indexed, instance_count] {
|
||||
PrepareDraw(is_indexed, true, [this, is_indexed, instance_count] {
|
||||
const auto& draw_state = maxwell3d->draw_manager.draw_state;
|
||||
const u32 num_instances{instance_count};
|
||||
const DrawParams draw_params{MakeDrawParams(draw_state, num_instances, is_indexed)};
|
||||
@@ -299,7 +310,7 @@ void RasterizerVulkan::Draw(bool is_indexed, u32 instance_count) {
|
||||
void RasterizerVulkan::DrawIndirect() {
|
||||
const auto& params = maxwell3d->draw_manager.indirect_state;
|
||||
buffer_cache.SetDrawIndirect(¶ms);
|
||||
PrepareDraw(params.is_indexed, [this, ¶ms] {
|
||||
PrepareDraw(params.is_indexed, false, [this, ¶ms] {
|
||||
const auto indirect_buffer = buffer_cache.GetDrawIndirectBuffer();
|
||||
const auto& buffer = indirect_buffer.first;
|
||||
const auto& offset = indirect_buffer.second;
|
||||
|
||||
@@ -155,7 +155,7 @@ private:
|
||||
static constexpr VkDeviceSize DEFAULT_BUFFER_SIZE = 4 * sizeof(float);
|
||||
|
||||
template <typename Func>
|
||||
void PrepareDraw(bool is_indexed, Func&&);
|
||||
void PrepareDraw(bool is_indexed, bool skip_empty, Func&&);
|
||||
|
||||
void FlushWork();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user