Commit Graph
8897 Commits
Author SHA1 Message Date
Svenn-Arne Dragly f76b41420e [rs] Add conversion matrix from OpenGL to wgpu
The matrices in the examples are given in an OpenGL-like coordinate system,
while a Vulkan-like coordinate system is used by wgpu. This was previously
partially corrected in the shader and by flipping the up axis of the camera,
but left the x-axis mirrored in the final result.

This change adds a conversion matrix to framework.rs that can be used
to convert from OpenGL to wgpu. This also allows us to set the
winding-order to counter-clockwise, which matches the ordering in the data.
2019-07-05 17:47:37 +02:00
bors[bot]andDzmitry Malyshau 183058d618 Merge #237
237: Enforce the HUB lock order r=grovesNL a=kvark

Fixes #66
cc @jrmuizel @m4b

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-07-05 03:27:11 +00:00
Dzmitry Malyshau 1ed15f94dc Add some more comments about Access and Token' 2019-07-04 23:02:22 -04:00
bors[bot]andJohn W. Bruce a63bca6822 Merge #223
223: Derive Debug for All Remaining Public Types r=kvark a=arashikou

With gfx-hal 0.2.1 and the various backend releases on 2019-06-28, all of the gfx-hal types that wgpu depends on implement `Debug`. Thus, some types that could not derive `Debug` in #216 can now derive `Debug`.

This patch also adds `Debug` implementations for a few types that were recently added to wgpu.

Fixes #76.

Co-authored-by: John W. Bruce <arashikou@gmail.com>
2019-07-05 02:45:04 +00:00
John W. Bruce 25834b0312 Derive Debug for All Remaining Types
With gfx-hal 0.2.1 and the various backend releases on 2019-06-28, all
of the gfx-hal types that wgpu depends on implement Debug. Thus, some
types that could not derive Debug in #216 can now derive Debug.

This patch also adds Debug implementations for a few types that were
recently added to wgpu.

Fixes #76.
2019-07-04 17:49:21 -07:00
Dzmitry Malyshau 6085dcf33b Enforce the HUB lock order 2019-07-04 14:43:54 -04:00
bors[bot]andDzmitry Malyshau 8af0fa824b Merge #244
244: Fix bind groups set on a compute encoder r=kvark a=kvark

Fixes #243

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-07-03 14:23:42 +00:00
bors[bot]andAndrew Gaspar 662f9567d7 Merge #242
242: Add logic to pick highest performance GPU on DirectX 12 r=kvark a=AndrewGaspar

I was having an issue on my Surface Book where my Intel's integrated GPU is always selected instead of my Nvidia discrete GPU when querying for `HighPerformance`. It turns out the Intel GPU is reported as a `DistcreteGPU` by `gfx` (in fact `gfx` has no logic for reporting `IntegratedGPU`s for DX12). However, it also turns out that `dx12::Instance::enumerate_adapters` returns adapters in descending order of performance, at least on Windows 10 > 1803. Therefore, we should use the _first_ GPU in each category, at least for `HighPerformance`. With this fix, `LowPower` selects my Intel GPU and `HighPerformance` and `Default` select my Nvidia GPU.

I'm not so sure `LowPower` = `IntegratedGPU` and `HighPerformance` = `DiscreteGPU` is the quite correct mapping, so I filed an issue on gfx to improve the ability for querying for power/performance preference: https://github.com/gfx-rs/gfx/issues/2879

Anyway, let me know if you have a different fix you'd prefer.

Co-authored-by: Andrew Gaspar <andrew.gaspar@outlook.com>
2019-07-02 17:16:19 +00:00
Dzmitry Malyshau 14d0a24f81 Fix bind groups set on a compute encoder 2019-07-02 13:11:02 -04:00
Andrew Gaspar b47f01ea17 Address code review comments 2019-07-01 21:13:26 -06:00
Andrew Gaspar 0d555fb688 Add logic to pick highest performance GPU on DirectX 12
Always select the first GPU in Integrated-Low/Discrete-High category,
except when querying `LowPower`, in which case the last Discrete GPU
is used.
2019-06-29 16:50:41 -06:00
bors[bot]andPaul Kernfeld a70eab2e3b [rs] Merge #30
30: Add Pod trait bound for all BufferMapAsyncResult data r=kvark a=paulkernfeld



Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
2019-06-24 14:59:18 +00:00
bors[bot]andRukai 4e33716df3 [rs] Merge #28
28: msaa-line example fixes r=kvark a=rukai

This PR fixes the msaa-line example in addition to the fixes in https://github.com/gfx-rs/wgpu/pull/235

If https://github.com/gfx-rs/gfx/pull/2853 is merged first we can remove the crates.io patch.

