Giter Site home page Giter Site logo

Comments (5)

teoxoy avatar teoxoy commented on September 10, 2024 1

268435456 is the default limit, you need to explicitly request higher limits via required_limits when you create the device.

from wgpu.

teoxoy avatar teoxoy commented on September 10, 2024

I think that would resolve gfx-rs/wgpu-native#408 as well?

from wgpu.

rcoreilly avatar rcoreilly commented on September 10, 2024

@teoxoy I'll check that out and close the issue if so.

Meanwhile, now that I'm actually requesting larger buffers, it is actually failing to run (after successfully giving me the device), with a "Validation Error" :( I'll try to replicate on the latest compute example in wgpu_native and see how that goes.

from wgpu.

rcoreilly avatar rcoreilly commented on September 10, 2024

I have verified that it appears to be working correctly in the latest wgpu_native compute example. We'll have to update our version to the latest and hopefully that fixes the issue.

Also note the question in the code comments below about how to set the RequiredLimits to all defaults except ones you specifically set -- I could not find that exposed in the C interface?

  WGPUSupportedLimits sup;
  wgpuAdapterGetLimits(adapter, &sup);

  WGPULimits limits; // note: I could not find a call that sets all fields to the default "undefined" value: 0xffffffff
  // so I had to just use all the supported limits.  we have this DefaultLimits() function in our Go wrapper,
  // and I found this method in rust: https://docs.rs/wgpu/latest/wgpu/struct.Limits.html -- but nothing in the .h file.
  // how is anyone supposed to just specify a few limits to override in their requested limits??
  WGPURequiredLimits req;
  req.limits = sup.limits;
  req.limits.maxStorageBufferBindingSize = 0x1FFFFFFF; //  note: it doesn't seem to care about this
  req.limits.maxBufferSize = 0x1FFFFFFF; // this is the only one that mattered, relative to bufSize below.
  WGPUDeviceDescriptor desc;
  desc.requiredLimits = &req;
 
  WGPUDevice device = NULL;
  wgpuAdapterRequestDevice(adapter, &desc, handle_request_device,
                           (void *)&device);
  assert(device);

  WGPUQueue queue = wgpuDeviceGetQueue(device);
  assert(queue);

  WGPUShaderModule shader_module =
      frmwrk_load_shader_module(device, "shader.wgsl");
  assert(shader_module);

  WGPUBuffer staging_buffer = wgpuDeviceCreateBuffer(
      device, &(const WGPUBufferDescriptor){
                  .label = "staging_buffer",
                  .usage = WGPUBufferUsage_MapRead | WGPUBufferUsage_CopyDst,
                  .size = numbers_size,
                  .mappedAtCreation = false,
              });
  assert(staging_buffer);

  uint32_t bufSize = 0xFFFFFFFF; // this fails if > size specified above, works if <

  WGPUBuffer storage_buffer = wgpuDeviceCreateBuffer(
      device, &(const WGPUBufferDescriptor){
                  .label = "storage_buffer",
                  .usage = WGPUBufferUsage_Storage | WGPUBufferUsage_CopyDst |
                           WGPUBufferUsage_CopySrc,
                  .size = bufSize,
                  .mappedAtCreation = false,
              });
  assert(storage_buffer);

from wgpu.

teoxoy avatar teoxoy commented on September 10, 2024

I would open an issue at https://github.com/webgpu-native/webgpu-headers.

from wgpu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.