Commit Graph
9013 Commits
Author SHA1 Message Date
Inseok Lee 8ce9ae9b25 Fix invalid Rgba16Float format on gles 2021-10-30 17:31:55 +09:00
Inseok Lee 5f1b3e56bc Unset existing vertex attributes on gles set_render_pipeline (#2131) 2021-10-29 23:46:04 -04:00
Igor Shaposhnik 9d2b357214 [glsl\wgsl out] Remove unnecessary clones (#1492)
* [glsl-out] Remove unnecessary clones

* [wgsl-out] Remove unnecessary clones
2021-10-28 13:54:32 -04:00
Wumpf 988716943f Zero init textures (#1688)
* Added tests for texture zero init
sadly, they are typically passing even if texture zero init isn't doing its job
However, they form nice isolated examples for testing out texture initialization
It could be possible to dirty texture memory prior to ensure zero init did the job

* texture init tracker

* tracking texture init requirements for bind group, transfer and rendertarget

* texture clears for texture init
* queue submit
* write_texture

* Enforce presence of either render target or copy_dst flag

* clear render targets also with using buffer copies
enforce COPY_DST usage now on all textures

* adjust ImageSubresourceRange.layer_range calculation for 3D textures

init_tracker has now a `discard` function to get single data points back to uninitialized

use new standardized partition_point function

* track init state for discarded textures from renderpasses

missing:
* init on the fly if discarded is found within command buffer
* handle discarding only stencil or only depth

* added tests for zero init after discard

* tracking discarded surfaces now in separate struct, piping all inits through utility function
allows to resolve discard/init_action interactions

* Move various memory init code to separate mod
CommandBufferTextureMemoryActions is now fully encapsulated

* implemented discard init fixups for everything but renderpass

* render passes also cause now discard fixups

* fixup_discarded_surfaces takes now an iterator instead of Drain

* Add memory init test for discarding depth targets

* handle divergently discarded depth/stencil target

* comment & clippy fixes

* fix collect_zero_buffer_copies_for_clear_texture yielding block breaking copies

* [pr feedback] minor cleanup in zero_init_texture_after_discard, `use` hygenie

* [pr feedback] fix bug in ImageSubresourceRange range utils

* [pr feedback] fix texture tracker check, bundle transition_texture on init, cleanups

* Implemented drop for InitTrackerDrain

* remove incorrect comment about extents in add_pass_texture_init_actions

* Fix unit test & clippy issues in init_tracker
2021-10-28 09:15:53 -04:00
xiaopengli89 cd9498d447 Add texture_from_raw method for metal/dx12 device 2021-10-28 09:14:15 -04:00
Igor Shaposhnik d1cfdd15a0 Add test for last falltrough switch case 2021-10-27 11:12:35 +01:00
João Capucho 0458f0a404 [valid] Check that the last switch case isn't falltrough (#1485) 2021-10-26 21:33:49 -04:00
Mariusz Kryński 8568188558 WebGL backend: memory-only staging buffers (#2112)
* webgl2 buffers

* use bitflags::intersects, linting

* address reviewer comments: s/RawBuffer/BufferInner/

* bugfixes

* cargo fmt

* cargo clippy

* cargo fmt again
2021-10-27 01:16:31 +00:00
Igor Shaposhnik 00bbbed90a Handle empty variable names in namer (#1484)
* Handle empty variable names in namer

* Add glsl-in test with empty global name
2021-10-26 17:46:27 -04:00
Dzmitry Malyshau 9e6af05e94 Bump uniform binding size to 64K 2021-10-26 17:19:14 -04:00
João Capucho 63dbd38edc Make default a switch case (#1477)
* Make default a switch case

Previously the default case of a switch statement was encoded as a block
in the statement but the wgsl spec defines it in such a way that the
default case ordering matters.

* [spv-out] Support for the new switch IR

* [dot-out] Use different labels for default cases
2021-10-26 13:31:54 -04:00
Jim Blandy 5cf11ab734 Make use of AddSpan and MapErrWithSpan conditional.
This avoids warnings in default-feature builds, like `cargo test -p naga`.
2021-10-25 19:35:59 +01:00
João Capucho 8c071ef122 [wgsl-in] Always flush expressions in function call (#1478) 2021-10-25 11:17:55 -07:00
João Capucho f8d3c4bc8e [wgsl-in] Add support for function call statements (#1476)
* [wgsl-in] Add support for function call statements

* Apply comments
2021-10-25 12:15:58 -04:00
Alex Es ec001c3ead Use span information in analyzer errors (proof of concept) (#1470)
* Proof-of-concept for adding spans to validation errors.

Still missing: actually printing the damn stuff.

* Emit errors from analyzer in the CLI.

TODO: tests, I guess!

* Simplification refactoring: avoid avoiding allocations so vehemently.

* Mask helper traits with `as _`.

* Fix block iterator throwing up when span feature is disabled.

* Nest use statements.

* Add basic docs.

* Axe AddSpanResult.
2021-10-24 22:47:03 -04:00
Dzmitry Malyshau fd5085277a Switch the constant in bevy-pbr to avoid display incosistencies 2021-10-23 23:39:49 -04:00
Dzmitry Malyshau a03f23c132 Allow new clippy::if_same_then_else 2021-10-23 23:39:49 -04:00
João Capucho 044fc1b742 [spv-in] Cast int comparisons arguments (#1471)
Operations like `OpUGreaterThan` accept arguments as long as they are integers
(signedness doesn't matter) but they must be interpreted as `Uint`s.
2021-10-23 23:22:31 -04:00
João Capucho c3a0d71f8b [spv-out] Write function arguments names (#1472) 2021-10-23 23:20:12 -04:00
Riccardo Zaglia d46c39af1d FIx raw Vulkan API 2021-10-22 21:53:20 -04:00
Dzmitry Malyshau 29282a3981 hal/egl: don't assume EGL-1.5 if upcast works (#2105) 2021-10-22 09:45:51 -04:00
Nicklas Warming JacobsenandNicklas Warming Jacobsen ea0c974bed webgl2: recreate surface texture in fn configure (#2067)
Currently the configure function reuses the surface texture if it
already exist, and will call Glow::Context::tex_storage_2d to
reconfigure the texture. However doing so on an already configured
texture will cause the browser warning:
WebGL warning: texStorage(Multisample)?: Specified texture is immutable.
and will NOT apply the new configuration such as new dimensions.

Co-authored-by: Nicklas Warming Jacobsen <nwj@skybox.gg>
2021-10-22 12:58:24 +00:00
Dzmitry Malyshau 3ec17cf9ed Fix smooth buffer barrier (#2104) 2021-10-21 22:11:41 -04:00
Dzmitry Malyshau 721875798f hal/gles: allow presenting with Android emulator (#2097) 2021-10-21 22:00:18 -04:00
Inseok Lee 82cf1972af GLES 3.0 fix (#2078) 2021-10-21 16:07:07 +00:00
Dzmitry Malyshau 003b83f6ac hal/mtl: disable fragment r/w buffers in fragment shaders on macOS 10.11 (#2102) 2021-10-21 11:53:57 -04:00
Xiaopeng Li a59a627f12 Fix memory leak on macOS (#2092)
* Fix memory RenderCommandEncoder, BlitCommandEncoder, label leak on macOS

* Don't wrap autoreleasepool when blit command encoder is already active

* Revert wrap set_label, instead focus on gfx-rs/metal-rs#218
2021-10-20 08:52:00 -04:00
João Capucho 70ad084ad4 [spv-in]: Cull unused builtins inside structs (#1469)
Some compilers like shaderc introduce a full gl_PerVertex struct, this
includes gl_ClipDistance. Normally this isn't a problem since most
drivers optimize it away, but naga zero inits globals if they weren't
previously initialized. This causes gl_ClipDistance to be initialized to
zero which can be really bad for performance.
2021-10-19 22:55:20 -04:00
Dzmitry Malyshau c4ab9a3956 hlsl: Fix mat3 stores (#1467) 2021-10-18 01:04:06 -04:00
KangarooCoder 417de103dd Correct bash env and sed command (#2066)
On MacOS Big Sur Version 11.6 the script fails because 1) it does #!/bin/env bash instead of #!/usr/bin/env bash and 2) the sed's -i option takes a file extension or "" which I have opted for the latter.  With these changes, the script now works as expected.
2021-10-18 03:17:14 +00:00
Wumpf 4af1c31edc init_tracker has now a discard function to get single data points back to uninitialized (#2081)
* init_tracker has now a `discard` function to get single data points back to uninitialized

use new standardized partition_point function

* allow unused InitTracker.discard function for time being
2021-10-16 18:09:04 +00:00
Jim Blandy ed4cc8e4d8 Use Cow to reduce allocation in proc::Namer. (#1465)
Minimize allocation in the namer. Heap-allocate string only when needed to
provide an owned key for a hash table, or to hold synthesized text. Try to reuse
allocations.

Many unnecessary trailing `_` characters are removed from test output. These
were all superfluous; separators are still inserted where necessary.
2021-10-16 17:56:59 +00:00
Jim Blandy 528f52fba0 [msl-out] Put serde(default) on the whole struct, not on each field. (#1463)
This has no effect, but makes the code more legible.
2021-10-16 10:55:31 -04:00
Dzmitry Malyshau f8ecebb43d hal/gles: properly check for buffer allocation 2021-10-16 10:45:35 -04:00
Dzmitry Malyshau d9df69ec29 hal/egl: request ALPHA_SIZE for srgb, move shaders into a folder 2021-10-15 15:02:49 -04:00
Dzmitry Malyshau 04b8ff2c9e Silence downlevel caps warning on secondary backends 2021-10-15 15:02:49 -04:00
Dzmitry Malyshau 41c595cfcf Hold BGL alive by BG (#2075) 2021-10-15 11:40:49 -04:00
Jim Blandy 62cc5fc646 [msl-out] Delete Writer::runtime_sized_buffers. (#1462)
This is just a table mapping handles to their indices, but we can just fetch the
index directly from the handle. We never iterate over its entries, but even if
we did, we could at least use a HashSet instead of a HashMap.
2021-10-15 00:44:28 -04:00
Dzmitry Malyshau ec8413dfcb Build fixes after a bad merge (#2071) 2021-10-14 19:24:30 -04:00
Dzmitry Malyshau 47fb0efb2c ETC2 texture format refactor (#2064) 2021-10-13 13:42:44 -04:00
Wumpf a28c52873f Move clear_texture impl from wgpu-hal to wgpu-core (#2046)
* new test for clearing textures of all formats

* clear_texture is now always implemented in wgpu-core instead of wgpu-hal

* add 1D/array/volume texture to clear_texture test

* set mip_level_count to 1 for D1 textures in clear_texture test

* fix warning & clippy lints

* Fix web build

* [pr feedback] fix potentially skipped resource transition, fix wrong mip size for texture clear

* collect_zero_buffer_copies_for_clear_texture aligns rows now properly
2021-10-13 13:42:13 -04:00
Yuya Kanai 42de30ad13 Fix issue with limits for hello-triangle (#2062)
* Update main.rs

* Add using_resolution to hello-triangle limits

* Fix format for hello-triangle
2021-10-13 13:31:38 +00:00
Dzmitry Malyshau 4cb91f2c98 cli: option to keep coordinate space unchanged (#1460) 2021-10-13 08:21:29 -04:00
Andrew Wheeler(Genusis) 1759722b69 Added GLSL to ShaderSource behind Feature lock (#2055)
* Added GLSL to ShaderSource behind Feature lock

* Used full path for Naga's FastHashMap and ShaderStage rather than add them as a pub include

* changed spirv and glsl web feature to web-shader-translation. Now requires glsl or spirv to be choosen along with the web-shader-translation to unlock their usage

* Changed the Description of the Glsl enum

* Added README update

* Made With with

* added catch all that panics if web-shader-translation is not enabled with spirv or glsl

* added Compiler condition to prevent the catch all unless glsl or spirv exists without web-shader-translation

* We decided to use [target.'cfg(target_arch = wasm32)'.dependencies.naga] within cargo to include wgsl-out in the Web backend unconditionally, which removed the need for a panic

* Removed wasm targets section from readme as it is no longer needed

* Named Glsl fields to make them more understandable as to what they are for

* Fixed the enum usage for GLSL and Added documentation for the fields
2021-10-12 19:20:45 +00:00
Dzmitry Malyshau 5441556988 Release wgpu-hal-0.11.2 2021-10-12 12:22:49 -04:00
Dzmitry Malyshau c5244c9ffc hal/dx12: fix cube array views 2021-10-12 12:22:49 -04:00
Dzmitry Malyshau 3b49981111 Bump version to 0.7.1 naga-v0.7.1 2021-10-12 11:44:13 -04:00
Dzmitry Malyshau ee450c1ee4 Fix float-bool casts in MSL, SPV, and HLSL backends (#1459) 2021-10-12 11:42:20 -04:00
Dzmitry Malyshau 2c9a7dfc2a hal/gl: fix vertex buffers with non-zero first instance 2021-10-12 10:00:34 -04:00
dwbrite 06118be1b1 Docs: add structure for indirect dispatch args 2021-10-12 09:02:23 -04:00