Skip to content

Commit b71db0b

Browse files
author
Andrew Wheeler(Genusis)
authored
Merge pull request hecrj#3 from pimlu/query
Make queue reference immutable in draw API
2 parents c82ee04 + 0506b88 commit b71db0b

File tree

6 files changed

+23
-21
lines changed

6 files changed

+23
-21
lines changed

examples/clipping.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn main() -> Result<(), Box<dyn Error>> {
1616
let surface = unsafe { instance.create_surface(&window) };
1717

1818
// Initialize GPU
19-
let (device, mut queue) = futures::executor::block_on(async {
19+
let (device, queue) = futures::executor::block_on(async {
2020
let adapter = instance
2121
.request_adapter(&wgpu::RequestAdapterOptions {
2222
power_preference: wgpu::PowerPreference::HighPerformance,
@@ -136,7 +136,7 @@ fn main() -> Result<(), Box<dyn Error>> {
136136
glyph_brush
137137
.draw_queued(
138138
&device,
139-
&mut queue,
139+
&queue,
140140
&mut encoder,
141141
view,
142142
size.width,
@@ -157,7 +157,7 @@ fn main() -> Result<(), Box<dyn Error>> {
157157
glyph_brush
158158
.draw_queued_with_transform_and_scissoring(
159159
&device,
160-
&mut queue,
160+
&queue,
161161
&mut encoder,
162162
view,
163163
wgpu_glyph::orthographic_projection(

examples/depth.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main() -> Result<(), Box<dyn Error>> {
1818
let surface = unsafe { instance.create_surface(&window) };
1919

2020
// Initialize GPU
21-
let (device, mut queue) = futures::executor::block_on(async {
21+
let (device, queue) = futures::executor::block_on(async {
2222
let adapter = instance
2323
.request_adapter(&wgpu::RequestAdapterOptions {
2424
power_preference: wgpu::PowerPreference::HighPerformance,
@@ -151,7 +151,7 @@ fn main() -> Result<(), Box<dyn Error>> {
151151
glyph_brush
152152
.draw_queued(
153153
&device,
154-
&mut queue,
154+
&queue,
155155
&mut encoder,
156156
view,
157157
wgpu::RenderPassDepthStencilAttachment {

examples/hello.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn main() -> Result<(), Box<dyn Error>> {
1616
let surface = unsafe { instance.create_surface(&window) };
1717

1818
// Initialize GPU
19-
let (device, mut queue) = futures::executor::block_on(async {
19+
let (device, queue) = futures::executor::block_on(async {
2020
let adapter = instance
2121
.request_adapter(&wgpu::RequestAdapterOptions {
2222
power_preference: wgpu::PowerPreference::HighPerformance,
@@ -145,7 +145,7 @@ fn main() -> Result<(), Box<dyn Error>> {
145145
glyph_brush
146146
.draw_queued(
147147
&device,
148-
&mut queue,
148+
&queue,
149149
&mut encoder,
150150
view,
151151
size.width,

src/lib.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ where
140140
fn process_queued(
141141
&mut self,
142142
device: &wgpu::Device,
143-
queue: &mut wgpu::Queue,
143+
queue: &wgpu::Queue,
144144
region: Option<Region>,
145145
) {
146146
let pipeline = &mut self.pipeline;
@@ -238,7 +238,7 @@ impl<F: Font + Sync, H: BuildHasher> GlyphBrush<(), F, H> {
238238
pub fn draw_queued(
239239
&mut self,
240240
device: &wgpu::Device,
241-
queue: &mut wgpu::Queue,
241+
queue: &wgpu::Queue,
242242
encoder: &mut wgpu::CommandEncoder,
243243
target: &wgpu::TextureView,
244244
target_width: u32,
@@ -268,7 +268,7 @@ impl<F: Font + Sync, H: BuildHasher> GlyphBrush<(), F, H> {
268268
pub fn draw_queued_with_transform(
269269
&mut self,
270270
device: &wgpu::Device,
271-
queue: &mut wgpu::Queue,
271+
queue: &wgpu::Queue,
272272
encoder: &mut wgpu::CommandEncoder,
273273
target: &wgpu::TextureView,
274274
transform: [f32; 16],
@@ -294,7 +294,7 @@ impl<F: Font + Sync, H: BuildHasher> GlyphBrush<(), F, H> {
294294
pub fn draw_queued_with_transform_and_scissoring(
295295
&mut self,
296296
device: &wgpu::Device,
297-
queue: &mut wgpu::Queue,
297+
queue: &wgpu::Queue,
298298
encoder: &mut wgpu::CommandEncoder,
299299
target: &wgpu::TextureView,
300300
transform: [f32; 16],
@@ -344,7 +344,7 @@ impl<F: Font + Sync, H: BuildHasher> GlyphBrush<wgpu::DepthStencilState, F, H> {
344344
pub fn draw_queued(
345345
&mut self,
346346
device: &wgpu::Device,
347-
queue: &mut wgpu::Queue,
347+
queue: &wgpu::Queue,
348348
encoder: &mut wgpu::CommandEncoder,
349349
target: &wgpu::TextureView,
350350
depth_stencil_attachment: wgpu::RenderPassDepthStencilAttachment,
@@ -376,7 +376,7 @@ impl<F: Font + Sync, H: BuildHasher> GlyphBrush<wgpu::DepthStencilState, F, H> {
376376
pub fn draw_queued_with_transform(
377377
&mut self,
378378
device: &wgpu::Device,
379-
queue: &mut wgpu::Queue,
379+
queue: &wgpu::Queue,
380380
encoder: &mut wgpu::CommandEncoder,
381381
target: &wgpu::TextureView,
382382
depth_stencil_attachment: wgpu::RenderPassDepthStencilAttachment,
@@ -409,7 +409,7 @@ impl<F: Font + Sync, H: BuildHasher> GlyphBrush<wgpu::DepthStencilState, F, H> {
409409
pub fn draw_queued_with_transform_and_scissoring(
410410
&mut self,
411411
device: &wgpu::Device,
412-
queue: &mut wgpu::Queue,
412+
queue: &wgpu::Queue,
413413
encoder: &mut wgpu::CommandEncoder,
414414
target: &wgpu::TextureView,
415415
depth_stencil_attachment: wgpu::RenderPassDepthStencilAttachment,

src/pipeline.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl Pipeline<()> {
4242

4343
pub fn draw(
4444
&mut self,
45-
queue: &mut wgpu::Queue,
45+
queue: &wgpu::Queue,
4646
encoder: &mut wgpu::CommandEncoder,
4747
target: &wgpu::TextureView,
4848
transform: [f32; 16],
@@ -72,7 +72,7 @@ impl Pipeline<wgpu::DepthStencilState> {
7272

7373
pub fn draw(
7474
&mut self,
75-
queue: &mut wgpu::Queue,
75+
queue: &wgpu::Queue,
7676
encoder: &mut wgpu::CommandEncoder,
7777
target: &wgpu::TextureView,
7878
depth_stencil_attachment: wgpu::RenderPassDepthStencilAttachment,
@@ -92,7 +92,7 @@ impl Pipeline<wgpu::DepthStencilState> {
9292
impl<Depth> Pipeline<Depth> {
9393
pub fn update_cache(
9494
&mut self,
95-
queue: &mut wgpu::Queue,
95+
queue: &wgpu::Queue,
9696
offset: [u16; 2],
9797
size: [u16; 2],
9898
data: &[u8],
@@ -120,7 +120,7 @@ impl<Depth> Pipeline<Depth> {
120120
pub fn upload(
121121
&mut self,
122122
device: &wgpu::Device,
123-
queue: &mut wgpu::Queue,
123+
queue: &wgpu::Queue,
124124
instances: &mut [Instance],
125125
region: Option<Region>,
126126
) {
@@ -215,7 +215,9 @@ fn build<D>(
215215
wgpu::BindGroupLayoutEntry {
216216
binding: 1,
217217
visibility: wgpu::ShaderStages::FRAGMENT,
218-
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
218+
ty: wgpu::BindingType::Sampler(
219+
wgpu::SamplerBindingType::Filtering,
220+
),
219221
count: None,
220222
},
221223
wgpu::BindGroupLayoutEntry {
@@ -330,7 +332,7 @@ fn build<D>(
330332

331333
fn draw<D>(
332334
pipeline: &mut Pipeline<D>,
333-
queue: &mut wgpu::Queue,
335+
queue: &wgpu::Queue,
334336
encoder: &mut wgpu::CommandEncoder,
335337
target: &wgpu::TextureView,
336338
depth_stencil_attachment: Option<wgpu::RenderPassDepthStencilAttachment>,

src/pipeline/cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl Cache {
2929

3030
pub fn update(
3131
&mut self,
32-
queue: &mut wgpu::Queue,
32+
queue: &wgpu::Queue,
3333
offset: [u16; 2],
3434
size: [u16; 2],
3535
data: &[u8],

0 commit comments

Comments
 (0)