Hash :
2c8f0845
Author :
Date :
2018-09-12T14:44:55
Add ANGLE_multiview_multisample We add a novel multiview multisampling extension that includes the requirement to explicitly resolve the multisampled framebuffer. The explicit resolve is much more straightforward to implement on top of OpenGL and D3D11 than implicit resolve found in the native extension OVR_multiview_multisampled_render_to_texture. It also has predictable performance characteristics. The extension allows multiview drawing to 2D multisample texture arrays and is now enabled on both the GL backend and the D3D11 backend. The implementation is fairly simple, as it involves just small changes in validation to allow multisampled framebuffer attachments. The multiview rendering logic is exactly the same regardless of whether multisampling is enabled. For the most part the same tests are used to test both multisampled and non-multisampled rendering. The tests will use a different framebuffer setup depending on the test param. They resolve the multisampled framebuffer to a non-multisampled framebuffer prior to any readbacks from the framebuffer. Some of the tests are adjusted so that they have the correct sub-pixel positioning of multisampled quads, so there won't be any pixels that would be just partially covered. The tests don't have any tolerance for partially covered pixels - if we find any platforms where the tests run into a sub-pixel positioning corner case, tolerance may need to be added later. BUG=angleproject:2775 TEST=angle_end2end_tests Change-Id: I590d7f300a92ea5439f2720d9db14a7976db2e1d Reviewed-on: https://chromium-review.googlesource.com/1221214 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
//
// 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.h: A helper struct for indexing into an Image array
#ifndef LIBANGLE_IMAGE_INDEX_H_
#define LIBANGLE_IMAGE_INDEX_H_
#include "common/PackedEnums.h"
#include "common/mathutil.h"
#include "angle_gl.h"
namespace gl
{
class ImageIndexIterator;
class ImageIndex
{
public:
ImageIndex();
ImageIndex(const ImageIndex &other);
ImageIndex &operator=(const ImageIndex &other);
TextureType getType() const { return mType; }
GLint getLevelIndex() const { return mLevelIndex; }
GLint getLayerIndex() const { return mLayerIndex; }
GLint getLayerCount() const { return mLayerCount; }
bool hasLayer() const;
bool has3DLayer() const;
bool usesTex3D() const;
GLint cubeMapFaceIndex() const;
bool valid() const;
// Note that you cannot use this function when the ImageIndex represents an entire level of cube
// map.
TextureTarget getTarget() const;
bool isLayered() const;
bool isEntireLevelCubeMap() const;
static ImageIndex Make2D(GLint levelIndex);
static ImageIndex MakeRectangle(GLint levelIndex);
static ImageIndex MakeCubeMapFace(TextureTarget target, GLint levelIndex);
static ImageIndex Make2DArray(GLint levelIndex, GLint layerIndex = kEntireLevel);
static ImageIndex Make2DArrayRange(GLint levelIndex, GLint layerIndex, GLint layerCount);
static ImageIndex Make3D(GLint levelIndex, GLint layerIndex = kEntireLevel);
static ImageIndex MakeFromTarget(TextureTarget target, GLint levelIndex);
static ImageIndex MakeFromType(TextureType type,
GLint levelIndex,
GLint layerIndex = kEntireLevel,
GLint layerCount = 1);
static ImageIndex Make2DMultisample();
static ImageIndex Make2DMultisampleArray(GLint layerIndex = kEntireLevel);
static ImageIndex Make2DMultisampleArrayRange(GLint layerIndex, GLint layerCount);
static constexpr GLint kEntireLevel = static_cast<GLint>(-1);
bool operator<(const ImageIndex &b) const;
bool operator==(const ImageIndex &b) const;
bool operator!=(const ImageIndex &b) const;
// Only valid for 3D/Cube textures with layers.
ImageIndexIterator getLayerIterator(GLint layerCount) const;
private:
friend class ImageIndexIterator;
ImageIndex(TextureType type, GLint leveIndex, GLint layerIndex, GLint layerCount);
TextureType mType;
GLint mLevelIndex;
GLint mLayerIndex;
GLint mLayerCount;
};
// To be used like this:
//
// ImageIndexIterator it = ...;
// while (it.hasNext())
// {
// ImageIndex current = it.next();
// }
class ImageIndexIterator
{
public:
ImageIndexIterator(const ImageIndexIterator &other);
static ImageIndexIterator Make2D(GLint minMip, GLint maxMip);
static ImageIndexIterator MakeRectangle(GLint minMip, GLint maxMip);
static ImageIndexIterator MakeCube(GLint minMip, GLint maxMip);
static ImageIndexIterator Make3D(GLint minMip, GLint maxMip, GLint minLayer, GLint maxLayer);
static ImageIndexIterator Make2DArray(GLint minMip, GLint maxMip, const GLsizei *layerCounts);
static ImageIndexIterator Make2DMultisample();
static ImageIndexIterator Make2DMultisampleArray(const GLsizei *layerCounts);
static ImageIndexIterator MakeGeneric(TextureType type,
GLint minMip,
GLint maxMip,
GLint minLayer,
GLint maxLayer);
ImageIndex next();
ImageIndex current() const;
bool hasNext() const;
private:
ImageIndexIterator(TextureType type,
const Range<GLint> &mipRange,
const Range<GLint> &layerRange,
const GLsizei *layerCounts);
GLint maxLayer() const;
const Range<GLint> mMipRange;
const Range<GLint> mLayerRange;
const GLsizei *const mLayerCounts;
ImageIndex mCurrentIndex;
};
} // namespace gl
#endif // LIBANGLE_IMAGE_INDEX_H_