• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

shader-slang / slang-rhi / 14525294141

17 Apr 2025 09:38PM UTC coverage: 64.291% (+0.04%) from 64.248%
14525294141

push

github

web-flow
metal: parameter block fix (#303)

* metal: parameter block fix

- When set element type layout for Metal target, if the bindingType is
  parameter block, we will add the container type, `ParameterBlock`, to
  indicate that.

- When creating ShaderObject on Metal target, we have to use
  'MetalArgumentBufferTier2' when the type layout is parameter block to
  get the uniformSize, otherwise, it will always be 0.

- Fix the issue in calculating the offset of argument buffer. We should
  use "MetalArgumentBufferTier2" consistently.

- Simplify the ordinary data writing. We can write the orinary data at
  beginning, the offsets where resource types located will just be 0.
  And following up process will fill up those offsets with device
  address (for buffers) and resource IDs (for texture/sampler).

* add a new test for parameter block

This test will fail if we don't have the fix in this PR.

For example:

```
cursor["scene"]["sceneCb"]["value"].setData(uint4{100, 100, 100, 100});
```

won't set anything because scene is a parameter block, however in
previous implementation, we didn't handle this correctly in ShaderObject
type layout and ShaderObject creation time.

* Add some comments on the new test

8290 of 15196 branches covered (54.55%)

Branch coverage included in aggregate %.

8 of 21 new or added lines in 4 files covered. (38.1%)

2 existing lines in 2 files now uncovered.

25155 of 36825 relevant lines covered (68.31%)

114135.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

56.68
/src/shader-object.cpp


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc