Meow this shit 5.0

This commit is contained in:
CamilleLaVey
2026-01-28 01:39:17 -04:00
parent 93237dec5e
commit 699d35f8a6
6 changed files with 18 additions and 13 deletions

View File

@@ -353,7 +353,7 @@ void BufferCache<P>::UpdateComputeBuffers() {
template <class P>
void BufferCache<P>::BindHostGeometryBuffers(bool is_indexed, bool use_dynamic_vertex_input,
vk::CommandBuffer* cmd) {
vk::CommandBufferPtr cmd) {
if (is_indexed) {
BindHostIndexBuffer();
} else if constexpr (!HAS_FULL_INDEX_AND_PRIMITIVE_SUPPORT) {
@@ -765,7 +765,7 @@ void BufferCache<P>::BindHostIndexBuffer() {
}
template <class P>
void BufferCache<P>::BindHostVertexBuffers(bool use_dynamic_vertex_input, vk::CommandBuffer* cmd) {
void BufferCache<P>::BindHostVertexBuffers(bool use_dynamic_vertex_input, vk::CommandBufferPtr cmd) {
HostBindings<typename P::Buffer> host_bindings;
bool any_valid{false};
auto& flags = maxwell3d->dirty.flags;

View File

@@ -39,7 +39,7 @@
namespace VideoCommon {
namespace vk {
class CommandBuffer;
using CommandBufferPtr = void*;
}
using BufferId = Common::SlotId;

View File

@@ -274,7 +274,7 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi
void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings,
bool use_dynamic_vertex_input,
VideoCommon::vk::CommandBuffer* /*cmd*/) {
VideoCommon::vk::CommandBufferPtr /*cmd*/) {
// Forward to the existing implementation; OpenGL doesn't use Vulkan command buffers.
BindVertexBuffers(bindings, use_dynamic_vertex_input);
}

View File

@@ -107,7 +107,7 @@ public:
// Compatibility overload to allow code that provides an optional Vulkan command buffer
// pointer to compile for OpenGL. The pointer is ignored for OpenGL runtime.
void BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings,
bool use_dynamic_vertex_input, VideoCommon::vk::CommandBuffer* cmd);
bool use_dynamic_vertex_input, VideoCommon::vk::CommandBufferPtr cmd);
void BindUniformBuffer(size_t stage, u32 binding_index, Buffer& buffer, u32 offset, u32 size);

View File

@@ -552,16 +552,17 @@ void BufferCacheRuntime::BindQuadIndexBuffer(PrimitiveTopology topology, u32 fir
}
void BufferCacheRuntime::BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset, u32 size, u32 stride,
bool use_dynamic_vertex_input, vk::CommandBuffer* cmd) {
bool use_dynamic_vertex_input, VideoCommon::vk::CommandBufferPtr cmd) {
if (index >= device.GetMaxVertexInputBindings()) {
return;
}
if (use_dynamic_vertex_input && device.IsExtExtendedDynamicStateSupported()) {
if (cmd) {
auto cmdbuf = static_cast<vk::CommandBuffer*>(cmd);
const VkDeviceSize vk_offset = buffer != VK_NULL_HANDLE ? offset : 0;
const VkDeviceSize vk_size = buffer != VK_NULL_HANDLE ? size : VK_WHOLE_SIZE;
const VkDeviceSize vk_stride = stride;
cmd->BindVertexBuffers2EXT(index, 1, &buffer, &vk_offset, &vk_size, &vk_stride);
cmdbuf->BindVertexBuffers2EXT(index, 1, &buffer, &vk_offset, &vk_size, &vk_stride);
} else {
scheduler.Record([index, buffer, offset, size, stride](vk::CommandBuffer cmdbuf) {
const VkDeviceSize vk_offset = buffer != VK_NULL_HANDLE ? offset : 0;
@@ -577,7 +578,8 @@ void BufferCacheRuntime::BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset
offset = 0;
}
if (cmd) {
cmd->BindVertexBuffer(index, buffer, offset);
auto cmdbuf = static_cast<vk::CommandBuffer*>(cmd);
cmdbuf->BindVertexBuffer(index, buffer, offset);
} else {
scheduler.Record([index, buffer, offset](vk::CommandBuffer cmdbuf) {
cmdbuf.BindVertexBuffer(index, buffer, offset);
@@ -587,7 +589,8 @@ void BufferCacheRuntime::BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset
}
void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings,
bool use_dynamic_vertex_input, vk::CommandBuffer* cmd) {
bool use_dynamic_vertex_input,
VideoCommon::vk::CommandBufferPtr cmd) {
boost::container::small_vector<VkBuffer, 32> buffer_handles;
for (u32 index = 0; index < bindings.buffers.size(); ++index) {
auto handle = bindings.buffers[index]->Handle();
@@ -610,7 +613,8 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi
}
if (use_dynamic_vertex_input && device.IsExtExtendedDynamicStateSupported()) {
if (cmd) {
cmd->BindVertexBuffers2EXT(bindings.min_index, binding_count, buffer_handles.data(),
auto cmdbuf = static_cast<vk::CommandBuffer*>(cmd);
cmdbuf->BindVertexBuffers2EXT(bindings.min_index, binding_count, buffer_handles.data(),
bindings.offsets.data(), bindings.sizes.data(),
bindings.strides.data());
} else {
@@ -624,7 +628,8 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi
}
} else {
if (cmd) {
cmd->BindVertexBuffers(bindings.min_index, binding_count, buffer_handles.data(),
auto cmdbuf = static_cast<vk::CommandBuffer*>(cmd);
cmdbuf->BindVertexBuffers(bindings.min_index, binding_count, buffer_handles.data(),
bindings.offsets.data());
} else {
scheduler.Record([

View File

@@ -124,10 +124,10 @@ public:
void BindQuadIndexBuffer(PrimitiveTopology topology, u32 first, u32 count);
void BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset, u32 size, u32 stride,
bool use_dynamic_vertex_input, vk::CommandBuffer* cmd = nullptr);
bool use_dynamic_vertex_input, VideoCommon::vk::CommandBufferPtr cmd = nullptr);
void BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings,
bool use_dynamic_vertex_input, vk::CommandBuffer* cmd = nullptr);
bool use_dynamic_vertex_input, VideoCommon::vk::CommandBufferPtr cmd = nullptr);
void BindTransformFeedbackBuffer(u32 index, VkBuffer buffer, u32 offset, u32 size);