//
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
// Copyright (C) 2012-2016 LunarG, Inc.
// Copyright (C) 2015-2016 Google, Inc.
// Copyright (C) 2017 ARM Limited.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#ifndef _TYPES_INCLUDED
#define _TYPES_INCLUDED
#include "../Include/Common.h"
#include "../Include/BaseTypes.h"
#include "../Public/ShaderLang.h"
#include "arrays.h"
#include <algorithm>
namespace glslang {
const int GlslangMaxTypeLength = 200; // TODO: need to print block/struct one member per line, so this can stay bounded
const char* const AnonymousPrefix = "anon@"; // for something like a block whose members can be directly accessed
inline bool IsAnonymous(const TString& name)
{
return name.compare(0, 5, AnonymousPrefix) == 0;
}
//
// Details within a sampler type
//
enum TSamplerDim {
EsdNone,
Esd1D,
Esd2D,
Esd3D,
EsdCube,
EsdRect,
EsdBuffer,
EsdSubpass, // goes only with non-sampled image (image is true)
EsdNumDims
};
struct TSampler { // misnomer now; includes images, textures without sampler, and textures with sampler
TBasicType type : 8; // type returned by sampler
TSamplerDim dim : 8;
bool arrayed : 1;
bool shadow : 1;
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 GLSLANG_WEB
bool is1D() const { return false; }
bool isBuffer() const { return false; }
bool isRect() const { return false; }
bool isSubpass() const { return false; }
bool isCombined() const { return true; }
bool isImage() const { return false; }
bool isImageClass() const { return false; }
bool isMultiSample() const { return false; }
bool isExternal() const { return false; }
void setExternal(bool e) { }
bool isYuv() const { return false; }
#else
unsigned int vectorSize : 3; // vector return type size.
// Some languages support structures as sample results. Storing the whole structure in the
// TSampler is too large, so there is an index to a separate table.
static const unsigned structReturnIndexBits = 4; // number of index bits to use.
static const unsigned structReturnSlots = (1<<structReturnIndexBits)-1; // number of valid values
static const unsigned noReturnStruct = structReturnSlots; // value if no return struct type.
// Index into a language specific table of texture return structures.
unsigned int structReturnIndex : structReturnIndexBits;
bool external : 1; // GL_OES_EGL_image_external
bool yuv : 1; // GL_EXT_YUV_target
#ifdef ENABLE_HLSL
unsigned int getVectorSize() const { return vectorSize; }
void clearReturnStruct() { structReturnIndex = noReturnStruct; }
bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; }
unsigned getStructReturnIndex() const { return structReturnIndex; }
#endif
bool is1D() const { return dim == Esd1D; }
bool isBuffer() const { return dim == EsdBuffer; }
bool isRect() const { return dim == EsdRect; }
bool isSubpass() const { return dim == EsdSubpass; }
bool isCombined() const { return combined; }
bool isImage() const { return image && !isSubpass(); }
bool isImageClass() const { return image; }
bool isMultiSample() const { return ms; }
bool isExternal() const { return external; }
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; }
bool isShadow() const { return shadow; }
bool isArrayed() const { return arrayed; }
void clear()
{
type = EbtVoid;
dim = EsdNone;
arrayed = false;
shadow = false;
ms = false;
image = false;
combined = false;
sampler = false;
#ifndef GLSLANG_WEB
external = false;
yuv = false;
#endif
#ifdef ENABLE_HLSL
clearReturnStruct();
// by default, returns a single vec4;
vectorSize = 4;
#endif
}
// make a combined sampler and texture
void set(TBasicType t, TSamplerDim d, bool a = false, bool s = false, bool m = false)
{
clear();
type = t;
dim = d;
arrayed = a;
shadow = s;
ms = m;
combined = true;
}
// make an image
void setImage(TBasicType t, TSamplerDim d, bool a = false, bool s = false, bool m = false)
{
clear();
type = t;
dim = d;
arrayed = a;
shadow = s;
ms = m;
image = true;
}
// make a texture with no sampler
void setTexture(TBasicType t, TSamplerDim d, bool a = false, bool s = false, bool m = false)
{
clear();
type = t;
dim = d;
arrayed = a;
shadow = s;
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)
{
clear();
type = t;
image = true;
dim = EsdSubpass;
ms = m;
}
#endif
bool operator==(const TSampler& right) const
{
return type == right.type &&
dim == right.dim &&
arrayed == right.arrayed &&
shadow == right.shadow &&
isMultiSample() == right.isMultiSample() &&
isImageClass() == right.isImageClass() &&
isCombined() == right.isCombined() &&
isPureSampler() == ri
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
ncnn的vulkan基础支持包 (376个子文件)
libncnn.a 16.84MB
libncnn.a 13.62MB
libncnn.a 13.59MB
libncnn.a 7.55MB
libMachineIndependent.a 4.89MB
libMachineIndependent.a 3.7MB
libMachineIndependent.a 3.44MB
libMachineIndependent.a 3.14MB
libSPIRV.a 1.7MB
libSPIRV.a 1.13MB
libSPIRV.a 990KB
libSPIRV.a 920KB
libglslang.a 109KB
libglslang.a 57KB
libglslang.a 56KB
libglslang.a 45KB
libGenericCodeGen.a 34KB
libGenericCodeGen.a 25KB
libGenericCodeGen.a 23KB
libGenericCodeGen.a 17KB
libOSDependent.a 6KB
libOSDependent.a 5KB
libOSDependent.a 5KB
libOSDependent.a 4KB
libOGLCompiler.a 4KB
libOGLCompiler.a 4KB
libOGLCompiler.a 4KB
libOGLCompiler.a 3KB
glslangTargets.cmake 5KB
glslangTargets.cmake 5KB
glslangTargets.cmake 5KB
glslangTargets.cmake 5KB
ncnn.cmake 4KB
ncnn.cmake 4KB
ncnn.cmake 4KB
ncnn.cmake 4KB
SPIRVTargets.cmake 4KB
SPIRVTargets.cmake 4KB
SPIRVTargets.cmake 4KB
SPIRVTargets.cmake 4KB
OSDependentTargets.cmake 3KB
OSDependentTargets.cmake 3KB
OSDependentTargets.cmake 3KB
OSDependentTargets.cmake 3KB
OGLCompilerTargets.cmake 3KB
OGLCompilerTargets.cmake 3KB
OGLCompilerTargets.cmake 3KB
OGLCompilerTargets.cmake 3KB
glslangTargets-release.cmake 2KB
glslangTargets-release.cmake 2KB
glslangTargets-release.cmake 2KB
glslangTargets-release.cmake 2KB
ncnnConfig.cmake 1KB
ncnnConfig.cmake 1KB
ncnnConfig.cmake 1KB
ncnnConfig.cmake 1KB
OGLCompilerTargets-release.cmake 845B
OSDependentTargets-release.cmake 845B
OGLCompilerTargets-release.cmake 845B
OSDependentTargets-release.cmake 845B
OGLCompilerTargets-release.cmake 845B
OSDependentTargets-release.cmake 845B
OGLCompilerTargets-release.cmake 845B
OSDependentTargets-release.cmake 845B
SPIRVTargets-release.cmake 803B
SPIRVTargets-release.cmake 803B
SPIRVTargets-release.cmake 803B
SPIRVTargets-release.cmake 803B
ncnn-release.cmake 796B
ncnn-release.cmake 796B
ncnn-release.cmake 796B
ncnn-release.cmake 796B
Types.h 90KB
Types.h 90KB
Types.h 90KB
Types.h 90KB
mat.h 69KB
mat.h 69KB
mat.h 69KB
mat.h 69KB
intermediate.h 59KB
intermediate.h 59KB
intermediate.h 59KB
intermediate.h 59KB
localintermediate.h 44KB
localintermediate.h 44KB
localintermediate.h 44KB
localintermediate.h 44KB
ShaderLang.h 42KB
ShaderLang.h 42KB
ShaderLang.h 42KB
ShaderLang.h 42KB
hex_float.h 40KB
hex_float.h 40KB
hex_float.h 40KB
hex_float.h 40KB
SpvBuilder.h 39KB
SpvBuilder.h 39KB
SpvBuilder.h 39KB
SpvBuilder.h 39KB
共 376 条
- 1
- 2
- 3
- 4
叶知秋高
- 粉丝: 3
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0