buffer_cache_base: Specify buffer type in HostBindings
Avoid reinterpret-casting from void pointer since the type is already known at compile time.
This commit is contained in:
parent
e2f6199225
commit
925586f97b
6 changed files with 35 additions and 37 deletions
|
@ -715,7 +715,7 @@ void BufferCache<P>::BindHostIndexBuffer() {
|
|||
|
||||
template <class P>
|
||||
void BufferCache<P>::BindHostVertexBuffers() {
|
||||
HostBindings host_bindings;
|
||||
HostBindings<typename P::Buffer> 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<P>::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<void*>(&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<P>::BindHostTransformFeedbackBuffers() {
|
|||
if (maxwell3d->regs.transform_feedback_enabled == 0) {
|
||||
return;
|
||||
}
|
||||
HostBindings host_bindings;
|
||||
HostBindings<typename P::Buffer> 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<P>::BindHostTransformFeedbackBuffers() {
|
|||
SynchronizeBuffer(buffer, binding.cpu_addr, size);
|
||||
|
||||
const u32 offset = buffer.Offset(binding.cpu_addr);
|
||||
host_bindings.buffers.push_back(reinterpret_cast<void*>(&buffer));
|
||||
host_bindings.buffers.push_back(&buffer);
|
||||
host_bindings.offsets.push_back(offset);
|
||||
host_bindings.sizes.push_back(binding.size);
|
||||
}
|
||||
|
|
|
@ -105,8 +105,9 @@ static constexpr Binding NULL_BINDING{
|
|||
.buffer_id = NULL_BUFFER_ID,
|
||||
};
|
||||
|
||||
template <typename Buffer>
|
||||
struct HostBindings {
|
||||
boost::container::small_vector<void*, NUM_VERTEX_BUFFERS> buffers;
|
||||
boost::container::small_vector<Buffer*, NUM_VERTEX_BUFFERS> buffers;
|
||||
boost::container::small_vector<u64, NUM_VERTEX_BUFFERS> offsets;
|
||||
boost::container::small_vector<u64, NUM_VERTEX_BUFFERS> sizes;
|
||||
boost::container::small_vector<u64, NUM_VERTEX_BUFFERS> strides;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue