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/. */
9 #include "mozilla/GfxMessageUtils.h"
10 #include "mozilla/dom/PWebGLParent.h"
11 #include "mozilla/WeakPtr.h"
12 #include "mozilla/dom/IpdlQueue.h"
16 class HostWebGLContext
;
20 class SharedSurfaceTextureClient
;
21 class SurfaceDescriptor
;
26 class WebGLParent
: public PWebGLParent
, public SupportsWeakPtr
{
30 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebGLParent
, override
);
31 using OtherSideActor
= WebGLChild
;
33 mozilla::ipc::IPCResult
RecvInitialize(const webgl::InitContextDesc
&,
34 webgl::InitContextResult
* out
);
36 WebGLParent(); // For IPDL
38 using IPCResult
= mozilla::ipc::IPCResult
;
40 IPCResult
RecvDispatchCommands(mozilla::ipc::Shmem
&&, uint64_t);
42 IPCResult
RecvGetBufferSubData(GLenum target
, uint64_t srcByteOffset
,
43 uint64_t byteSize
, mozilla::ipc::Shmem
* ret
);
44 IPCResult
RecvGetFrontBufferSnapshot(webgl::FrontBufferSnapshotIpc
* ret
);
45 IPCResult
RecvReadPixels(const webgl::ReadPixelsDesc
&, uint64_t byteSize
,
46 webgl::ReadPixelsResultIpc
* ret
);
50 using ObjectId
= webgl::ObjectId
;
52 IPCResult
RecvCheckFramebufferStatus(GLenum target
, GLenum
* ret
);
53 IPCResult
RecvClientWaitSync(ObjectId id
, GLbitfield flags
, GLuint64 timeout
,
55 IPCResult
RecvCreateOpaqueFramebuffer(ObjectId id
,
56 const OpaqueFramebufferOptions
&,
58 IPCResult
RecvDrawingBufferSize(uvec2
* ret
);
59 IPCResult
RecvFinish();
60 IPCResult
RecvGetBufferParameter(GLenum target
, GLenum pname
,
62 IPCResult
RecvGetCompileResult(ObjectId id
, webgl::CompileResult
* ret
);
63 IPCResult
RecvGetError(GLenum
* ret
);
64 IPCResult
RecvGetFragDataLocation(ObjectId id
, const std::string
& name
,
66 IPCResult
RecvGetFramebufferAttachmentParameter(ObjectId id
,
70 IPCResult
RecvGetFrontBuffer(ObjectId fb
, bool vr
,
71 Maybe
<layers::SurfaceDescriptor
>* ret
);
72 IPCResult
RecvGetIndexedParameter(GLenum target
, GLuint index
,
74 IPCResult
RecvGetInternalformatParameter(GLenum target
, GLuint format
,
76 Maybe
<std::vector
<int32_t>>* ret
);
77 IPCResult
RecvGetLinkResult(ObjectId id
, webgl::LinkResult
* ret
);
78 IPCResult
RecvGetNumber(GLenum pname
, Maybe
<double>* ret
);
79 IPCResult
RecvGetQueryParameter(ObjectId id
, GLenum pname
,
81 IPCResult
RecvGetRenderbufferParameter(ObjectId id
, GLenum pname
,
83 IPCResult
RecvGetSamplerParameter(ObjectId id
, GLenum pname
,
85 IPCResult
RecvGetShaderPrecisionFormat(
86 GLenum shaderType
, GLenum precisionType
,
87 Maybe
<webgl::ShaderPrecisionFormat
>* ret
);
88 IPCResult
RecvGetString(GLenum pname
, Maybe
<std::string
>* ret
);
89 IPCResult
RecvGetTexParameter(ObjectId id
, GLenum pname
, Maybe
<double>* ret
);
90 IPCResult
RecvGetUniform(ObjectId id
, uint32_t loc
,
91 webgl::GetUniformData
* ret
);
92 IPCResult
RecvGetVertexAttrib(GLuint index
, GLenum pname
, Maybe
<double>* ret
);
93 IPCResult
RecvIsEnabled(GLenum cap
, bool* ret
);
94 IPCResult
RecvOnMemoryPressure();
95 IPCResult
RecvValidateProgram(ObjectId id
, bool* ret
);
102 mozilla::ipc::IPCResult
Recv__delete__() override
;
104 void ActorDestroy(ActorDestroyReason aWhy
) override
;
106 UniquePtr
<HostWebGLContext
> mHost
;
108 // Runnable that repeatedly processes our WebGL command queue
109 RefPtr
<Runnable
> mRunCommandsRunnable
;
113 } // namespace mozilla
115 #endif // WEBGLPARENT_H_