Co-authored-by: Rukai <rubickent@gmail.com>
2019-06-24 14:34:19 +00:00
Rukai 4e9aa5b2d3 [rs] msaa-line example fixes 2019-06-24 21:59:42 +10:00
Paul Kernfeld d93bc7b362 [rs] Add Pod trait bound for all BufferMapAsyncResult data 2019-06-23 20:55:30 -04:00
bors[bot]andPaul Kernfeld dbef9f397e Merge #236
236: Re-export Pod from gfx-hal r=kvark a=paulkernfeld

This way, Pod can be used as a trait bound in wgpu-rs

Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
2019-06-23 23:25:34 +00:00
Paul Kernfeld ccc0e65b03 Re-export Pod from gfx-hal
This way, Pod can be used as a trait bound in wgpu-rs
2019-06-23 19:10:03 -04:00
bors[bot]andRukai f8df8d4032 Merge #235
235: Full MSAA handling r=kvark a=rukai

These changes fix the msaa-line wgpu example, along with a PR to wgpu-native https://github.com/gfx-rs/wgpu-rs/pull/28

Concerns:
*   webgpu does not expose a way for users to query limits, how are they supposed to choose a suitable sample_count?
*   I think `attachment_unused` should be moved into gfx-hal. Where abouts?
*   Is a sample mask of `:u64 = !0` suitable?

Co-authored-by: Rukai <rubickent@gmail.com>
2019-06-23 21:31:20 +00:00
Rukai 194943c12c Full MSAA handling 2019-06-23 22:17:42 +10:00
bors[bot]andRukai 2dd0b43e7e [rs] Merge #26
26: Rename msaa-linelist to msaa-line r=kvark a=rukai

As requested on gitter by @kvark 

Co-authored-by: Rukai <rubickent@gmail.com>
2019-06-20 17:31:06 +00:00
Rukai 453fca1a06 [rs] Rename msaa-linelist to msaa-line 2019-06-20 16:20:01 +10:00
bors[bot]andRukai 507d6a0714 [rs] Merge #25
25: Add MSAA example r=kvark a=rukai

This example is the same as the triangle example except:
*    The render pipeline is created with a sample_count of 4
*    A new texture with a sample_count of 4 is created and set as the color_attachment instead of the swapchain
*    The swapchain is now specified as a resolve_target

It doesn't work yet as wgpu-native doesn't handle MSAA yet.

Co-authored-by: Rukai <rubickent@gmail.com>
2019-06-20 03:51:14 +00:00
Rukai 051be88729 [rs] Add MSAA + LineList example 2019-06-20 12:06:57 +10:00
bors[bot]andRukai c8deae32bd Merge #230
230: Implement sample_count field r=kvark a=rukai

I'm trying to get MSAA working for brawllib renderer.

This PR allows for more ways to hit validation errors.
Giving a valid but mismatching sample count results in these validation errors.
```
ERROR gfx_backend_vulkan 
VALIDATION [VUID-vkCmdCopyImageToBuffer-srcImage-00188 (0)] : vkCmdCopyImageToBuffer(): srcImage for image 0xe030 was created with a sample count of VK_SAMPLE_COUNT_4_BIT but must be VK_SAMPLE_COUNT_1_BIT. The Vulkan spec states: srcImage must have a sample count equal to VK_SAMPLE_COUNT_1_BIT (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkCmdCopyImageToBuffer-srcImage-00188)
object info: (type: IMAGE, hndl: 57392)

ERROR gfx_backend_vulkan 
VALIDATION [UNASSIGNED-CoreValidation-DrawState-NumSamplesMismatch (0)] : Num samples mismatch! At draw-time in Pipeline (0x7) with 1 samples while current RenderPass (0xe) w/ 4 samples!
object info: (type: PIPELINE, hndl: 7)

ERROR gfx_backend_vulkan 
VALIDATION [VUID-vkCmdDrawIndexed-renderPass-02684 (0)] : vkCmdDrawIndexed(): RenderPasses incompatible between active render pass w/ renderPass 0xe and pipeline state object w/ renderPass 0x6 Attachment 0 is not compatible with 0: They have different samples.. The Vulkan spec states: The current render pass must be compatible with the renderPass member of the VkGraphicsPipelineCreateInfo structure specified when creating the VkPipeline bound to VK_PIPELINE_BIND_POINT_GRAPHICS. (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkCmdDrawIndexed-renderPass-02684)
object info: (type: RENDER_PASS, hndl: 14)
```

Co-authored-by: Rukai <rubickent@gmail.com>
2019-06-18 05:44:45 +00:00
Rukai 45923755ba Implement sample_count field 2019-06-18 11:55:03 +10:00
bors[bot]andDzmitry Malyshau 77e5f6ed25 [rs] Merge #23
23: Mipmapping example r=grovesNL a=kvark

