mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-11-21 04:20:07 +01:00
Adjustments from the previous change for pipelines
This commit is contained in:
parent
b10212fe94
commit
f92e326e17
4 changed files with 21 additions and 13 deletions
|
|
@ -228,7 +228,11 @@ public:
|
||||||
bool BindMultiRangeStorage(const Binding& binding, bool is_written,
|
bool BindMultiRangeStorage(const Binding& binding, bool is_written,
|
||||||
std::span<const MultiRangeSegment> pool);
|
std::span<const MultiRangeSegment> pool);
|
||||||
|
|
||||||
void ResolveMultiRangeStorage(Binding& binding, std::vector<MultiRangeSegment>& pool);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ResolveMultiRangeStorage(Binding& binding, std::vector<MultiRangeSegment>& pool);
|
||||||
|
|
||||||
void UnmapGPUMemory(size_t as_id, GPUVAddr gpu_addr, size_t size);
|
void UnmapGPUMemory(size_t as_id, GPUVAddr gpu_addr, size_t size);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ void Maxwell3D::DrawManager::FlushInstanceArray(Maxwell3D& maxwell3d) {
|
||||||
const u32 instance_count = draw_state.instance_count + 1;
|
const u32 instance_count = draw_state.instance_count + 1;
|
||||||
draw_state.draw_mode = DrawMode::General;
|
draw_state.draw_mode = DrawMode::General;
|
||||||
draw_state.instance_count = 0;
|
draw_state.instance_count = 0;
|
||||||
if (draw_state.vertex_buffer.count != 0 && maxwell3d.ShouldExecute()) {
|
if (maxwell3d.ShouldExecute()) {
|
||||||
maxwell3d.rasterizer->Draw(false, instance_count);
|
maxwell3d.rasterizer->Draw(false, instance_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -309,13 +309,6 @@ void Maxwell3D::DrawManager::UpdateTopology(Maxwell3D& maxwell3d) {
|
||||||
void Maxwell3D::DrawManager::ProcessDraw(Maxwell3D& maxwell3d, bool draw_indexed, u32 instance_count) {
|
void Maxwell3D::DrawManager::ProcessDraw(Maxwell3D& maxwell3d, bool draw_indexed, u32 instance_count) {
|
||||||
LOG_TRACE(HW_GPU, "called, topology={}, count={}", draw_state.topology, draw_indexed ? draw_state.index_buffer.count : draw_state.vertex_buffer.count);
|
LOG_TRACE(HW_GPU, "called, topology={}, count={}", draw_state.topology, draw_indexed ? draw_state.index_buffer.count : draw_state.vertex_buffer.count);
|
||||||
UpdateTopology(maxwell3d);
|
UpdateTopology(maxwell3d);
|
||||||
u32 count = draw_state.vertex_buffer.count;
|
|
||||||
if (draw_indexed) {
|
|
||||||
count = draw_state.index_buffer.count;
|
|
||||||
}
|
|
||||||
if (count == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (maxwell3d.ShouldExecute()) {
|
if (maxwell3d.ShouldExecute()) {
|
||||||
maxwell3d.rasterizer->Draw(draw_indexed, instance_count);
|
maxwell3d.rasterizer->Draw(draw_indexed, instance_count);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ RasterizerVulkan::~RasterizerVulkan() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Func>
|
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 {
|
SCOPE_EXIT {
|
||||||
gpu.TickWork();
|
gpu.TickWork();
|
||||||
|
|
@ -245,6 +245,17 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) {
|
||||||
FlushWork();
|
FlushWork();
|
||||||
gpu_memory->FlushCaching();
|
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()};
|
GraphicsPipeline* const pipeline{pipeline_cache.CurrentGraphicsPipeline()};
|
||||||
if (!pipeline) {
|
if (!pipeline) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -264,7 +275,7 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::Draw(bool is_indexed, u32 instance_count) {
|
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 auto& draw_state = maxwell3d->draw_manager.draw_state;
|
||||||
const u32 num_instances{instance_count};
|
const u32 num_instances{instance_count};
|
||||||
const DrawParams draw_params{MakeDrawParams(draw_state, num_instances, is_indexed)};
|
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() {
|
void RasterizerVulkan::DrawIndirect() {
|
||||||
const auto& params = maxwell3d->draw_manager.indirect_state;
|
const auto& params = maxwell3d->draw_manager.indirect_state;
|
||||||
buffer_cache.SetDrawIndirect(¶ms);
|
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 indirect_buffer = buffer_cache.GetDrawIndirectBuffer();
|
||||||
const auto& buffer = indirect_buffer.first;
|
const auto& buffer = indirect_buffer.first;
|
||||||
const auto& offset = indirect_buffer.second;
|
const auto& offset = indirect_buffer.second;
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ private:
|
||||||
static constexpr VkDeviceSize DEFAULT_BUFFER_SIZE = 4 * sizeof(float);
|
static constexpr VkDeviceSize DEFAULT_BUFFER_SIZE = 4 * sizeof(float);
|
||||||
|
|
||||||
template <typename Func>
|
template <typename Func>
|
||||||
void PrepareDraw(bool is_indexed, Func&&);
|
void PrepareDraw(bool is_indexed, bool skip_empty, Func&&);
|
||||||
|
|
||||||
void FlushWork();
|
void FlushWork();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue