early-access version 3692

This commit is contained in:
pineappleEA 2023-06-18 01:33:15 +02:00
parent fa4f420db8
commit cde14e143c
3 changed files with 10 additions and 17 deletions

View file

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

View file

@ -801,8 +801,7 @@ void BufferCache<P>::BindHostGraphicsUniformBuffer(size_t stage, u32 index, u32
!HasFastUniformBufferBound(stage, binding_index) || !HasFastUniformBufferBound(stage, binding_index) ||
channel_state->uniform_buffer_binding_sizes[stage][binding_index] != size; channel_state->uniform_buffer_binding_sizes[stage][binding_index] != size;
if (should_fast_bind) { if (should_fast_bind) {
// We only have to bind when the currently bound buffer is not the fast // We only have to bind when the currently bound buffer is not the fast version
// version
channel_state->fast_bound_uniform_buffers[stage] |= 1U << binding_index; channel_state->fast_bound_uniform_buffers[stage] |= 1U << binding_index;
channel_state->uniform_buffer_binding_sizes[stage][binding_index] = size; channel_state->uniform_buffer_binding_sizes[stage][binding_index] = size;
runtime.BindFastUniformBuffer(stage, binding_index, size); runtime.BindFastUniformBuffer(stage, binding_index, size);
@ -905,7 +904,6 @@ void BufferCache<P>::BindHostTransformFeedbackBuffers() {
return; return;
} }
HostBindings<typename P::Buffer> host_bindings; HostBindings<typename P::Buffer> host_bindings;
bool any_valid{false};
for (u32 index = 0; index < NUM_TRANSFORM_FEEDBACK_BUFFERS; ++index) { for (u32 index = 0; index < NUM_TRANSFORM_FEEDBACK_BUFFERS; ++index) {
const Binding& binding = channel_state->transform_feedback_buffers[index]; const Binding& binding = channel_state->transform_feedback_buffers[index];
if (maxwell3d->regs.transform_feedback.controls[index].varying_count == 0 && if (maxwell3d->regs.transform_feedback.controls[index].varying_count == 0 &&
@ -921,12 +919,8 @@ void BufferCache<P>::BindHostTransformFeedbackBuffers() {
host_bindings.buffers.push_back(&buffer); host_bindings.buffers.push_back(&buffer);
host_bindings.offsets.push_back(offset); host_bindings.offsets.push_back(offset);
host_bindings.sizes.push_back(binding.size); host_bindings.sizes.push_back(binding.size);
host_bindings.min_index = std::min(host_bindings.min_index, index);
host_bindings.max_index = std::max(host_bindings.max_index, index);
any_valid = true;
} }
if (any_valid) { if (host_bindings.buffers.size() > 0) {
host_bindings.max_index++;
runtime.BindTransformFeedbackBuffers(host_bindings); runtime.BindTransformFeedbackBuffers(host_bindings);
} }
} }
@ -1322,8 +1316,8 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(VAddr cpu
} }
stream_score += overlap.StreamScore(); stream_score += overlap.StreamScore();
if (stream_score > STREAM_LEAP_THRESHOLD && !has_stream_leap) { if (stream_score > STREAM_LEAP_THRESHOLD && !has_stream_leap) {
// When this memory region has been joined a bunch of times, we assume it's being // When this memory region has been joined a bunch of times, we assume it's being used
// used as a stream buffer. Increase the size to skip constantly recreating buffers. // as a stream buffer. Increase the size to skip constantly recreating buffers.
has_stream_leap = true; has_stream_leap = true;
if (expands_right) { if (expands_right) {
begin -= CACHING_PAGESIZE * 256; begin -= CACHING_PAGESIZE * 256;
@ -1717,17 +1711,16 @@ Binding BufferCache<P>::StorageBufferBinding(GPUVAddr ssbo_addr, u32 cbuf_index,
const GPUVAddr gpu_addr = gpu_memory->Read<u64>(ssbo_addr); const GPUVAddr gpu_addr = gpu_memory->Read<u64>(ssbo_addr);
const auto size = [&]() { const auto size = [&]() {
const bool is_nvn_cbuf = cbuf_index == 0; const bool is_nvn_cbuf = cbuf_index == 0;
// The NVN driver buffer (index 0) is known to pack the SSBO address followed by its // The NVN driver buffer (index 0) is known to pack the SSBO address followed by its size.
// size.
if (is_nvn_cbuf) { if (is_nvn_cbuf) {
const u32 ssbo_size = gpu_memory->Read<u32>(ssbo_addr + 8); const u32 ssbo_size = gpu_memory->Read<u32>(ssbo_addr + 8);
if (ssbo_size != 0) { if (ssbo_size != 0) {
return ssbo_size; return ssbo_size;
} }
} }
// Other titles (notably Doom Eternal) may use STG/LDG on buffer addresses in custom // Other titles (notably Doom Eternal) may use STG/LDG on buffer addresses in custom defined
// defined cbufs, which do not store the sizes adjacent to the addresses, so use the // cbufs, which do not store the sizes adjacent to the addresses, so use the fully
// fully mapped buffer size for now. // mapped buffer size for now.
const u32 memory_layout_size = static_cast<u32>(gpu_memory->GetMemoryLayoutSize(gpu_addr)); const u32 memory_layout_size = static_cast<u32>(gpu_memory->GetMemoryLayoutSize(gpu_addr));
return std::min(memory_layout_size, static_cast<u32>(8_MiB)); return std::min(memory_layout_size, static_cast<u32>(8_MiB));
}(); }();

View file

@ -563,7 +563,7 @@ void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings<
} }
scheduler.Record([bindings = std::move(bindings), scheduler.Record([bindings = std::move(bindings),
buffer_handles = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { buffer_handles = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
cmdbuf.BindTransformFeedbackBuffersEXT(0, bindings.max_index - bindings.max_index, 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());
}); });