Hash :
53ea9cc6
Author :
Date :
2016-05-17T10:12:52
Replace rx::Renderer with rx::ContextImpl. Previously Context had no Impl class, but had a special relationship with the instanced Renderer class. Having a ContextImpl backing every Context will allow new designs to enable things like multithreading (where each ContextImpl stores a Context-specific device) or non- virtual Contexts on Android or other platforms where it is more efficient. A large refactoring patch that touches every back-end. BUG=angleproject:1363 Change-Id: Icb73a7d37447f08a664eeb499a310ba05d71a57e Reviewed-on: https://chromium-review.googlesource.com/342052 Reviewed-by: Corentin Wallez <cwallez@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 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 127 128 129 130 131 132 133 134 135 136 137 138
//
// Copyright 2015 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.
//
// RendererGL.h: Defines the class interface for RendererGL.
#ifndef LIBANGLE_RENDERER_GL_RENDERERGL_H_
#define LIBANGLE_RENDERER_GL_RENDERERGL_H_
#include "libANGLE/Caps.h"
#include "libANGLE/Error.h"
#include "libANGLE/Version.h"
#include "libANGLE/renderer/gl/WorkaroundsGL.h"
namespace gl
{
struct ContextState;
struct IndexRange;
}
namespace egl
{
class AttributeMap;
}
namespace sh
{
struct BlockMemberInfo;
}
namespace rx
{
class BlitGL;
class ContextImpl;
class FunctionsGL;
class StateManagerGL;
class RendererGL : angle::NonCopyable
{
public:
RendererGL(const FunctionsGL *functions, const egl::AttributeMap &attribMap);
~RendererGL();
ContextImpl *createContext(const gl::ContextState &state);
gl::Error flush();
gl::Error finish();
gl::Error drawArrays(const gl::ContextState &data, GLenum mode, GLint first, GLsizei count);
gl::Error drawArraysInstanced(const gl::ContextState &data,
GLenum mode,
GLint first,
GLsizei count,
GLsizei instanceCount);
gl::Error drawElements(const gl::ContextState &data,
GLenum mode,
GLsizei count,
GLenum type,
const GLvoid *indices,
const gl::IndexRange &indexRange);
gl::Error drawElementsInstanced(const gl::ContextState &data,
GLenum mode,
GLsizei count,
GLenum type,
const GLvoid *indices,
GLsizei instances,
const gl::IndexRange &indexRange);
gl::Error drawRangeElements(const gl::ContextState &data,
GLenum mode,
GLuint start,
GLuint end,
GLsizei count,
GLenum type,
const GLvoid *indices,
const gl::IndexRange &indexRange);
// EXT_debug_marker
void insertEventMarker(GLsizei length, const char *marker);
void pushGroupMarker(GLsizei length, const char *marker);
void popGroupMarker();
// lost device
void notifyDeviceLost();
bool isDeviceLost() const;
bool testDeviceLost();
bool testDeviceResettable();
std::string getVendorString() const;
std::string getRendererDescription() const;
GLint getGPUDisjoint();
GLint64 getTimestamp();
const gl::Version &getMaxSupportedESVersion() const;
const FunctionsGL *getFunctions() const { return mFunctions; }
StateManagerGL *getStateManager() const { return mStateManager; }
const WorkaroundsGL &getWorkarounds() const { return mWorkarounds; }
BlitGL *getBlitter() const { return mBlitter; }
const gl::Caps &getNativeCaps() const;
const gl::TextureCapsMap &getNativeTextureCaps() const;
const gl::Extensions &getNativeExtensions() const;
const gl::Limitations &getNativeLimitations() const;
private:
void ensureCapsInitialized() const;
void generateCaps(gl::Caps *outCaps,
gl::TextureCapsMap *outTextureCaps,
gl::Extensions *outExtensions,
gl::Limitations *outLimitations) const;
mutable gl::Version mMaxSupportedESVersion;
const FunctionsGL *mFunctions;
StateManagerGL *mStateManager;
BlitGL *mBlitter;
WorkaroundsGL mWorkarounds;
bool mHasDebugOutput;
// For performance debugging
bool mSkipDrawCalls;
mutable bool mCapsInitialized;
mutable gl::Caps mNativeCaps;
mutable gl::TextureCapsMap mNativeTextureCaps;
mutable gl::Extensions mNativeExtensions;
mutable gl::Limitations mNativeLimitations;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_GL_RENDERERGL_H_