Commit fb82b119 by Jamie Madill Committed by Commit Bot

EGL: Add const to several methods.

This is in preparatino for auto-generating the EGL validation header. The auto-generation script will force multiple parameters to const. Bug: angleproject:2621 Change-Id: I04e442c6ff118fd7c296341f12f442901f6fb8c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2552979Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 309bd3b6
...@@ -2614,7 +2614,7 @@ GLenum Context::getGraphicsResetStatus() ...@@ -2614,7 +2614,7 @@ GLenum Context::getGraphicsResetStatus()
return ToGLenum(mResetStatus); return ToGLenum(mResetStatus);
} }
bool Context::isResetNotificationEnabled() bool Context::isResetNotificationEnabled() const
{ {
return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT); return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
} }
......
...@@ -478,7 +478,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -478,7 +478,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
void setContextLost(); void setContextLost();
GLenum getGraphicsResetStrategy() const { return mResetStrategy; } GLenum getGraphicsResetStrategy() const { return mResetStrategy; }
bool isResetNotificationEnabled(); bool isResetNotificationEnabled() const;
const egl::Config *getConfig() const; const egl::Config *getConfig() const;
EGLenum getClientType() const; EGLenum getClientType() const;
......
...@@ -110,9 +110,9 @@ Error Device::getAttribute(EGLint attribute, EGLAttrib *value) ...@@ -110,9 +110,9 @@ Error Device::getAttribute(EGLint attribute, EGLAttrib *value)
return error; return error;
} }
EGLint Device::getType() EGLint Device::getType() const
{ {
return getImplementation()->getType(); return mImplementation.get()->getType();
} }
void Device::initDeviceExtensions() void Device::initDeviceExtensions()
......
...@@ -33,8 +33,8 @@ class Device final : public LabeledObject, angle::NonCopyable ...@@ -33,8 +33,8 @@ class Device final : public LabeledObject, angle::NonCopyable
EGLLabelKHR getLabel() const override; EGLLabelKHR getLabel() const override;
Error getAttribute(EGLint attribute, EGLAttrib *value); Error getAttribute(EGLint attribute, EGLAttrib *value);
Display *getOwningDisplay() { return mOwningDisplay; } Display *getOwningDisplay() const { return mOwningDisplay; }
EGLint getType(); EGLint getType() const;
const DeviceExtensions &getExtensions() const; const DeviceExtensions &getExtensions() const;
const std::string &getExtensionString() const; const std::string &getExtensionString() const;
......
...@@ -1750,7 +1750,7 @@ Error Display::validateImageClientBuffer(const gl::Context *context, ...@@ -1750,7 +1750,7 @@ Error Display::validateImageClientBuffer(const gl::Context *context,
return mImplementation->validateImageClientBuffer(context, target, clientBuffer, attribs); return mImplementation->validateImageClientBuffer(context, target, clientBuffer, attribs);
} }
Error Display::valdiatePixmap(Config *config, Error Display::valdiatePixmap(const Config *config,
EGLNativePixmapType pixmap, EGLNativePixmapType pixmap,
const AttributeMap &attributes) const const AttributeMap &attributes) const
{ {
......
...@@ -199,7 +199,7 @@ class Display final : public LabeledObject, ...@@ -199,7 +199,7 @@ class Display final : public LabeledObject,
EGLenum target, EGLenum target,
EGLClientBuffer clientBuffer, EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs) const; const egl::AttributeMap &attribs) const;
Error valdiatePixmap(Config *config, Error valdiatePixmap(const Config *config,
EGLNativePixmapType pixmap, EGLNativePixmapType pixmap,
const AttributeMap &attributes) const; const AttributeMap &attributes) const;
......
...@@ -237,7 +237,7 @@ bool Stream::isConsumerBoundToContext(const gl::Context *context) const ...@@ -237,7 +237,7 @@ bool Stream::isConsumerBoundToContext(const gl::Context *context) const
return (context == mContext); return (context == mContext);
} }
Error Stream::validateD3D11Texture(void *texture, const AttributeMap &attributes) const Error Stream::validateD3D11Texture(const void *texture, const AttributeMap &attributes) const
{ {
ASSERT(mConsumerType == ConsumerType::GLTextureRGB || ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
mConsumerType == ConsumerType::GLTextureYUV); mConsumerType == ConsumerType::GLTextureYUV);
......
...@@ -100,7 +100,7 @@ class Stream final : public LabeledObject, angle::NonCopyable ...@@ -100,7 +100,7 @@ class Stream final : public LabeledObject, angle::NonCopyable
bool isConsumerBoundToContext(const gl::Context *context) const; bool isConsumerBoundToContext(const gl::Context *context) const;
// Producer methods // Producer methods
Error validateD3D11Texture(void *texture, const AttributeMap &attributes) const; Error validateD3D11Texture(const void *texture, const AttributeMap &attributes) const;
Error postD3D11Texture(void *texture, const AttributeMap &attributes); Error postD3D11Texture(void *texture, const AttributeMap &attributes);
private: private:
......
...@@ -92,7 +92,7 @@ egl::Error DisplayImpl::validateImageClientBuffer(const gl::Context *context, ...@@ -92,7 +92,7 @@ egl::Error DisplayImpl::validateImageClientBuffer(const gl::Context *context,
return egl::EglBadDisplay() << "DisplayImpl::validateImageClientBuffer unimplemented."; return egl::EglBadDisplay() << "DisplayImpl::validateImageClientBuffer unimplemented.";
} }
egl::Error DisplayImpl::validatePixmap(egl::Config *config, egl::Error DisplayImpl::validatePixmap(const egl::Config *config,
EGLNativePixmapType pixmap, EGLNativePixmapType pixmap,
const egl::AttributeMap &attributes) const const egl::AttributeMap &attributes) const
{ {
......
...@@ -90,7 +90,7 @@ class DisplayImpl : public EGLImplFactory, public angle::Subject ...@@ -90,7 +90,7 @@ class DisplayImpl : public EGLImplFactory, public angle::Subject
EGLenum target, EGLenum target,
EGLClientBuffer clientBuffer, EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs) const; const egl::AttributeMap &attribs) const;
virtual egl::Error validatePixmap(egl::Config *config, virtual egl::Error validatePixmap(const egl::Config *config,
EGLNativePixmapType pixmap, EGLNativePixmapType pixmap,
const egl::AttributeMap &attributes) const; const egl::AttributeMap &attributes) const;
......
...@@ -23,7 +23,7 @@ class StreamProducerImpl : angle::NonCopyable ...@@ -23,7 +23,7 @@ class StreamProducerImpl : angle::NonCopyable
// Validates the ability for the producer to accept an arbitrary pointer to a frame. All // Validates the ability for the producer to accept an arbitrary pointer to a frame. All
// pointers should be validated through this function before being used to produce a frame. // pointers should be validated through this function before being used to produce a frame.
virtual egl::Error validateD3DTexture(void *pointer, virtual egl::Error validateD3DTexture(const void *pointer,
const egl::AttributeMap &attributes) const = 0; const egl::AttributeMap &attributes) const = 0;
// Constructs a frame from an arbitrary external pointer that points to producer specific frame // Constructs a frame from an arbitrary external pointer that points to producer specific frame
......
...@@ -112,10 +112,11 @@ StreamProducerD3DTexture::~StreamProducerD3DTexture() ...@@ -112,10 +112,11 @@ StreamProducerD3DTexture::~StreamProducerD3DTexture()
SafeRelease(mTexture); SafeRelease(mTexture);
} }
egl::Error StreamProducerD3DTexture::validateD3DTexture(void *pointer, egl::Error StreamProducerD3DTexture::validateD3DTexture(const void *pointer,
const egl::AttributeMap &attributes) const const egl::AttributeMap &attributes) const
{ {
ID3D11Texture2D *textureD3D = static_cast<ID3D11Texture2D *>(pointer); // We must remove the const qualifier because "GetDevice" and "GetDesc" are non-const in D3D11.
ID3D11Texture2D *textureD3D = static_cast<ID3D11Texture2D *>(const_cast<void *>(pointer));
// Check that the texture originated from our device // Check that the texture originated from our device
ID3D11Device *device; ID3D11Device *device;
......
...@@ -21,7 +21,7 @@ class StreamProducerD3DTexture : public StreamProducerImpl ...@@ -21,7 +21,7 @@ class StreamProducerD3DTexture : public StreamProducerImpl
StreamProducerD3DTexture(Renderer11 *renderer); StreamProducerD3DTexture(Renderer11 *renderer);
~StreamProducerD3DTexture() override; ~StreamProducerD3DTexture() override;
egl::Error validateD3DTexture(void *pointer, egl::Error validateD3DTexture(const void *pointer,
const egl::AttributeMap &attributes) const override; const egl::AttributeMap &attributes) const override;
void postD3DTexture(void *pointer, const egl::AttributeMap &attributes) override; void postD3DTexture(void *pointer, const egl::AttributeMap &attributes) override;
egl::Stream::GLTextureDescription getGLFrameDescription(int planeIndex) override; egl::Stream::GLTextureDescription getGLFrameDescription(int planeIndex) override;
......
...@@ -462,7 +462,7 @@ SurfaceImpl *DisplayGLX::createPixmapSurface(const egl::SurfaceState &state, ...@@ -462,7 +462,7 @@ SurfaceImpl *DisplayGLX::createPixmapSurface(const egl::SurfaceState &state,
return new PixmapSurfaceGLX(state, nativePixmap, mGLX.getDisplay(), mGLX, fbConfig); return new PixmapSurfaceGLX(state, nativePixmap, mGLX.getDisplay(), mGLX, fbConfig);
} }
egl::Error DisplayGLX::validatePixmap(egl::Config *config, egl::Error DisplayGLX::validatePixmap(const egl::Config *config,
EGLNativePixmapType pixmap, EGLNativePixmapType pixmap,
const egl::AttributeMap &attributes) const const egl::AttributeMap &attributes) const
{ {
......
...@@ -53,7 +53,7 @@ class DisplayGLX : public DisplayGL ...@@ -53,7 +53,7 @@ class DisplayGLX : public DisplayGL
NativePixmapType nativePixmap, NativePixmapType nativePixmap,
const egl::AttributeMap &attribs) override; const egl::AttributeMap &attribs) override;
egl::Error validatePixmap(egl::Config *config, egl::Error validatePixmap(const egl::Config *config,
EGLNativePixmapType pixmap, EGLNativePixmapType pixmap,
const egl::AttributeMap &attributes) const override; const egl::AttributeMap &attributes) const override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment