Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support precompiled shaders #2280

Closed
kvark opened this issue Dec 11, 2021 · 2 comments
Closed

Support precompiled shaders #2280

kvark opened this issue Dec 11, 2021 · 2 comments
Labels
area: api Issues related to API surface area: ecosystem Help the connected projects grow and prosper help required We need community help to make this happen. type: enhancement New feature or request

Comments

@kvark
Copy link
Member

kvark commented Dec 11, 2021

Is your feature request related to a problem? Please describe.
Related to gfx-rs/gfx#3117
Requested by @raphlinus for piet
Also in #2278

Generally, we believe wgpu needs to be responsible for the full tech stack, including shader translation.
This is needed for many reasons, some of which are:

  • end product is an implementation detail
  • it depends on pipeline layout, pipeline states, driver bug workarounds, etc
  • only way to make it safe

However, in some cases, it's really good to be able to skip the translation step. For example, when targeting a very specific platform with known pipeline layouts and states. Like a console, or a WebGL2 target.

Describe the solution you'd like

unsafe fn create_shader_module_from_raw()

Describe alternatives you've considered
Keeping it private.

Additional context

@kvark kvark added type: enhancement New feature or request help required We need community help to make this happen. area: api Issues related to API surface area: ecosystem Help the connected projects grow and prosper labels Dec 11, 2021
@Wandalen
Copy link

There are too many things at the top of the list related to naga.
Not enough for rigorous proof of my assumption, but enough to claim it's very likely that Naga is a major contributor to the size of the web binary.

> twiggy top -n 30 input.wasm

 Shallow Bytes │ Shallow % │ Item
───────────────┼───────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
        303391 ┊    15.27% ┊ "function names" subsection
        200769 ┊    10.11% ┊ data[0]
         38903 ┊     1.96% ┊ naga::front::wgsl::Parser::parse_function_call_inner::h0936716646aba678
         23773 ┊     1.20% ┊ naga::front::wgsl::Parser::parse_statement::heed965287d7d609b
         21478 ┊     1.08% ┊ wgpu_core::command::render::<impl wgpu_core::hub::Global<G>>::command_encoder_run_render_pass_impl::h9605c202f99e941e
         20682 ┊     1.04% ┊ naga::front::wgsl::Parser::parse::h6e07072bcb57d1f6
         17823 ┊     0.90% ┊ naga::valid::expression::<impl naga::valid::Validator>::validate_expression::ha5ca28a871c281ff
         16909 ┊     0.85% ┊ naga::back::glsl::Writer<W>::write_expr::hfb26caef53b8934b
         14455 ┊     0.73% ┊ wgpu_core::device::queue::<impl wgpu_core::hub::Global<G>>::queue_submit::h61a4e027583d6d2d
         14171 ┊     0.71% ┊ naga::front::wgsl::Error::as_parse_error::h84f087ad4a215083
         13979 ┊     0.70% ┊ <wgpu_core::hub::Global<G> as core::ops::drop::Drop>::drop::hf479ec36e7222384
         13951 ┊     0.70% ┊ <wgpu_core::hub::Global<G> as core::ops::drop::Drop>::drop::h939417fcbf6c7f59
         12711 ┊     0.64% ┊ naga::back::glsl::Writer<W>::write_stmt::h9f47d80fbefadae6
         11654 ┊     0.59% ┊ naga::proc::typifier::ResolveContext::resolve::h39ddfec451c24e66
         11507 ┊     0.58% ┊ naga::proc::typifier::ResolveContext::resolve::hbfbe85bde9e415c4
         11027 ┊     0.56% ┊ naga::front::wgsl::Parser::parse_unary_expression::h8bc9730cfde25793
         10060 ┊     0.51% ┊ naga::front::wgsl::Parser::parse_type_decl_impl::hfa67146cccd620b7
          9375 ┊     0.47% ┊ naga::valid::Validator::validate::hffd62bc7d976bdb8
          8981 ┊     0.45% ┊ wgpu_core::device::life::LifetimeTracker<A>::triage_suspected::h9db1ff08ca10c1b3
          8235 ┊     0.41% ┊ naga::valid::function::<impl naga::valid::Validator>::validate_block_impl::h4730107b472d0835
          7994 ┊     0.40% ┊ codespan_reporting::term::renderer::Renderer::render_snippet_source::h16a5df15060ec533
          7862 ┊     0.40% ┊ wgpu_core::device::Device<A>::create_render_pipeline::h76b413737ebad1c8
          7630 ┊     0.38% ┊ wgpu_hal::gles::queue::<impl wgpu_hal::Queue<wgpu_hal::gles::Api> for wgpu_hal::gles::Queue>::submit::h4ae4840d4e08d149
          7496 ┊     0.38% ┊ codespan_reporting::term::views::RichDiagnostic<FileId>::render::hb25fec69a1bf5c44
          6780 ┊     0.34% ┊ wgpu_hal::gles::adapter::<impl wgpu_hal::gles::Adapter>::expose::h9a68520745fef021
          6686 ┊     0.34% ┊ wgpu_hal::gles::device::<impl wgpu_hal::Device<wgpu_hal::gles::Api> for wgpu_hal::gles::Device>::create_render_pipeline::h32bbd42f6b98a22c
          6648 ┊     0.33% ┊ naga::back::glsl::Writer<W>::write::he6e8effb5e8693cf
          6489 ┊     0.33% ┊ core::num::flt2dec::strategy::dragon::format_shortest::h6d64f97815ec3dae
          5904 ┊     0.30% ┊ wgpu_core::validation::Interface::check_stage::hbd6bb57505e1ff1f
          5898 ┊     0.30% ┊ naga::valid::analyzer::FunctionInfo::process_block::h5ed5585dff68dd7b
       1133311 ┊    57.05% ┊ ... and 3835 more.
       1986532 ┊   100.00% ┊ Σ [3865 Total Rows]

@cwfitzgerald
Copy link
Member

Superceded by #3103

@cwfitzgerald cwfitzgerald closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API surface area: ecosystem Help the connected projects grow and prosper help required We need community help to make this happen. type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants