stride icon indicating copy to clipboard operation
stride copied to clipboard

Disable optimizations in debug when compiling shaders

Open Ethereal77 opened this issue 2 months ago • 4 comments

PR Details

When compiling shaders in debug mode, ShaderCompiler now disables any optimizations made to the output bytecode. This, however, is not done if shaders are being compiled on GraphicsProfile.Level_9_3 or below, as platforms that fall into those categories / graphics APIs had pretty severe limitations in instruction slots, bytecode size, etc., and it makes the compilation fail in those cases.

Related Issue

As discussed in issue #2972

Types of changes

  • [ ] Docs change / refactoring / dependency upgrade
  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [ ] My change requires a change to the documentation.
  • [ ] I have added tests to cover my changes.
  • [x] All new and existing tests passed.
  • [x] I have built and run the editor to try this change out.

Ethereal77 avatar Nov 18 '25 06:11 Ethereal77

This needs a documentation change to inform about this? And if it does, where and how would be the most appropriate place?

Ethereal77 avatar Nov 18 '25 06:11 Ethereal77

This needs a documentation change to inform about this? And if it does, where and how would be the most appropriate place?

Somewhere here? https://doc.stride3d.net/latest/en/manual/graphics/effects-and-shaders/index.html

VaclavElias avatar Nov 18 '25 15:11 VaclavElias

Thanks, Vaclav. If needed I'll add to the docs. 😀

But the question was more in the sense of: this change affects very old platforms. Platforms that we may phase out soon anyway. And it is a very specific thing affecting only people who restrict themselves to compile with those low GraphicsProfiles. Not many people, I suppose. And finally, it affects them because of limitations of very old hardware which don't apply anymore on modern hardware, even hardware that presents itself as low-profile. Even cheap mobile GPUs support shaders of arbitrary length, no limits on texture slots or ALU instructions, etc.

So... do we document it? And if yes, how do we explain this without going into too much low-level depths?

Ethereal77 avatar Nov 19 '25 00:11 Ethereal77

Yes, I wouldn't worry about it being skipped on Level 9_3 or lower. No need to specifically document it, those will probably disappear soon.

xen2 avatar Dec 03 '25 08:12 xen2