// // Copyright 2014 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //
// ImageIndex.cpp: Implementation for ImageIndex methods.
namespace gl
{ namespace
{
GLint TextureTargetToLayer(TextureTarget target)
{ switch (target)
{ case TextureTarget::CubeMapPositiveX: return 0; case TextureTarget::CubeMapNegativeX: return 1; case TextureTarget::CubeMapPositiveY: return 2; case TextureTarget::CubeMapNegativeY: return 3; case TextureTarget::CubeMapPositiveZ: return 4; case TextureTarget::CubeMapNegativeZ: return 5; case TextureTarget::External: case TextureTarget::Rectangle: case TextureTarget::_2D: case TextureTarget::VideoImage: case TextureTarget::_2DArray: case TextureTarget::_2DMultisample: case TextureTarget::_2DMultisampleArray: case TextureTarget::_3D: case TextureTarget::Buffer: case TextureTarget::CubeMapArray: return ImageIndex::kEntireLevel; default:
UNREACHABLE(); return 0;
}
}
bool IsArrayTarget(TextureTarget target)
{ switch (target)
{ case TextureTarget::_2DArray: case TextureTarget::_2DMultisampleArray: case TextureTarget::CubeMapArray: returntrue; default: returnfalse;
}
}
} // anonymous namespace
TextureTarget TextureTypeToTarget(TextureType type, GLint layerIndex)
{ if (type == TextureType::CubeMap)
{ // As GL_TEXTURE_CUBE_MAP cannot be a texture target in texImage*D APIs, so we don't allow // an entire cube map to have a texture target.
ASSERT(layerIndex != ImageIndex::kEntireLevel); return CubeFaceIndexToTextureTarget(layerIndex);
} else
{ return NonCubeTextureTypeToTarget(type);
}
}
bool ImageIndex::isLayered() const
{ switch (mType)
{ case TextureType::_2DArray: case TextureType::_2DMultisampleArray: case TextureType::CubeMap: case TextureType::_3D: case TextureType::CubeMapArray: return mLayerIndex == kEntireLevel; default: returnfalse;
}
}
bool ImageIndex::has3DLayer() const
{ // It's quicker to check != CubeMap than calling usesTex3D, which checks multiple types. This // ASSERT validates the check gives the same result.
ASSERT(!hasLayer() || ((mType != TextureType::CubeMap) == usesTex3D())); return (hasLayer() && mType != TextureType::CubeMap);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.