From 399502a03e470d00062636272c0d4f84195537e0 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 15 Jun 2023 01:59:36 +0200 Subject: [PATCH] early-access version 3678 --- README.md | 2 +- src/video_core/buffer_cache/buffer_cache.h | 8 ++--- .../buffer_cache/buffer_cache_base.h | 3 +- .../renderer_opengl/gl_buffer_cache.cpp | 19 ++++++------ .../renderer_opengl/gl_buffer_cache.h | 6 ++-- .../renderer_vulkan/vk_buffer_cache.cpp | 30 ++++++++----------- .../renderer_vulkan/vk_buffer_cache.h | 6 ++-- vcpkg.json | 2 +- 8 files changed, 37 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 0687d804d..43f696e30 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3677. +This is the source code for early-access 3678. ## Legal Notice diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 80f2030c0..9bb18bcd9 100755 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -715,7 +715,7 @@ void BufferCache

::BindHostIndexBuffer() { template void BufferCache

::BindHostVertexBuffers() { - HostBindings host_bindings; + HostBindings host_bindings; bool any_valid{false}; auto& flags = maxwell3d->dirty.flags; for (u32 index = 0; index < NUM_VERTEX_BUFFERS; ++index) { @@ -741,7 +741,7 @@ void BufferCache

::BindHostVertexBuffers() { const u32 stride = maxwell3d->regs.vertex_streams[index].stride; const u32 offset = buffer.Offset(binding.cpu_addr); - host_bindings.buffers.push_back(reinterpret_cast(&buffer)); + 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); @@ -900,7 +900,7 @@ void BufferCache

::BindHostTransformFeedbackBuffers() { if (maxwell3d->regs.transform_feedback_enabled == 0) { return; } - HostBindings host_bindings; + HostBindings host_bindings; for (u32 index = 0; index < NUM_TRANSFORM_FEEDBACK_BUFFERS; ++index) { const Binding& binding = channel_state->transform_feedback_buffers[index]; if (maxwell3d->regs.transform_feedback.controls[index].varying_count == 0 && @@ -913,7 +913,7 @@ void BufferCache

::BindHostTransformFeedbackBuffers() { SynchronizeBuffer(buffer, binding.cpu_addr, size); const u32 offset = buffer.Offset(binding.cpu_addr); - host_bindings.buffers.push_back(reinterpret_cast(&buffer)); + host_bindings.buffers.push_back(&buffer); host_bindings.offsets.push_back(offset); host_bindings.sizes.push_back(binding.size); } diff --git a/src/video_core/buffer_cache/buffer_cache_base.h b/src/video_core/buffer_cache/buffer_cache_base.h index c4bd48e90..fe6068cfe 100755 --- a/src/video_core/buffer_cache/buffer_cache_base.h +++ b/src/video_core/buffer_cache/buffer_cache_base.h @@ -105,8 +105,9 @@ static constexpr Binding NULL_BINDING{ .buffer_id = NULL_BUFFER_ID, }; +template struct HostBindings { - boost::container::small_vector buffers; + boost::container::small_vector buffers; boost::container::small_vector offsets; boost::container::small_vector sizes; boost::container::small_vector strides; diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp index bb9fbda0c..fc6f5b2d5 100755 --- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp @@ -232,12 +232,12 @@ void BufferCacheRuntime::BindVertexBuffer(u32 index, Buffer& buffer, u32 offset, } } -void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings& bindings) { - for (u32 index = 0; index < bindings.buffers.size(); index++) { - BindVertexBuffer( - bindings.min_index + index, *reinterpret_cast(bindings.buffers[index]), - static_cast(bindings.offsets[index]), static_cast(bindings.sizes[index]), - static_cast(bindings.strides[index])); +void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings& bindings) { + for (u32 index = 0; index < bindings.buffers.size(); ++index) { + BindVertexBuffer(bindings.min_index + index, *bindings.buffers[index], + static_cast(bindings.offsets[index]), + static_cast(bindings.sizes[index]), + static_cast(bindings.strides[index])); } } @@ -329,10 +329,9 @@ void BufferCacheRuntime::BindTransformFeedbackBuffer(u32 index, Buffer& buffer, static_cast(offset), static_cast(size)); } -void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings) { - for (u32 index = 0; index < bindings.buffers.size(); index++) { - glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, index, - reinterpret_cast(bindings.buffers[index])->Handle(), +void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings) { + for (u32 index = 0; index < bindings.buffers.size(); ++index) { + glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, index, bindings.buffers[index]->Handle(), static_cast(bindings.offsets[index]), static_cast(bindings.sizes[index])); } diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index 401039cfb..667b8e5cc 100755 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h @@ -87,7 +87,8 @@ public: void BindIndexBuffer(Buffer& buffer, u32 offset, u32 size); void BindVertexBuffer(u32 index, Buffer& buffer, u32 offset, u32 size, u32 stride); - void BindVertexBuffers(VideoCommon::HostBindings& bindings); + + void BindVertexBuffers(VideoCommon::HostBindings& bindings); void BindUniformBuffer(size_t stage, u32 binding_index, Buffer& buffer, u32 offset, u32 size); @@ -100,7 +101,8 @@ public: bool is_written); void BindTransformFeedbackBuffer(u32 index, Buffer& buffer, u32 offset, u32 size); - void BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings); + + void BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings); void BindTextureBuffer(Buffer& buffer, u32 offset, u32 size, VideoCore::Surface::PixelFormat format); diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index f4bd6e5f1..461842174 100755 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp @@ -501,11 +501,10 @@ void BufferCacheRuntime::BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset } } -void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings& bindings) { +void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings& bindings) { boost::container::small_vector buffer_handles; - for (u32 index = 0; index < bindings.buffers.size(); index++) { - auto& buffer = *reinterpret_cast(bindings.buffers[index]); - auto handle = buffer.Handle(); + for (u32 index = 0; index < bindings.buffers.size(); ++index) { + auto handle = bindings.buffers[index]->Handle(); if (handle == VK_NULL_HANDLE) { bindings.offsets[index] = 0; bindings.sizes[index] = VK_WHOLE_SIZE; @@ -521,16 +520,13 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings& bindings) buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) { cmdbuf.BindVertexBuffers2EXT( bindings.min_index, bindings.max_index - bindings.min_index, buffer_handles.data(), - reinterpret_cast(bindings.offsets.data()), - reinterpret_cast(bindings.sizes.data()), - reinterpret_cast(bindings.strides.data())); + bindings.offsets.data(), bindings.sizes.data(), bindings.strides.data()); }); } else { scheduler.Record([bindings = bindings, buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) { - cmdbuf.BindVertexBuffers( - bindings.min_index, bindings.max_index - bindings.min_index, buffer_handles.data(), - reinterpret_cast(bindings.offsets.data())); + cmdbuf.BindVertexBuffers(bindings.min_index, bindings.max_index - bindings.min_index, + buffer_handles.data(), bindings.offsets.data()); }); } } @@ -556,22 +552,20 @@ void BufferCacheRuntime::BindTransformFeedbackBuffer(u32 index, VkBuffer buffer, }); } -void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings) { +void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings) { if (!device.IsExtTransformFeedbackSupported()) { // Already logged in the rasterizer return; } boost::container::small_vector buffer_handles; - for (u32 index = 0; index < bindings.buffers.size(); index++) { - auto& buffer = *reinterpret_cast(bindings.buffers[index]); - buffer_handles.push_back(buffer.Handle()); + for (u32 index = 0; index < bindings.buffers.size(); ++index) { + buffer_handles.push_back(bindings.buffers[index]->Handle()); } scheduler.Record( [bindings = bindings, buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) { - cmdbuf.BindTransformFeedbackBuffersEXT( - 0, static_cast(buffer_handles.size()), buffer_handles.data(), - reinterpret_cast(bindings.offsets.data()), - reinterpret_cast(bindings.sizes.data())); + cmdbuf.BindTransformFeedbackBuffersEXT(0, static_cast(buffer_handles.size()), + buffer_handles.data(), bindings.offsets.data(), + bindings.sizes.data()); }); } diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h index bc27f4e8d..51731a2db 100755 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.h +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h @@ -97,10 +97,12 @@ public: void BindQuadIndexBuffer(PrimitiveTopology topology, u32 first, u32 count); void BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset, u32 size, u32 stride); - void BindVertexBuffers(VideoCommon::HostBindings& bindings); + + void BindVertexBuffers(VideoCommon::HostBindings& bindings); void BindTransformFeedbackBuffer(u32 index, VkBuffer buffer, u32 offset, u32 size); - void BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings); + + void BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings); std::span BindMappedUniformBuffer([[maybe_unused]] size_t stage, [[maybe_unused]] u32 binding_index, u32 size) { diff --git a/vcpkg.json b/vcpkg.json index 72b6767f1..402a7c6c4 100755 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "yuzu", - "builtin-baseline": "656fcc6ab2b05c6d999b7eaca717027ac3738f71", + "builtin-baseline": "a487471068f4cb1cbb4eeb340763cdcc0a75fd68", "version": "1.0", "dependencies": [ "boost-algorithm",