1//
2// Copyright 2014 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// ImageIndex.cpp: Implementation for ImageIndex methods.
8
9#include "libGLESv2/ImageIndex.h"
10#include "libGLESv2/Texture.h"
11#include "common/utilities.h"
12
13namespace gl
14{
15
16ImageIndex::ImageIndex(const ImageIndex &other)
17    : type(other.type),
18      mipIndex(other.mipIndex),
19      layerIndex(other.layerIndex)
20{}
21
22ImageIndex &ImageIndex::operator=(const ImageIndex &other)
23{
24    type = other.type;
25    mipIndex = other.mipIndex;
26    layerIndex = other.layerIndex;
27    return *this;
28}
29
30ImageIndex ImageIndex::Make2D(GLint mipIndex)
31{
32    return ImageIndex(GL_TEXTURE_2D, mipIndex, ENTIRE_LEVEL);
33}
34
35ImageIndex ImageIndex::MakeCube(GLenum target, GLint mipIndex)
36{
37    ASSERT(gl::IsCubemapTextureTarget(target));
38    return ImageIndex(target, mipIndex, TextureCubeMap::targetToLayerIndex(target));
39}
40
41ImageIndex ImageIndex::Make2DArray(GLint mipIndex, GLint layerIndex)
42{
43    return ImageIndex(GL_TEXTURE_2D_ARRAY, mipIndex, layerIndex);
44}
45
46ImageIndex ImageIndex::Make3D(GLint mipIndex, GLint layerIndex)
47{
48    return ImageIndex(GL_TEXTURE_3D, mipIndex, layerIndex);
49}
50
51ImageIndex::ImageIndex(GLenum typeIn, GLint mipIndexIn, GLint layerIndexIn)
52    : type(typeIn),
53      mipIndex(mipIndexIn),
54      layerIndex(layerIndexIn)
55{}
56
57}
58