Bug 1936278 - Prevent search mode chiclet from being dismissed when clicking in page...
[gecko.git] / dom / canvas / WebGLParent.h
blob523cc28cfc6dfcee854fb0af601d1b1acbda52a3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef WEBGLPARENT_H_
7 #define WEBGLPARENT_H_
9 #include "mozilla/GfxMessageUtils.h"
10 #include "mozilla/dom/ipc/IdType.h"
11 #include "mozilla/dom/PWebGLParent.h"
12 #include "mozilla/WeakPtr.h"
14 namespace mozilla {
16 class HostWebGLContext;
17 class WebGLChild;
19 namespace layers {
20 class SharedSurfacesHolder;
21 class SharedSurfaceTextureClient;
22 class SurfaceDescriptor;
23 } // namespace layers
25 namespace dom {
27 class WebGLParent : public PWebGLParent, public SupportsWeakPtr {
28 friend PWebGLParent;
30 public:
31 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebGLParent, override);
33 mozilla::ipc::IPCResult RecvInitialize(const webgl::InitContextDesc&,
34 webgl::InitContextResult* out);
36 WebGLParent(layers::SharedSurfacesHolder* aSharedSurfacesHolder,
37 const dom::ContentParentId& aContentId); // For IPDL
39 using IPCResult = mozilla::ipc::IPCResult;
41 template <class ResolveT>
42 IPCResult RecvPing(const ResolveT& Resolve) {
43 Resolve(void_t{});
44 return IPC_OK();
47 IPCResult RecvSyncPing() { return IPC_OK(); }
49 IPCResult RecvDispatchCommands(mozilla::ipc::BigBuffer&&, uint64_t);
50 IPCResult RecvTexImage(uint32_t level, uint32_t respecFormat,
51 const uvec3& offset, const webgl::PackingInfo&,
52 webgl::TexUnpackBlobDesc&&);
54 IPCResult RecvGetBufferSubData(GLenum target, uint64_t srcByteOffset,
55 uint64_t byteSize, mozilla::ipc::Shmem* ret);
56 IPCResult GetFrontBufferSnapshot(webgl::FrontBufferSnapshotIpc* ret,
57 IProtocol* aProtocol);
58 IPCResult RecvGetFrontBufferSnapshot(webgl::FrontBufferSnapshotIpc* ret);
59 IPCResult RecvReadPixels(const webgl::ReadPixelsDesc&,
60 ReadPixelsBuffer&& buffer,
61 webgl::ReadPixelsResultIpc* ret);
63 // -
65 using ObjectId = webgl::ObjectId;
67 IPCResult RecvCheckFramebufferStatus(GLenum target, GLenum* ret);
68 IPCResult RecvClientWaitSync(ObjectId id, GLbitfield flags, GLuint64 timeout,
69 GLenum* ret);
70 IPCResult RecvCreateOpaqueFramebuffer(ObjectId id,
71 const OpaqueFramebufferOptions&,
72 bool* ret);
73 IPCResult RecvDrawingBufferSize(uvec2* ret);
74 IPCResult RecvFinish();
75 IPCResult RecvGetBufferParameter(GLenum target, GLenum pname,
76 Maybe<double>* ret);
77 IPCResult RecvGetCompileResult(ObjectId id, webgl::CompileResult* ret);
78 IPCResult RecvGetError(GLenum* ret);
79 IPCResult RecvGetFragDataLocation(ObjectId id, const std::string& name,
80 GLint* ret);
81 IPCResult RecvGetFramebufferAttachmentParameter(ObjectId id,
82 GLenum attachment,
83 GLenum pname,
84 Maybe<double>* ret);
85 IPCResult RecvGetFrontBuffer(ObjectId fb, bool vr,
86 Maybe<layers::SurfaceDescriptor>* ret);
87 IPCResult RecvGetIndexedParameter(GLenum target, GLuint index,
88 Maybe<double>* ret);
89 IPCResult RecvGetInternalformatParameter(GLenum target, GLuint format,
90 GLuint pname,
91 Maybe<std::vector<int32_t>>* ret);
92 IPCResult RecvGetLinkResult(ObjectId id, webgl::LinkResult* ret);
93 IPCResult RecvGetNumber(GLenum pname, Maybe<double>* ret);
94 IPCResult RecvGetQueryParameter(ObjectId id, GLenum pname,
95 Maybe<double>* ret);
96 IPCResult RecvGetRenderbufferParameter(ObjectId id, GLenum pname,
97 Maybe<double>* ret);
98 IPCResult RecvGetSamplerParameter(ObjectId id, GLenum pname,
99 Maybe<double>* ret);
100 IPCResult RecvGetShaderPrecisionFormat(
101 GLenum shaderType, GLenum precisionType,
102 Maybe<webgl::ShaderPrecisionFormat>* ret);
103 IPCResult RecvGetString(GLenum pname, Maybe<std::string>* ret);
104 IPCResult RecvGetTexParameter(ObjectId id, GLenum pname, Maybe<double>* ret);
105 IPCResult RecvGetUniform(ObjectId id, uint32_t loc,
106 webgl::GetUniformData* ret);
107 IPCResult RecvGetVertexAttrib(GLuint index, GLenum pname, Maybe<double>* ret);
108 IPCResult RecvOnMemoryPressure();
109 IPCResult RecvValidateProgram(ObjectId id, bool* ret);
111 // -
113 const RefPtr<layers::SharedSurfacesHolder> mSharedSurfacesHolder;
114 const dom::ContentParentId mContentId;
116 private:
117 ~WebGLParent();
119 mozilla::ipc::IPCResult Recv__delete__() override;
121 void ActorDestroy(ActorDestroyReason aWhy) override;
123 mozilla::ipc::IPCResult RecvWaitForTxn(layers::RemoteTextureOwnerId aOwnerId,
124 layers::RemoteTextureTxnType aTxnType,
125 layers::RemoteTextureTxnId aTxnId);
127 UniquePtr<HostWebGLContext> mHost;
129 // Runnable that repeatedly processes our WebGL command queue
130 RefPtr<Runnable> mRunCommandsRunnable;
133 } // namespace dom
134 } // namespace mozilla
136 #endif // WEBGLPARENT_H_