Web: Add separate texture/sampler, exclude *CubeArray*.

Looks like will add about 1K compressed size to executable footprint.
This commit is contained in:
John Kessenich 2019-10-08 01:12:07 -06:00
parent 5e634c8999
commit 61c22e255d
11 changed files with 2316 additions and 8943 deletions

View file

@ -79,6 +79,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool ms : 1;
bool image : 1; // image, combined should be false
bool combined : 1; // true means texture is combined with a sampler, false means texture with no sampler
bool sampler : 1; // true means a pure sampler, other fields should be clear()
#ifdef ENABLE_HLSL
unsigned int vectorSize : 3; // vector return type size.
unsigned int getVectorSize() const { return vectorSize; }
@ -105,8 +106,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool isRect() const { return false; }
bool isSubpass() const { return false; }
bool isCombined() const { return true; }
bool isPureSampler() const { return false; }
bool isTexture() const { return false; }
bool isImage() const { return false; }
bool isImageClass() const { return false; }
bool isMultiSample() const { return false; }
@ -114,7 +113,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
void setExternal(bool e) { }
bool isYuv() const { return false; }
#else
bool sampler : 1; // true means a pure sampler, other fields should be clear()
bool external : 1; // GL_OES_EGL_image_external
bool yuv : 1; // GL_EXT_YUV_target
// Some languages support structures as sample results. Storing the whole structure in the
@ -125,8 +123,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool isRect() const { return dim == EsdRect; }
bool isSubpass() const { return dim == EsdSubpass; }
bool isCombined() const { return combined; }
bool isPureSampler() const { return sampler; }
bool isTexture() const { return !sampler && !image; }
bool isImage() const { return image && !isSubpass(); }
bool isImageClass() const { return image; }
bool isMultiSample() const { return ms; }
@ -134,6 +130,9 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
void setExternal(bool e) { external = e; }
bool isYuv() const { return yuv; }
#endif
bool isTexture() const { return !sampler && !image; }
bool isPureSampler() const { return sampler; }
void setCombined(bool c) { combined = c; }
void setBasicType(TBasicType t) { type = t; }
TBasicType getBasicType() const { return type; }
@ -149,8 +148,8 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
ms = false;
image = false;
combined = false;
#ifndef GLSLANG_WEB
sampler = false;
#ifndef GLSLANG_WEB
external = false;
yuv = false;
#endif
@ -197,6 +196,14 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
ms = m;
}
// make a pure sampler, no texture, no image, nothing combined, the 'sampler' keyword
void setPureSampler(bool s)
{
clear();
sampler = true;
shadow = s;
}
#ifndef GLSLANG_WEB
// make a subpass input attachment
void setSubpass(TBasicType t, bool m = false)
@ -207,14 +214,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
dim = EsdSubpass;
ms = m;
}
// make a pure sampler, no texture, no image, nothing combined, the 'sampler' keyword
void setPureSampler(bool s)
{
clear();
sampler = true;
shadow = s;
}
#endif
bool operator==(const TSampler& right) const
@ -1922,6 +1921,7 @@ public:
case EbtFloat: return "float";
case EbtInt: return "int";
case EbtUint: return "uint";
case EbtSampler: return "sampler/image";
#ifndef GLSLANG_WEB
case EbtVoid: return "void";
case EbtDouble: return "double";
@ -1934,7 +1934,6 @@ public:
case EbtUint64: return "uint64_t";
case EbtBool: return "bool";
case EbtAtomicUint: return "atomic_uint";
case EbtSampler: return "sampler/image";
case EbtStruct: return "structure";
case EbtBlock: return "block";
case EbtAccStructNV: return "accelerationStructureNV";