@@ -75,6 +75,57 @@ class Backend {
7575
7676 }
7777
78+ /**
79+ * The coordinate system of the backend.
80+ *
81+ * @abstract
82+ * @type {Number }
83+ * @readonly
84+ */
85+ get coordinateSystem ( ) { }
86+
87+ // render context
88+
89+ /**
90+ * This method is executed at the beginning of a render call and
91+ * can be used by the backend to prepare the state for upcoming
92+ * draw calls.
93+ *
94+ * @abstract
95+ * @param {RenderContext } renderContext - The render context.
96+ */
97+ beginRender ( /*renderContext*/ ) { }
98+
99+ /**
100+ * This method is executed at the end of a render call and
101+ * can be used by the backend to finalize work after draw
102+ * calls.
103+ *
104+ * @abstract
105+ * @param {RenderContext } renderContext - The render context.
106+ */
107+ finishRender ( /*renderContext*/ ) { }
108+
109+ /**
110+ * This method is executed at the beginning of a compute call and
111+ * can be used by the backend to prepare the state for upcoming
112+ * compute tasks.
113+ *
114+ * @abstract
115+ * @param {Node|Array<Node> } computeGroup - The compute node(s).
116+ */
117+ beginCompute ( /*computeGroup*/ ) { }
118+
119+ /**
120+ * This method is executed at the end of a compute call and
121+ * can be used by the backend to finalize work after compute
122+ * tasks.
123+ *
124+ * @abstract
125+ * @param {Node|Array<Node> } computeGroup - The compute node(s).
126+ */
127+ finishCompute ( /*computeGroup*/ ) { }
128+
78129 // render object
79130
80131 /**
@@ -86,6 +137,19 @@ class Backend {
86137 */
87138 draw ( /*renderObject, info*/ ) { }
88139
140+ // compute node
141+
142+ /**
143+ * Executes a compute command for the given compute node.
144+ *
145+ * @abstract
146+ * @param {Node|Array<Node> } computeGroup - The group of compute nodes of a compute call. Can be a single compute node.
147+ * @param {Node } computeNode - The compute node.
148+ * @param {Array<BindGroup> } bindings - The bindings.
149+ * @param {ComputePipeline } computePipeline - The compute pipeline.
150+ */
151+ compute ( /*computeGroup, computeNode, computeBindings, computePipeline*/ ) { }
152+
89153 // program
90154
91155 /**
@@ -110,23 +174,31 @@ class Backend {
110174 * Creates bindings from the given bind group definition.
111175 *
112176 * @abstract
113- * @param {BindGroup } bingGroup - The bind group.
177+ * @param {BindGroup } bindGroup - The bind group.
114178 * @param {Array<BindGroup> } bindings - Array of bind groups.
115179 * @param {Number } cacheIndex - The cache index.
116180 * @param {Number } version - The version.
117181 */
118- createBindings ( /*bingGroup , bindings, cacheIndex, version*/ ) { }
182+ createBindings ( /*bindGroup , bindings, cacheIndex, version*/ ) { }
119183
120184 /**
121185 * Updates the given bind group definition.
122186 *
123187 * @abstract
124- * @param {BindGroup } bingGroup - The bind group.
188+ * @param {BindGroup } bindGroup - The bind group.
125189 * @param {Array<BindGroup> } bindings - Array of bind groups.
126190 * @param {Number } cacheIndex - The cache index.
127191 * @param {Number } version - The version.
128192 */
129- updateBindings ( /*bingGroup, bindings, cacheIndex, version*/ ) { }
193+ updateBindings ( /*bindGroup, bindings, cacheIndex, version*/ ) { }
194+
195+ /**
196+ * Updates a buffer binding.
197+ *
198+ * @abstract
199+ * @param {Buffer } binding - The buffer binding to update.
200+ */
201+ updateBinding ( /*binding*/ ) { }
130202
131203 // pipeline
132204
@@ -143,10 +215,10 @@ class Backend {
143215 * Creates a compute pipeline for the given compute node.
144216 *
145217 * @abstract
146- * @param {Node } computeNode - The compute node .
218+ * @param {ComputePipeline } computePipeline - The compute pipeline .
147219 * @param {Array<BindGroup> } bindings - The bindings.
148220 */
149- createComputePipeline ( /*computeNode , bindings*/ ) { }
221+ createComputePipeline ( /*computePipeline , bindings*/ ) { }
150222
151223 // cache key
152224
@@ -190,6 +262,14 @@ class Backend {
190262 */
191263 createSampler ( /*texture*/ ) { }
192264
265+ /**
266+ * Destroys the sampler for the given texture.
267+ *
268+ * @abstract
269+ * @param {Texture } texture - The texture to destroy the sampler for.
270+ */
271+ destroySampler ( /*texture*/ ) { }
272+
193273 /**
194274 * Creates a default texture for the given texture that can be used
195275 * as a placeholder until the actual texture is ready for usage.
@@ -217,6 +297,22 @@ class Backend {
217297 */
218298 updateTexture ( /*texture, options = {}*/ ) { }
219299
300+ /**
301+ * Generates mipmaps for the given texture
302+ *
303+ * @abstract
304+ * @param {Texture } texture - The texture.
305+ */
306+ generateMipmaps ( /*texture*/ ) { }
307+
308+ /**
309+ * Destroys the GPU data for the given texture object.
310+ *
311+ * @abstract
312+ * @param {Texture } texture - The texture.
313+ */
314+ destroyTexture ( /*texture*/ ) { }
315+
220316 /**
221317 * Returns texture data as a typed array.
222318 *
@@ -226,9 +322,32 @@ class Backend {
226322 * @param {Number } y - The y coordinate of the copy origin.
227323 * @param {Number } width - The width of the copy.
228324 * @param {Number } height - The height of the copy.
325+ * @param {Number } faceIndex - The face index.
229326 * @return {TypedArray } The texture data as a typed array.
230327 */
231- copyTextureToBuffer ( /*texture, x, y, width, height*/ ) { }
328+ copyTextureToBuffer ( /*texture, x, y, width, height, faceIndex*/ ) { }
329+
330+ /**
331+ * Copies data of the given source texture to the given destination texture.
332+ *
333+ * @abstract
334+ * @param {Texture } srcTexture - The source texture.
335+ * @param {Texture } dstTexture - The destination texture.
336+ * @param {Vector4? } [srcRegion=null] - The region of the source texture to copy.
337+ * @param {(Vector2|Vector3)? } [dstPosition=null] - The destination position of the copy.
338+ * @param {Number } [level=0] - The mip level to copy.
339+ */
340+ copyTextureToTexture ( /*srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0*/ ) { }
341+
342+ /**
343+ * Copies the current bound framebuffer to the given texture.
344+ *
345+ * @abstract
346+ * @param {Texture } texture - The destination texture.
347+ * @param {RenderContext } renderContext - The render context.
348+ * @param {Vector4 } rectangle - A four dimensional vector defining the origin and dimension of the copy.
349+ */
350+ copyFramebufferToTexture ( /*texture, renderContext, rectangle*/ ) { }
232351
233352 // attributes
234353
@@ -248,6 +367,14 @@ class Backend {
248367 */
249368 createIndexAttribute ( /*attribute*/ ) { }
250369
370+ /**
371+ * Creates the buffer of a storage attribute.
372+ *
373+ * @abstract
374+ * @param {BufferAttribute } attribute - The buffer attribute.
375+ */
376+ createStorageAttribute ( /*attribute*/ ) { }
377+
251378 /**
252379 * Updates the buffer of a shader attribute.
253380 *
@@ -282,8 +409,28 @@ class Backend {
282409 */
283410 updateSize ( ) { }
284411
412+ /**
413+ * Updates the viewport with the values from the given render context.
414+ *
415+ * @abstract
416+ * @param {RenderContext } renderContext - The render context.
417+ */
418+ updateViewport ( /*renderContext*/ ) { }
419+
285420 // utils
286421
422+ /**
423+ * Returns `true` if the given 3D object is fully occluded by other
424+ * 3D objects in the scene. Backends must implement this method by using
425+ * a Occlusion Query API.
426+ *
427+ * @abstract
428+ * @param {RenderContext } renderContext - The render context.
429+ * @param {Object3D } object - The 3D object to test.
430+ * @return {Boolean } Whether the 3D object is fully occluded or not.
431+ */
432+ isOccluded ( /*renderContext, object*/ ) { }
433+
287434 /**
288435 * Resolves the time stamp for the given render context and type.
289436 *
@@ -295,6 +442,16 @@ class Backend {
295442 */
296443 async resolveTimestampAsync ( /*renderContext, type*/ ) { }
297444
445+ /**
446+ * Can be used to synchronize CPU operations with GPU tasks. So when this method is called,
447+ * the CPU waits for the GPU to complete its operation (e.g. a compute task).
448+ *
449+ * @async
450+ * @abstract
451+ * @return {Promise } A Promise that resolves when synchronization has been finished.
452+ */
453+ async waitForGPU ( ) { }
454+
298455 /**
299456 * Checks if the given feature is supported by the backend.
300457 *
@@ -314,6 +471,14 @@ class Backend {
314471 */
315472 hasFeature ( /*name*/ ) { }
316473
474+ /**
475+ * Returns the maximum anisotropy texture filtering value.
476+ *
477+ * @abstract
478+ * @return {Number } The maximum anisotropy texture filtering value.
479+ */
480+ getMaxAnisotropy ( ) { }
481+
317482 /**
318483 * Returns the drawing buffer size.
319484 *
0 commit comments