mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Merge #187
187: Change dynamic and vertex buffer offsets to u64 r=cormac-obrien a=kvark This change makes offsets consistent across the board. cc @cormac-obrien Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::{BindGroupHandle, BindGroupId, BindGroupLayoutId, PipelineLayoutId, Stored};
|
||||
use crate::{BindGroupHandle, BindGroupId, BindGroupLayoutId, BufferAddress, PipelineLayoutId, Stored};
|
||||
|
||||
use log::trace;
|
||||
|
||||
@@ -50,7 +50,7 @@ impl BindGroupEntry {
|
||||
&mut self,
|
||||
bind_group_id: BindGroupId,
|
||||
bind_group: &BindGroupHandle,
|
||||
offsets: &[u32],
|
||||
offsets: &[BufferAddress],
|
||||
) -> Provision {
|
||||
let was_compatible = match self.provided {
|
||||
Some(BindGroupPair {
|
||||
@@ -140,7 +140,7 @@ impl Binder {
|
||||
index: usize,
|
||||
bind_group_id: BindGroupId,
|
||||
bind_group: &BindGroupHandle,
|
||||
offsets: &[u32],
|
||||
offsets: &[BufferAddress],
|
||||
) -> Option<(PipelineLayoutId, impl 'a + Iterator<Item = BindGroupId>)> {
|
||||
trace!("\tBinding [{}] = group {:?}", index, bind_group_id);
|
||||
match self.entries[index].provide(bind_group_id, bind_group, offsets) {
|
||||
|
||||
@@ -3,6 +3,7 @@ use crate::{
|
||||
hub::HUB,
|
||||
track::{Stitch, TrackerSet},
|
||||
BindGroupId,
|
||||
BufferAddress,
|
||||
CommandBuffer,
|
||||
CommandBufferId,
|
||||
ComputePassId,
|
||||
@@ -53,7 +54,7 @@ pub extern "C" fn wgpu_compute_pass_set_bind_group(
|
||||
pass_id: ComputePassId,
|
||||
index: u32,
|
||||
bind_group_id: BindGroupId,
|
||||
offsets_ptr: *const u32,
|
||||
offsets_ptr: *const BufferAddress,
|
||||
offsets_count: usize,
|
||||
) {
|
||||
let mut pass_guard = HUB.compute_passes.write();
|
||||
@@ -92,7 +93,7 @@ pub extern "C" fn wgpu_compute_pass_set_bind_group(
|
||||
&pipeline_layout_guard[pipeline_layout_id].raw,
|
||||
index as usize,
|
||||
bind_groups,
|
||||
offsets,
|
||||
offsets.iter().map(|&off| off as hal::command::DescriptorSetOffset),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -140,7 +140,7 @@ pub extern "C" fn wgpu_render_pass_set_bind_group(
|
||||
pass_id: RenderPassId,
|
||||
index: u32,
|
||||
bind_group_id: BindGroupId,
|
||||
offsets_ptr: *const u32,
|
||||
offsets_ptr: *const BufferAddress,
|
||||
offsets_count: usize,
|
||||
) {
|
||||
let mut pass_guard = HUB.render_passes.write();
|
||||
@@ -169,7 +169,7 @@ pub extern "C" fn wgpu_render_pass_set_bind_group(
|
||||
&&pipeline_layout_guard[pipeline_layout_id].raw,
|
||||
index as usize,
|
||||
bind_groups,
|
||||
offsets,
|
||||
offsets.iter().map(|&off| off as hal::command::DescriptorSetOffset),
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -225,7 +225,7 @@ pub extern "C" fn wgpu_render_pass_set_index_buffer(
|
||||
pub extern "C" fn wgpu_render_pass_set_vertex_buffers(
|
||||
pass_id: RenderPassId,
|
||||
buffer_ptr: *const BufferId,
|
||||
offset_ptr: *const u32,
|
||||
offset_ptr: *const BufferAddress,
|
||||
count: usize,
|
||||
) {
|
||||
let mut pass_guard = HUB.render_passes.write();
|
||||
@@ -244,7 +244,7 @@ pub extern "C" fn wgpu_render_pass_set_vertex_buffers(
|
||||
let buffers = buffers
|
||||
.iter()
|
||||
.map(|&id| &buffer_guard[id].raw)
|
||||
.zip(offsets.iter().map(|&off| off as u64));
|
||||
.zip(offsets.iter().cloned());
|
||||
|
||||
unsafe {
|
||||
pass.raw.bind_vertex_buffers(0, buffers);
|
||||
|
||||
Reference in New Issue
Block a user