Hash :
cc129377
Author :
Date :
2018-04-12T09:13:18
ImageIndex: Consolidate layer/cube face. In terms of the Texture or Image resource, a cube face refers to a layer of a 2D texture. This layer has a special meaning for cube textures, but it is represented as a layer with a layer index. Cube array textures are no different, they just use a different indexing scheme for the array layers. This also cleans up the ImageIndex helper to have a class structure with private data, and cleans up a few cases to use generic Make functions and iterators where they were setting properties of the index directly. This will make it easier to have ImageIndexes address entire levels of a Cube map in the future, and makes the layer count logic in Vulkan cleaner. Bug: angleproject:2318 Change-Id: Iea9842e233f974a9896282ca224cb001f7882bd1 Reviewed-on: https://chromium-review.googlesource.com/987525 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
//
// Copyright (c) 2002-2013 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.
//
// TextureStorage.h: Defines the abstract rx::TextureStorage class.
#ifndef LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
#define LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
#include "common/debug.h"
#include "libANGLE/angletypes.h"
#include <GLES2/gl2.h>
#include <stdint.h>
namespace gl
{
class Context;
class ImageIndex;
struct Box;
struct PixelUnpackState;
} // namespace gl
namespace angle
{
class Subject;
} // namespace angle
namespace rx
{
class SwapChainD3D;
class RenderTargetD3D;
class ImageD3D;
class TextureStorage : angle::NonCopyable
{
public:
TextureStorage() : mSubject(nullptr) {}
virtual ~TextureStorage() {}
virtual gl::Error onDestroy(const gl::Context *context);
virtual int getTopLevel() const = 0;
virtual bool isRenderTarget() const = 0;
virtual bool isManaged() const = 0;
virtual bool supportsNativeMipmapFunction() const = 0;
virtual int getLevelCount() const = 0;
virtual gl::Error getRenderTarget(const gl::Context *context,
const gl::ImageIndex &index,
RenderTargetD3D **outRT) = 0;
virtual gl::Error generateMipmap(const gl::Context *context,
const gl::ImageIndex &sourceIndex,
const gl::ImageIndex &destIndex) = 0;
virtual gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) = 0;
virtual gl::Error setData(const gl::Context *context,
const gl::ImageIndex &index,
ImageD3D *image,
const gl::Box *destBox,
GLenum type,
const gl::PixelUnpackState &unpack,
const uint8_t *pixelData) = 0;
// This is a no-op for most implementations of TextureStorage. Some (e.g. TextureStorage11_2D) might override it.
virtual gl::Error useLevelZeroWorkaroundTexture(const gl::Context *context,
bool useLevelZeroTexture);
// Only used for D3D11.
void setSubject(const angle::Subject *subject);
protected:
const angle::Subject *mSubject;
};
inline gl::Error TextureStorage::onDestroy(const gl::Context *context)
{
return gl::NoError();
}
inline gl::Error TextureStorage::useLevelZeroWorkaroundTexture(const gl::Context *context,
bool useLevelZeroTexture)
{
return gl::NoError();
}
inline void TextureStorage::setSubject(const angle::Subject *subject)
{
mSubject = subject;
}
using TexStoragePointer = angle::UniqueObjectPointer<TextureStorage, gl::Context>;
} // namespace rx
#endif // LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_