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 WEBGLMETHODDISPATCHER_H_
7 #define WEBGLMETHODDISPATCHER_H_
9 #include "TexUnpackBlob.h"
10 #include "HostWebGLContext.h"
11 #include "WebGLQueueParamTraits.h"
15 template <size_t id
= 0>
16 class WebGLMethodDispatcher
17 : public EmptyMethodDispatcher
<WebGLMethodDispatcher
> {};
19 template <typename MethodT
, MethodT Method
>
22 #define DEFINE_METHOD_DISPATCHER(_ID, _METHOD) \
24 class WebGLMethodDispatcher<_ID> \
25 : public MethodDispatcher<WebGLMethodDispatcher, _ID, \
26 decltype(&_METHOD), &_METHOD> { \
28 static inline const char* Name() { return #_METHOD; } \
31 inline size_t IdByMethod<decltype(&_METHOD), &_METHOD>() { \
35 // Defines each method the WebGLMethodDispatcher handles. The COUNTER value
36 // is used as a cross-process ID for each of the methods.
37 #define DEFINE_ASYNC(_METHOD) DEFINE_METHOD_DISPATCHER(__COUNTER__, _METHOD)
39 DEFINE_ASYNC(HostWebGLContext::CreateBuffer
)
40 DEFINE_ASYNC(HostWebGLContext::CreateFramebuffer
)
41 DEFINE_ASYNC(HostWebGLContext::CreateProgram
)
42 DEFINE_ASYNC(HostWebGLContext::CreateQuery
)
43 DEFINE_ASYNC(HostWebGLContext::CreateRenderbuffer
)
44 DEFINE_ASYNC(HostWebGLContext::CreateSampler
)
45 DEFINE_ASYNC(HostWebGLContext::CreateShader
)
46 DEFINE_ASYNC(HostWebGLContext::CreateSync
)
47 DEFINE_ASYNC(HostWebGLContext::CreateTexture
)
48 DEFINE_ASYNC(HostWebGLContext::CreateTransformFeedback
)
49 DEFINE_ASYNC(HostWebGLContext::CreateVertexArray
)
51 DEFINE_ASYNC(HostWebGLContext::DeleteBuffer
)
52 DEFINE_ASYNC(HostWebGLContext::DeleteFramebuffer
)
53 DEFINE_ASYNC(HostWebGLContext::DeleteProgram
)
54 DEFINE_ASYNC(HostWebGLContext::DeleteQuery
)
55 DEFINE_ASYNC(HostWebGLContext::DeleteRenderbuffer
)
56 DEFINE_ASYNC(HostWebGLContext::DeleteSampler
)
57 DEFINE_ASYNC(HostWebGLContext::DeleteShader
)
58 DEFINE_ASYNC(HostWebGLContext::DeleteSync
)
59 DEFINE_ASYNC(HostWebGLContext::DeleteTexture
)
60 DEFINE_ASYNC(HostWebGLContext::DeleteTransformFeedback
)
61 DEFINE_ASYNC(HostWebGLContext::DeleteVertexArray
)
63 DEFINE_ASYNC(HostWebGLContext::SetEnabled
)
64 DEFINE_ASYNC(HostWebGLContext::GenerateError
)
65 DEFINE_ASYNC(HostWebGLContext::Resize
)
66 DEFINE_ASYNC(HostWebGLContext::RequestExtension
)
67 DEFINE_ASYNC(HostWebGLContext::DidRefresh
)
68 DEFINE_ASYNC(HostWebGLContext::AttachShader
)
69 DEFINE_ASYNC(HostWebGLContext::BindAttribLocation
)
70 DEFINE_ASYNC(HostWebGLContext::BindFramebuffer
)
71 DEFINE_ASYNC(HostWebGLContext::BlendColor
)
72 DEFINE_ASYNC(HostWebGLContext::BlendEquationSeparate
)
73 DEFINE_ASYNC(HostWebGLContext::BlendFuncSeparate
)
74 DEFINE_ASYNC(HostWebGLContext::Clear
)
75 DEFINE_ASYNC(HostWebGLContext::ClearColor
)
76 DEFINE_ASYNC(HostWebGLContext::ClearDepth
)
77 DEFINE_ASYNC(HostWebGLContext::ClearStencil
)
78 DEFINE_ASYNC(HostWebGLContext::ColorMask
)
79 DEFINE_ASYNC(HostWebGLContext::CompileShader
)
80 DEFINE_ASYNC(HostWebGLContext::CullFace
)
81 DEFINE_ASYNC(HostWebGLContext::DepthFunc
)
82 DEFINE_ASYNC(HostWebGLContext::DepthMask
)
83 DEFINE_ASYNC(HostWebGLContext::DepthRange
)
84 DEFINE_ASYNC(HostWebGLContext::DetachShader
)
85 DEFINE_ASYNC(HostWebGLContext::Flush
)
86 DEFINE_ASYNC(HostWebGLContext::FramebufferAttach
)
87 DEFINE_ASYNC(HostWebGLContext::FrontFace
)
88 DEFINE_ASYNC(HostWebGLContext::Hint
)
89 DEFINE_ASYNC(HostWebGLContext::LineWidth
)
90 DEFINE_ASYNC(HostWebGLContext::LinkProgram
)
91 DEFINE_ASYNC(HostWebGLContext::PolygonOffset
)
92 DEFINE_ASYNC(HostWebGLContext::ProvokingVertex
)
93 DEFINE_ASYNC(HostWebGLContext::Present
)
94 DEFINE_ASYNC(HostWebGLContext::SampleCoverage
)
95 DEFINE_ASYNC(HostWebGLContext::Scissor
)
96 DEFINE_ASYNC(HostWebGLContext::SetDrawingBufferColorSpace
)
97 DEFINE_ASYNC(HostWebGLContext::SetUnpackColorSpace
)
98 DEFINE_ASYNC(HostWebGLContext::ShaderSource
)
99 DEFINE_ASYNC(HostWebGLContext::StencilFuncSeparate
)
100 DEFINE_ASYNC(HostWebGLContext::StencilMaskSeparate
)
101 DEFINE_ASYNC(HostWebGLContext::StencilOpSeparate
)
102 DEFINE_ASYNC(HostWebGLContext::Viewport
)
103 DEFINE_ASYNC(HostWebGLContext::BindBuffer
)
104 DEFINE_ASYNC(HostWebGLContext::BindBufferRange
)
105 DEFINE_ASYNC(HostWebGLContext::CopyBufferSubData
)
106 DEFINE_ASYNC(HostWebGLContext::BufferData
)
107 DEFINE_ASYNC(HostWebGLContext::BufferData_SizeOnly
)
108 DEFINE_ASYNC(HostWebGLContext::BufferSubData
)
109 DEFINE_ASYNC(HostWebGLContext::BlitFramebuffer
)
110 DEFINE_ASYNC(HostWebGLContext::InvalidateFramebuffer
)
111 DEFINE_ASYNC(HostWebGLContext::InvalidateSubFramebuffer
)
112 DEFINE_ASYNC(HostWebGLContext::ReadBuffer
)
113 DEFINE_ASYNC(HostWebGLContext::RenderbufferStorageMultisample
)
114 DEFINE_ASYNC(HostWebGLContext::ActiveTexture
)
115 DEFINE_ASYNC(HostWebGLContext::BindTexture
)
116 DEFINE_ASYNC(HostWebGLContext::GenerateMipmap
)
117 DEFINE_ASYNC(HostWebGLContext::CopyTexImage
)
118 DEFINE_ASYNC(HostWebGLContext::TexStorage
)
119 DEFINE_ASYNC(HostWebGLContext::TexImage
)
120 DEFINE_ASYNC(HostWebGLContext::CompressedTexImage
)
121 DEFINE_ASYNC(HostWebGLContext::TexParameter_base
)
122 DEFINE_ASYNC(HostWebGLContext::UseProgram
)
123 DEFINE_ASYNC(HostWebGLContext::UniformData
)
124 DEFINE_ASYNC(HostWebGLContext::VertexAttrib4T
)
125 DEFINE_ASYNC(HostWebGLContext::VertexAttribDivisor
)
126 DEFINE_ASYNC(HostWebGLContext::UniformBlockBinding
)
127 DEFINE_ASYNC(HostWebGLContext::EnableVertexAttribArray
)
128 DEFINE_ASYNC(HostWebGLContext::DisableVertexAttribArray
)
129 DEFINE_ASYNC(HostWebGLContext::VertexAttribPointer
)
130 DEFINE_ASYNC(HostWebGLContext::ClearBufferTv
)
131 DEFINE_ASYNC(HostWebGLContext::ClearBufferfi
)
132 DEFINE_ASYNC(HostWebGLContext::ReadPixelsPbo
)
133 DEFINE_ASYNC(HostWebGLContext::BindSampler
)
134 DEFINE_ASYNC(HostWebGLContext::SamplerParameteri
)
135 DEFINE_ASYNC(HostWebGLContext::SamplerParameterf
)
136 DEFINE_ASYNC(HostWebGLContext::BindTransformFeedback
)
137 DEFINE_ASYNC(HostWebGLContext::BeginTransformFeedback
)
138 DEFINE_ASYNC(HostWebGLContext::EndTransformFeedback
)
139 DEFINE_ASYNC(HostWebGLContext::PauseTransformFeedback
)
140 DEFINE_ASYNC(HostWebGLContext::ResumeTransformFeedback
)
141 DEFINE_ASYNC(HostWebGLContext::TransformFeedbackVaryings
)
142 DEFINE_ASYNC(HostWebGLContext::DrawBuffers
)
143 DEFINE_ASYNC(HostWebGLContext::BindVertexArray
)
144 DEFINE_ASYNC(HostWebGLContext::DrawArraysInstanced
)
145 DEFINE_ASYNC(HostWebGLContext::DrawElementsInstanced
)
146 DEFINE_ASYNC(HostWebGLContext::BeginQuery
)
147 DEFINE_ASYNC(HostWebGLContext::EndQuery
)
148 DEFINE_ASYNC(HostWebGLContext::QueryCounter
)
149 DEFINE_ASYNC(HostWebGLContext::SetFramebufferIsInOpaqueRAF
)
150 DEFINE_ASYNC(HostWebGLContext::ClearVRSwapChain
)
151 DEFINE_ASYNC(HostWebGLContext::CopyToSwapChain
)
152 DEFINE_ASYNC(HostWebGLContext::EndOfFrame
)
155 #undef DEFINE_METHOD_DISPATCHER
157 } // namespace mozilla
159 #endif // WEBGLMETHODDISPATCHER_H_