From 1eb5a1bc44e950b6b74c0907984adfe4d971917c Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Wed, 21 Jun 2017 11:34:56 -0700 Subject: Revamp definitions of texture `Load` and `GetDimensions` These are annoyingly subtle. --- source/slang/slang-stdlib.cpp | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'source/slang/slang-stdlib.cpp') diff --git a/source/slang/slang-stdlib.cpp b/source/slang/slang-stdlib.cpp index e44b7131b..7643b3b85 100644 --- a/source/slang/slang-stdlib.cpp +++ b/source/slang/slang-stdlib.cpp @@ -1385,6 +1385,11 @@ namespace Slang sb << ", " << t << "elements"; } + if(isMultisample) + { + sb << ", " << t << "sampleCount"; + } + if(includeMipInfo) sb << ", " << t << "numberOfLevels"; @@ -1401,22 +1406,35 @@ namespace Slang if( kBaseTextureTypes[tt].coordCount + isArray < 4 ) { + int loadCoordCount = kBaseTextureTypes[tt].coordCount + isArray + (isMultisample?0:1); + sb << "T Load("; - sb << "int" << kBaseTextureTypes[tt].coordCount + isArray + 1 << " location);\n"; + sb << "int" << loadCoordCount << " location"; + if(isMultisample) + { + sb << ", int sampleIndex"; + } + sb << ");\n"; - if( !isMultisample ) + sb << "T Load("; + sb << "int" << loadCoordCount << " location"; + if(isMultisample) { - sb << "T Load("; - sb << "int" << kBaseTextureTypes[tt].coordCount + isArray + 1 << " location, "; - sb << "int" << kBaseTextureTypes[tt].coordCount << " offset);\n"; + sb << ", int sampleIndex"; } - else + sb << ", int" << loadCoordCount << " offset"; + sb << ");\n"; + + + sb << "T Load("; + sb << "int" << loadCoordCount << " location"; + if(isMultisample) { - sb << "T Load("; - sb << "int" << kBaseTextureTypes[tt].coordCount + isArray + 1 << " location, "; - sb << "int sampleIndex, "; - sb << "int" << kBaseTextureTypes[tt].coordCount << " offset);\n"; + sb << ", int sampleIndex"; } + sb << ", int" << kBaseTextureTypes[tt].coordCount << " offset"; + sb << ", out uint status"; + sb << ");\n"; } if(baseShape != TextureType::ShapeCube) -- cgit v1.2.3