Hash :
dfde6abf
Author :
Date :
2016-06-09T07:07:18
Context: Remove mutable gl::State getter. This will preserve layering - the API layer doesn't mutate the state directly, it passes the API call through to the Context. Is also removes the possiblity of any shenanigans of the Validation layer changing the GL state. Also, this CL refactors a few validation entry points to take ValidationContext instead of Context. ValidationContext will be the correct way to interact with the gl::Context in the Validation code. Finally, additional refactorings make ContextState a proper class with private data. This allows the ContextState itself to keep a mutable pointer to the gl::State, so ValidationContext can modify it if necessary (and it will be necessary for Framebuffer completeness caching). BUG=angleproject:1388 Change-Id: I86ab3561573caa9535c8d1b8aad4ab3d0e7cd470 Reviewed-on: https://chromium-review.googlesource.com/348954 Reviewed-by: Geoff Lang <geofflang@chromium.org> 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
//
// Copyright (c) 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.
//
// ContextState: Container class for all GL context state, caps and objects.
#ifndef LIBANGLE_CONTEXTSTATE_H_
#define LIBANGLE_CONTEXTSTATE_H_
#include "common/angleutils.h"
#include "libANGLE/State.h"
namespace gl
{
class ValidationContext;
class ContextState final : public angle::NonCopyable
{
public:
ContextState(uintptr_t context,
GLint clientVersion,
State *state,
const Caps &caps,
const TextureCapsMap &textureCaps,
const Extensions &extensions,
const ResourceManager *resourceManager,
const Limitations &limitations);
~ContextState();
uintptr_t getContext() const { return mContext; }
GLint getClientVersion() const { return mClientVersion; }
const State &getState() const { return *mState; }
const Caps &getCaps() const { return mCaps; }
const TextureCapsMap &getTextureCaps() const { return mTextureCaps; }
const Extensions &getExtensions() const { return mExtensions; }
const ResourceManager &getResourceManager() const { return *mResourceManager; }
const Limitations &getLimitations() const { return mLimitations; }
const TextureCaps &getTextureCap(GLenum internalFormat) const;
private:
friend class Context;
friend class ValidationContext;
uintptr_t mContext;
GLint mClientVersion;
State *mState;
const Caps &mCaps;
const TextureCapsMap &mTextureCaps;
const Extensions &mExtensions;
const ResourceManager *mResourceManager;
const Limitations &mLimitations;
};
class ValidationContext : angle::NonCopyable
{
public:
ValidationContext(GLint clientVersion,
State *state,
const Caps &caps,
const TextureCapsMap &textureCaps,
const Extensions &extensions,
const ResourceManager *resourceManager,
const Limitations &limitations,
bool skipValidation);
virtual ~ValidationContext() {}
virtual void handleError(const Error &error) = 0;
const ContextState &getContextState() const { return mState; }
int getClientVersion() const { return mState.getClientVersion(); }
const State &getGLState() const { return mState.getState(); }
const Caps &getCaps() const { return mState.getCaps(); }
const TextureCapsMap &getTextureCaps() const { return mState.getTextureCaps(); }
const Extensions &getExtensions() const { return mState.getExtensions(); }
const Limitations &getLimitations() const { return mState.getLimitations(); }
bool skipValidation() const { return mSkipValidation; }
// Specific methods needed for validation.
bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams);
bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams);
protected:
ContextState mState;
bool mSkipValidation;
};
} // namespace gl
#endif // LIBANGLE_CONTEXTSTATE_H_