diff options
| author | Yong He <yonghe@outlook.com> | 2023-11-14 17:46:05 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-14 17:46:05 -0800 |
| commit | 12f7237e4060388494c549623f4a640327b7ca08 (patch) | |
| tree | 407c0f8d20b4ccd49ae5df57f84c8f9a310f7055 /source/slang/slang-stdlib-textures.cpp | |
| parent | c71b12775c8b13ea2b181e42c04b8db55b10fb2f (diff) | |
Add GLSL Compatibility. (#3321)
* Parse glsl buffer blocks to GLSLInterfaceBlockDecl
* Parse glsl local size layout declarations
* Parse (and ignore) glsl version directives
* spelling
* Better l-value interpretation for glsl interface blocks
* Better l-value interpretation for glsl interface blocks
* Add compile flag for enabling glsl
* Parse and ignore precision modifiers.
* Automatically import `glsl` module for compatiblity.
* Complete vector and matrix types for glsl
* Remove generated file from repo
* Bump .gitignore
* do not mark out globals as params
* Synthesize entrypoint layout from global inout vars.
* update test result.
* Allow HLSL semantic on global variables.
* Fix.
* Fix test.
* Fix win32 compile error.
* Add more builtin input/output and texture intrinsics.
* Add struct/array constructor syntax.
* Skip `#extension` lines.
* overide operator * for matrix/vector multiplication.
* Add `matrixCompMult`.
* Parse modifiers in for loop init var declr.
* Add more glsl intrinsics, add stage into to var layout.
* Allow `int[3] x` syntax.
* Fix array type syntax.
---------
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-stdlib-textures.cpp')
| -rw-r--r-- | source/slang/slang-stdlib-textures.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source/slang/slang-stdlib-textures.cpp b/source/slang/slang-stdlib-textures.cpp index 9254bf966..98380033c 100644 --- a/source/slang/slang-stdlib-textures.cpp +++ b/source/slang/slang-stdlib-textures.cpp @@ -50,6 +50,7 @@ TextureTypeInfo::TextureTypeInfo( BaseTextureShapeInfo const& base, bool isArray, bool isMultisample, + bool isShadow, BaseTextureAccessInfo const& accessInfo, StringBuilder& inSB, String const& inPath) @@ -57,6 +58,7 @@ TextureTypeInfo::TextureTypeInfo( , base(base) , isArray(isArray) , isMultisample(isMultisample) + , isShadow(isShadow) , accessInfo(accessInfo) , sb(inSB) , path(inPath) @@ -177,7 +179,7 @@ void TextureTypeInfo::emitTypeDecl() unsigned flavor = baseShape; if (isArray) flavor |= TextureFlavor::ArrayFlag; if (isMultisample) flavor |= TextureFlavor::MultisampleFlag; - // if (isShadow) flavor |= TextureFlavor::ShadowFlag; + if (isShadow) flavor |= TextureFlavor::ShadowFlag; flavor |= (access << 8); @@ -204,7 +206,7 @@ void TextureTypeInfo::emitTypeDecl() sb << baseShapeName; if (isMultisample) sb << "MS"; if (isArray) sb << "Array"; - // if (isShadow) sb << "Shadow"; + if (isShadow) sb << "Shadow"; sb << "\n"; // The struct body @@ -988,7 +990,7 @@ void TextureTypeInfo::writeSampleFunctions() { TextureFlavor::Shape baseShape = base.baseShape; char const* samplerStateParam = prefixInfo.combined ? "" : "SamplerState s, "; - + char const* comparisonSamplerStateParam = prefixInfo.combined ? "" : "SamplerComparisonState s, "; // `Sample()` writeFunc( @@ -1081,7 +1083,7 @@ void TextureTypeInfo::writeSampleFunctions() "float", "SampleCmp", cat( - "SamplerComparisonState s, ", + comparisonSamplerStateParam, "float", base.coordCount + isArray, " location, ", "float compareValue" ), @@ -1093,7 +1095,7 @@ void TextureTypeInfo::writeSampleFunctions() "float", "SampleCmpLevelZero", cat( - "SamplerComparisonState s, ", + comparisonSamplerStateParam, "float", base.coordCount + isArray, " location, ", "float compareValue" ), @@ -1113,7 +1115,7 @@ void TextureTypeInfo::writeSampleFunctions() "float", "SampleCmp", cat( - "SamplerComparisonState s, ", + comparisonSamplerStateParam, "float", base.coordCount + isArray, " location, ", "float compareValue, " "constexpr int", base.coordCount, " offset" @@ -1126,7 +1128,7 @@ void TextureTypeInfo::writeSampleFunctions() "float", "SampleCmpLevelZero", cat( - "SamplerComparisonState s, ", + comparisonSamplerStateParam, "float", base.coordCount + isArray, " location, ", "float compareValue, " "constexpr int", base.coordCount, " offset" |
