Merge pull request #2021 from KhronosGroup/fix-2020-inconsistent-HLSL

Fix #2020: PR #1977 broke HLSL member consistency, this fixes it.
This commit is contained in:
John Kessenich 2019-12-10 00:36:41 -07:00 committed by GitHub
commit 6c479796f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -82,11 +82,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool sampler : 1; // true means a pure sampler, other fields should be clear() bool sampler : 1; // true means a pure sampler, other fields should be clear()
#ifdef GLSLANG_WEB #ifdef GLSLANG_WEB
unsigned int getVectorSize() const { return 4; }
void clearReturnStruct() const { }
bool hasReturnStruct() const { return false; }
unsigned getStructReturnIndex() const { return 0; }
bool is1D() const { return false; } bool is1D() const { return false; }
bool isBuffer() const { return false; } bool isBuffer() const { return false; }
bool isRect() const { return false; } bool isRect() const { return false; }
@ -111,10 +106,12 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool external : 1; // GL_OES_EGL_image_external bool external : 1; // GL_OES_EGL_image_external
bool yuv : 1; // GL_EXT_YUV_target bool yuv : 1; // GL_EXT_YUV_target
#ifdef ENABLE_HLSL
unsigned int getVectorSize() const { return vectorSize; } unsigned int getVectorSize() const { return vectorSize; }
void clearReturnStruct() { structReturnIndex = noReturnStruct; } void clearReturnStruct() { structReturnIndex = noReturnStruct; }
bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; } bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; }
unsigned getStructReturnIndex() const { return structReturnIndex; } unsigned getStructReturnIndex() const { return structReturnIndex; }
#endif
bool is1D() const { return dim == Esd1D; } bool is1D() const { return dim == Esd1D; }
bool isBuffer() const { return dim == EsdBuffer; } bool isBuffer() const { return dim == EsdBuffer; }
@ -225,9 +222,12 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
isCombined() == right.isCombined() && isCombined() == right.isCombined() &&
isPureSampler() == right.isPureSampler() && isPureSampler() == right.isPureSampler() &&
isExternal() == right.isExternal() && isExternal() == right.isExternal() &&
isYuv() == right.isYuv() && isYuv() == right.isYuv()
getVectorSize() == right.getVectorSize() && #ifdef ENABLE_HLSL
getStructReturnIndex() == right.getStructReturnIndex(); && getVectorSize() == right.getVectorSize() &&
getStructReturnIndex() == right.getStructReturnIndex()
#endif
;
} }
bool operator!=(const TSampler& right) const bool operator!=(const TSampler& right) const

View File

@ -114,6 +114,7 @@ void TType::buildMangledName(TString& mangledName) const
default: break; // some compilers want this default: break; // some compilers want this
} }
#ifdef ENABLE_HLSL
if (sampler.hasReturnStruct()) { if (sampler.hasReturnStruct()) {
// Name mangle for sampler return struct uses struct table index. // Name mangle for sampler return struct uses struct table index.
mangledName += "-tx-struct"; mangledName += "-tx-struct";
@ -129,6 +130,7 @@ void TType::buildMangledName(TString& mangledName) const
case 4: break; // default to prior name mangle behavior case 4: break; // default to prior name mangle behavior
} }
} }
#endif
if (sampler.isMultiSample()) if (sampler.isMultiSample())
mangledName += "M"; mangledName += "M";