early-access version 3686

This commit is contained in:
pineappleEA 2023-06-17 01:43:12 +02:00
parent e6541a28b3
commit 42155b2b04
4 changed files with 36 additions and 31 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3685. This is the source code for early-access 3686.
## Legal Notice ## Legal Notice

View file

@ -719,9 +719,24 @@ void BufferCache<P>::BindHostVertexBuffers() {
bool any_valid{false}; bool any_valid{false};
auto& flags = maxwell3d->dirty.flags; auto& flags = maxwell3d->dirty.flags;
for (u32 index = 0; index < NUM_VERTEX_BUFFERS; ++index) { for (u32 index = 0; index < NUM_VERTEX_BUFFERS; ++index) {
const Binding& binding = channel_state->vertex_buffers[index];
if (binding.buffer_id == NULL_BUFFER_ID) {
continue;
}
Buffer& buffer = slot_buffers[binding.buffer_id];
TouchBuffer(buffer, binding.buffer_id);
SynchronizeBuffer(buffer, binding.cpu_addr, binding.size);
if (!flags[Dirty::VertexBuffer0 + index]) { if (!flags[Dirty::VertexBuffer0 + index]) {
continue; continue;
} }
flags[Dirty::VertexBuffer0 + index] = false;
const u32 stride = maxwell3d->regs.vertex_streams[index].stride;
const u32 offset = buffer.Offset(binding.cpu_addr);
host_bindings.buffers.push_back(&buffer);
host_bindings.offsets.push_back(offset);
host_bindings.sizes.push_back(binding.size);
host_bindings.strides.push_back(stride);
host_bindings.min_index = std::min(host_bindings.min_index, index); host_bindings.min_index = std::min(host_bindings.min_index, index);
host_bindings.max_index = std::max(host_bindings.max_index, index); host_bindings.max_index = std::max(host_bindings.max_index, index);
any_valid = true; any_valid = true;
@ -729,23 +744,6 @@ void BufferCache<P>::BindHostVertexBuffers() {
if (any_valid) { if (any_valid) {
host_bindings.max_index++; host_bindings.max_index++;
for (u32 index = host_bindings.min_index; index < host_bindings.max_index; index++) {
flags[Dirty::VertexBuffer0 + index] = false;
const Binding& binding = channel_state->vertex_buffers[index];
Buffer& buffer = slot_buffers[binding.buffer_id];
TouchBuffer(buffer, binding.buffer_id);
SynchronizeBuffer(buffer, binding.cpu_addr, binding.size);
const u32 stride = maxwell3d->regs.vertex_streams[index].stride;
const u32 offset = buffer.Offset(binding.cpu_addr);
host_bindings.buffers.push_back(&buffer);
host_bindings.offsets.push_back(offset);
host_bindings.sizes.push_back(binding.size);
host_bindings.strides.push_back(stride);
}
runtime.BindVertexBuffers(host_bindings); runtime.BindVertexBuffers(host_bindings);
} }
} }
@ -907,6 +905,9 @@ void BufferCache<P>::BindHostTransformFeedbackBuffers() {
maxwell3d->regs.transform_feedback.controls[index].stride == 0) { maxwell3d->regs.transform_feedback.controls[index].stride == 0) {
break; break;
} }
if (binding.buffer_id == NULL_BUFFER_ID) {
continue;
}
Buffer& buffer = slot_buffers[binding.buffer_id]; Buffer& buffer = slot_buffers[binding.buffer_id];
TouchBuffer(buffer, binding.buffer_id); TouchBuffer(buffer, binding.buffer_id);
const u32 size = binding.size; const u32 size = binding.size;

View file

@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "common/settings.h"
#include "video_core/dirty_flags.h" #include "video_core/dirty_flags.h"
#include "video_core/engines/draw_manager.h" #include "video_core/engines/draw_manager.h"
#include "video_core/rasterizer_interface.h" #include "video_core/rasterizer_interface.h"
@ -195,8 +196,12 @@ void DrawManager::DrawTexture() {
if (lower_left) { if (lower_left) {
draw_texture_state.dst_y0 -= dst_height; draw_texture_state.dst_y0 -= dst_height;
} }
draw_texture_state.dst_x1 = draw_texture_state.dst_x0 + dst_width; draw_texture_state.dst_x1 =
draw_texture_state.dst_y1 = draw_texture_state.dst_y0 + dst_height; draw_texture_state.dst_x0 +
static_cast<f32>(Settings::values.resolution_info.ScaleUp(static_cast<u32>(dst_width)));
draw_texture_state.dst_y1 =
draw_texture_state.dst_y0 +
static_cast<f32>(Settings::values.resolution_info.ScaleUp(static_cast<u32>(dst_height)));
draw_texture_state.src_x0 = static_cast<float>(regs.draw_texture.src_x0) / 4096.f; draw_texture_state.src_x0 = static_cast<float>(regs.draw_texture.src_x0) / 4096.f;
draw_texture_state.src_y0 = static_cast<float>(regs.draw_texture.src_y0) / 4096.f; draw_texture_state.src_y0 = static_cast<float>(regs.draw_texture.src_y0) / 4096.f;
draw_texture_state.src_x1 = draw_texture_state.src_x1 =
@ -207,7 +212,6 @@ void DrawManager::DrawTexture() {
draw_texture_state.src_y0; draw_texture_state.src_y0;
draw_texture_state.src_sampler = regs.draw_texture.src_sampler; draw_texture_state.src_sampler = regs.draw_texture.src_sampler;
draw_texture_state.src_texture = regs.draw_texture.src_texture; draw_texture_state.src_texture = regs.draw_texture.src_texture;
maxwell3d->rasterizer->DrawTexture(); maxwell3d->rasterizer->DrawTexture();
} }

View file

@ -516,15 +516,15 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi
buffer_handles.push_back(handle); buffer_handles.push_back(handle);
} }
if (device.IsExtExtendedDynamicStateSupported()) { if (device.IsExtExtendedDynamicStateSupported()) {
scheduler.Record([bindings = bindings, scheduler.Record([bindings = std::move(bindings),
buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) { buffer_handles = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
cmdbuf.BindVertexBuffers2EXT( cmdbuf.BindVertexBuffers2EXT(
bindings.min_index, bindings.max_index - bindings.min_index, buffer_handles.data(), bindings.min_index, bindings.max_index - bindings.min_index, buffer_handles.data(),
bindings.offsets.data(), bindings.sizes.data(), bindings.strides.data()); bindings.offsets.data(), bindings.sizes.data(), bindings.strides.data());
}); });
} else { } else {
scheduler.Record([bindings = bindings, scheduler.Record([bindings = std::move(bindings),
buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) { buffer_handles = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
cmdbuf.BindVertexBuffers(bindings.min_index, bindings.max_index - bindings.min_index, cmdbuf.BindVertexBuffers(bindings.min_index, bindings.max_index - bindings.min_index,
buffer_handles.data(), bindings.offsets.data()); buffer_handles.data(), bindings.offsets.data());
}); });
@ -561,8 +561,8 @@ void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings<
for (u32 index = 0; index < bindings.buffers.size(); ++index) { for (u32 index = 0; index < bindings.buffers.size(); ++index) {
buffer_handles.push_back(bindings.buffers[index]->Handle()); buffer_handles.push_back(bindings.buffers[index]->Handle());
} }
scheduler.Record( scheduler.Record([bindings = std::move(bindings),
[bindings = bindings, buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) { buffer_handles = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
cmdbuf.BindTransformFeedbackBuffersEXT(0, static_cast<u32>(buffer_handles.size()), cmdbuf.BindTransformFeedbackBuffersEXT(0, static_cast<u32>(buffer_handles.size()),
buffer_handles.data(), bindings.offsets.data(), buffer_handles.data(), bindings.offsets.data(),
bindings.sizes.data()); bindings.sizes.data());