diff options
| author | Morph <39850852+Morph1984@users.noreply.github.com> | 2023-06-13 00:32:16 -0400 |
|---|---|---|
| committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2023-06-13 00:59:42 -0400 |
| commit | 925586f97bb4a2f13b602d145cdd3aa00c7177fa (patch) | |
| tree | a7bb918bf3dd173a571cb65ed3783c7d45d4be68 /src/video_core/renderer_opengl | |
| parent | e2f61992257a0601bc98261d8fea96f0349b9a13 (diff) | |
buffer_cache_base: Specify buffer type in HostBindings
Avoid reinterpret-casting from void pointer since the type is already known at compile time.
Diffstat (limited to 'src/video_core/renderer_opengl')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_buffer_cache.cpp | 19 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_buffer_cache.h | 6 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp index 0cc546a3a..38d553d3c 100644 --- 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<Buffer*>(bindings.buffers[index]), - static_cast<u32>(bindings.offsets[index]), static_cast<u32>(bindings.sizes[index]), - static_cast<u32>(bindings.strides[index])); +void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings) { + for (u32 index = 0; index < bindings.buffers.size(); ++index) { + BindVertexBuffer(bindings.min_index + index, *bindings.buffers[index], + static_cast<u32>(bindings.offsets[index]), + static_cast<u32>(bindings.sizes[index]), + static_cast<u32>(bindings.strides[index])); } } @@ -329,10 +329,9 @@ void BufferCacheRuntime::BindTransformFeedbackBuffer(u32 index, Buffer& buffer, static_cast<GLintptr>(offset), static_cast<GLsizeiptr>(size)); } -void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings) { - for (u32 index = 0; index < bindings.buffers.size(); index++) { - glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, index, - reinterpret_cast<Buffer*>(bindings.buffers[index])->Handle(), +void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings) { + for (u32 index = 0; index < bindings.buffers.size(); ++index) { + glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, index, bindings.buffers[index]->Handle(), static_cast<GLintptr>(bindings.offsets[index]), static_cast<GLsizeiptr>(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 e4e000284..41b746f3b 100644 --- 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<Buffer>& 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<Buffer>& bindings); void BindTextureBuffer(Buffer& buffer, u32 offset, u32 size, VideoCore::Surface::PixelFormat format); |