Depends on https://github.com/gfx-rs/wgpu/pull/226

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-06-18 00:18:47 +00:00
bors[bot]andRukai 9705ceb2e7 Merge #224
224: Fix descriptor sets free validation error r=kvark a=rukai

Seeing as kvark believes this change to be correct I've opened this PR.
Still doesnt fix https://github.com/gfx-rs/wgpu/issues/221 though

Co-authored-by: Rukai <rubickent@gmail.com>
2019-06-17 13:45:22 +00:00
Rukai 15488dfa1e Fix descriptor sets free validation error 2019-06-17 21:01:56 +10:00
Dzmitry Malyshau 14f98aa627 [rs] Mipmap screenshot 2019-06-16 21:15:22 -07:00
Dzmitry Malyshau f2cd0348dc [rs] Mipmap example shader and code fixes 2019-06-16 21:15:16 -07:00
Dzmitry Malyshau 2b047f996b [rs] Mipmapping example 2019-06-16 21:15:15 -07:00
bors[bot]andDzmitry Malyshau a667d50d01 Merge #226
226: Tracking Rewrite r=grovesNL a=kvark

Fixes #44

The idea is to support independent tracking of sub-resources. Today, this is needed for textures, which can have individual layers and mipmap levels in different states at a time. Tomorrow, this will be needed for buffer sub-ranges.

The intent to hack it in grew into a complete rewrite of the tracker... The new approach is cleaner in a few places (e.g. `TrackPermit` is gone), but the implementation is obviously more complex. I tried to separate the levels from each other (see `ResourceState` and `RangedStates`) to fight complexity, but it requires a whole lot of testing infrastructure to be solid.

Also regresses #216 a bit, cc @arashikou : tracker is a relatively complex structure. I somehow doubt it's useful to look at it in debug spew. We may need to implement `Debug` manually for it before re-adding `Debug` derives on passes and command buffers.

TODO:
  - [x] documentation of tracking types
  - [x] unit tests for tracking logic
  - [x] actual testing with existing apps, ensure no regressions
  - [x] write a mipmap generation example

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-06-16 14:53:26 +00:00
Dzmitry Malyshau 3753309b65 Last comments and renames in the tracking module, according to the review 2019-06-16 07:25:30 -07:00
bors[bot]andRukai 6b655f52be Merge #229
229: Update rendy to 0.3 r=kvark a=rukai



Co-authored-by: Rukai <rubickent@gmail.com>
2019-06-16 14:18:40 +00:00
Rukai 21950386cb Update rendy to 0.3 2019-06-16 12:31:07 +10:00
Dzmitry Malyshau 57494d6394 Crucial fix to merge-replace semantics - always use the last destination state 2019-06-14 14:05:27 -04:00
Dzmitry Malyshau 917154a49d Debug tracking derives and regular optimization 2019-06-14 14:05:27 -04:00
Dzmitry Malyshau c22d8f86cc Support depth-stencil texture transfers 2019-06-14 11:47:42 -04:00
Dzmitry Malyshau 3ed1215d2f Rewrite texture tracker to support multiple depth/stencil mips 2019-06-14 11:44:51 -04:00
Dzmitry Malyshau 3da6c9f65b Fix texture view extent, improve docs according to the review 2019-06-14 10:20:13 -04:00
Dzmitry Malyshau 7c647a7d3c Improve texture state merging 2019-06-14 10:20:13 -04:00
Dzmitry Malyshau ef1c373887 Fix texture transfer aspects 2019-06-13 15:37:30 -04:00
Dzmitry Malyshau 965750b237 Improve texture state merging with proper error handling 2019-06-13 13:06:31 -04:00
Dzmitry Malyshau 86521abfc2 Document the tracking and adjust the API a bit to return less errors 2019-06-13 12:31:36 -04:00
Dzmitry Malyshau e0f315801a Texture query() unit tests 2019-06-13 11:47:42 -04:00
Dzmitry Malyshau 0fb71c9fd8 Move texture tracking into a module 2019-06-13 11:30:47 -04:00
Dzmitry Malyshau aca3f1e64d Fix compile warnings when no features are selected 2019-06-13 11:26:44 -04:00
Dzmitry Malyshau 745bebcbb5 Move buffer state tracking into a module, add unit tests 2019-06-13 11:22:54 -04:00
Dzmitry Malyshau 07ef7caddc Range merging unit tests 2019-06-13 11:08:53 -04:00
Dzmitry Malyshau 331fe55948 Check track isolation results for sanity 2019-06-13 10:20:21 -04:00