diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-07-11 12:18:13 -0700 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-07-11 12:18:13 -0700 |
| commit | 0cd5602383d1ae85276eacec69d51a15a9e975f4 (patch) | |
| tree | e3da0ad8cb61eb5486c4c7fbc2e59d2fc934fa88 /source | |
| parent | 98b3e5bc95b6de081885798840c2deb79905a68f (diff) | |
Improve reporting of GLSL `image*` types
- Update stdlib so taht `image*` types have read-write access encoded in their type
- TODO: this isn't 100% right, since there are GLSL qualifiers that might override this
- Add a test case to verify that the reflection API reports `image*` parameters
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-stdlib.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/slang/slang-stdlib.cpp b/source/slang/slang-stdlib.cpp index 9d6f812cd..b7500d416 100644 --- a/source/slang/slang-stdlib.cpp +++ b/source/slang/slang-stdlib.cpp @@ -1941,7 +1941,8 @@ namespace Slang for (int isMultisample = 0; isMultisample < 2; ++isMultisample) { - auto access = SLANG_RESOURCE_ACCESS_READ; + auto readAccess = SLANG_RESOURCE_ACCESS_READ; + auto readWriteAccess = SLANG_RESOURCE_ACCESS_READ_WRITE; // TODO: any constraints to enforce on what gets to be multisampled? @@ -1951,7 +1952,10 @@ namespace Slang if (isMultisample) flavor |= TextureType::MultisampleFlag; // if (isShadow) flavor |= TextureType::ShadowFlag; - flavor |= (access << 8); + + + unsigned readFlavor = flavor | (readAccess << 8); + unsigned readWriteFlavor = flavor | (readWriteAccess << 8); StringBuilder nameBuilder; nameBuilder << shapeName; @@ -1960,17 +1964,17 @@ namespace Slang auto name = nameBuilder.ProduceString(); sb << "__generic<T> "; - sb << "__magic_type(TextureSampler," << int(flavor) << ") struct "; + sb << "__magic_type(TextureSampler," << int(readFlavor) << ") struct "; sb << "__sampler" << name; sb << " {};\n"; sb << "__generic<T> "; - sb << "__magic_type(Texture," << int(flavor) << ") struct "; + sb << "__magic_type(Texture," << int(readFlavor) << ") struct "; sb << "__texture" << name; sb << " {};\n"; sb << "__generic<T> "; - sb << "__magic_type(GLSLImageType," << int(flavor) << ") struct "; + sb << "__magic_type(GLSLImageType," << int(readWriteFlavor) << ") struct "; sb << "__image" << name; sb << " {};\n"; |
