Title: No diagnostic emitted for unsupported dynamic sampler array indexing · Issue #28 · devkitPro/deko3d · GitHub
Open Graph Title: No diagnostic emitted for unsupported dynamic sampler array indexing · Issue #28 · devkitPro/deko3d
X Title: No diagnostic emitted for unsupported dynamic sampler array indexing · Issue #28 · devkitPro/deko3d
Description: What's the issue you encountered? uam silently compiles dynamic indexing of a sampler2D[] array with a runtime non-uniform variable without error or warning, but produces incorrect behavior at runtime. The sampler array is always sampled...
Open Graph Description: What's the issue you encountered? uam silently compiles dynamic indexing of a sampler2D[] array with a runtime non-uniform variable without error or warning, but produces incorrect behavior at runt...
X Description: What's the issue you encountered? uam silently compiles dynamic indexing of a sampler2D[] array with a runtime non-uniform variable without error or warning, but produces incorrect behavior at ...
Opengraph URL: https://github.com/devkitPro/deko3d/issues/28
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"No diagnostic emitted for unsupported dynamic sampler array indexing","articleBody":"**What's the issue you encountered?**\nuam silently compiles dynamic indexing of a sampler2D[] array with a runtime non-uniform variable without error or warning, but produces incorrect behavior at runtime. The sampler array is always sampled at index 0 regardless of the index value passed. No diagnostic is emitted during compilation.\nThe workaround is a switch statement with literal compile-time indices, identical to the SM5.0 limitation in D3D11's fxc compiler — however unlike fxc, uam does not report this as an error or warning.\n\n**How can the issue be reproduced?**\nWrite a GLSL fragment shader with layout(binding = N) uniform sampler2D uTextures[16]\nPass a flat uint varying from the vertex shader as the array index (lets call it fragAlbedo)\nSample with texture(uTextures[fragAlbedo], fragTexCoord) where fragAlbedo is the varying\nCompile with uam\nAt runtime the sampler is always evaluated at index 0 regardless of fragAlbedo's value\n\n**The following workaround is required:**\nglslswitch(fragAlbedo)\n{\n case 0: color = texture(uTextures[ 0], fragTexCoord); break;\n case 1: color = texture(uTextures[ 1], fragTexCoord); break;\n // etc.\n}\n\n**Environment?**\n\nHost OS: Windows 10 with MSYS2 shell\nOfficial release devkitPro toolchain via pacman\n\n**Additional context?**\nThe issue produces no compile-time error or warning from uam, making it extremely difficult to diagnose. The expected behavior is either a compile-time error stating dynamic indexing of sampler arrays is unsupported, or correct runtime behavior. GL_EXT_nonuniform_qualifier / nonuniformEXT was also attempted and reported as unsupported at runtime.\n\nFor reference, Microsoft's fxc compiler (D3D11 SM5.0) explicitly rejects this pattern at compile time with the error: \"error X3531: can't unroll loops marked with loop attribute\" / \"array index must be a literal\", making the limitation immediately clear to the developer. uam compiling this silently and producing incorrect runtime behavior with no indication of the limitation cost significant debugging time.\n\nThis issue was discovered when migrating away from sampler2DArray,dynamic indexing works correctly on sampler2DArray via texture(uTextureArray, vec3(fragTexCoord, fragAlbedo)) and has no issues. The problem is specific to sampler2D[] array dynamic indexing. Given that D3D11 SM5.0 also does not support this pattern, it is likely a hardware/compiler limitation of dksh as well, however the absence of any compile-time diagnostic meant approximately 2 days of debugging were spent isolating the issue. A simple compile-time error or warning stating that dynamic indexing of sampler2D[] arrays is unsupported would have resolved this immediately.\n\nThanks,","author":{"url":"https://github.com/420BlazeItBrah","@type":"Person","name":"420BlazeItBrah"},"datePublished":"2026-06-25T01:09:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/28/deko3d/issues/28"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b00eaaf2-51ab-5d73-7a62-868fb0c38c83 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C0F4:10DE3:C76782:118F098:6A4BE248 |
| html-safe-nonce | 0f428e62e0a3868a696965ebcf550b2ef5d00ea6295e968dea2ddf5c074326e6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMEY0OjEwREUzOkM3Njc4MjoxMThGMDk4OjZBNEJFMjQ4IiwidmlzaXRvcl9pZCI6IjI0OTMxNDU4MDA3OTQ5ODk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 73a14608ca489ba77e0083f2a959b2fddc7dde12c509db10722410f72f08679e |
| hovercard-subject-tag | issue:4739691078 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/devkitPro/deko3d/28/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b8295090a27c4999c0fc86f6ba5296a5b52d538800facd0c3e9deeebb4182bf5/devkitPro/deko3d/issues/28 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b8295090a27c4999c0fc86f6ba5296a5b52d538800facd0c3e9deeebb4182bf5/devkitPro/deko3d/issues/28 |
| og:image:alt | What's the issue you encountered? uam silently compiles dynamic indexing of a sampler2D[] array with a runtime non-uniform variable without error or warning, but produces incorrect behavior at runt... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 420BlazeItBrah |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0f5d3ba365b3985d75c32a5957c8635488d58dcf027ae6ae958eee7edaa306a2 |
| turbo-cache-control | no-preview |
| go-import | github.com/devkitPro/deko3d git https://github.com/devkitPro/deko3d.git |
| octolytics-dimension-user_id | 7538897 |
| octolytics-dimension-user_login | devkitPro |
| octolytics-dimension-repository_id | 170358881 |
| octolytics-dimension-repository_nwo | devkitPro/deko3d |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 170358881 |
| octolytics-dimension-repository_network_root_nwo | devkitPro/deko3d |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 253920ac2dc35b0849cca4633895f1f2e5f03051 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width