@@ -303,4 +303,220 @@ public static bgfx.AttribType GetBGFXVertexAttributeType(VertexAttributeType typ
303303 _ => bgfx . AttribType . Float ,
304304 } ;
305305 }
306+
307+ public static RenderBufferFlags GetRenderBufferFlags ( bgfx . BufferFlags flags )
308+ {
309+ var outValue = RenderBufferFlags . None ;
310+
311+ if ( flags . HasFlag ( bgfx . BufferFlags . Index32 ) )
312+ {
313+ outValue |= RenderBufferFlags . Index32 ;
314+ }
315+
316+ if ( flags . HasFlag ( bgfx . BufferFlags . AllowResize ) )
317+ {
318+ outValue |= RenderBufferFlags . AllowResize ;
319+ }
320+
321+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeFormat8x1 ) )
322+ {
323+ outValue |= RenderBufferFlags . Compute8x1 ;
324+ }
325+
326+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeFormat8x2 ) )
327+ {
328+ outValue |= RenderBufferFlags . Compute8x2 ;
329+ }
330+
331+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeFormat8x4 ) )
332+ {
333+ outValue |= RenderBufferFlags . Compute8x4 ;
334+ }
335+
336+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeFormat16x1 ) )
337+ {
338+ outValue |= RenderBufferFlags . Compute16x1 ;
339+ }
340+
341+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeFormat16x2 ) )
342+ {
343+ outValue |= RenderBufferFlags . Compute16x2 ;
344+ }
345+
346+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeFormat16x4 ) )
347+ {
348+ outValue |= RenderBufferFlags . Compute16x4 ;
349+ }
350+
351+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeFormat32x1 ) )
352+ {
353+ outValue |= RenderBufferFlags . Compute32x1 ;
354+ }
355+
356+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeFormat32x2 ) )
357+ {
358+ outValue |= RenderBufferFlags . Compute32x2 ;
359+ }
360+
361+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeFormat32x4 ) )
362+ {
363+ outValue |= RenderBufferFlags . Compute32x4 ;
364+ }
365+
366+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeTypeInt ) )
367+ {
368+ outValue |= RenderBufferFlags . ComputeTypeInt ;
369+ }
370+
371+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeTypeUint ) )
372+ {
373+ outValue |= RenderBufferFlags . ComputeTypeUInt ;
374+ }
375+
376+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeTypeFloat ) )
377+ {
378+ outValue |= RenderBufferFlags . ComputeTypeFloat ;
379+ }
380+
381+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeWrite ) )
382+ {
383+ outValue |= RenderBufferFlags . ComputeWrite ;
384+ }
385+
386+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeRead ) )
387+ {
388+ outValue |= RenderBufferFlags . ComputeRead ;
389+ }
390+
391+ if ( flags . HasFlag ( bgfx . BufferFlags . ComputeReadWrite ) )
392+ {
393+ outValue |= RenderBufferFlags . ComputeReadWrite ;
394+ }
395+
396+ if ( flags . HasFlag ( bgfx . BufferFlags . DrawIndirect ) )
397+ {
398+ outValue |= RenderBufferFlags . DrawIndirect ;
399+ }
400+
401+ return outValue ;
402+ }
403+
404+ public static bgfx . BufferFlags GetBGFXBufferFlags ( RenderBufferFlags flags )
405+ {
406+ var outValue = bgfx . BufferFlags . None ;
407+
408+ if ( flags . HasFlag ( RenderBufferFlags . Index32 ) )
409+ {
410+ outValue |= bgfx . BufferFlags . Index32 ;
411+ }
412+
413+ if ( flags . HasFlag ( RenderBufferFlags . AllowResize ) )
414+ {
415+ outValue |= bgfx . BufferFlags . AllowResize ;
416+ }
417+
418+ if ( flags . HasFlag ( RenderBufferFlags . Compute8x1 ) )
419+ {
420+ outValue |= bgfx . BufferFlags . ComputeFormat8x1 ;
421+ }
422+
423+ if ( flags . HasFlag ( RenderBufferFlags . Compute8x2 ) )
424+ {
425+ outValue |= bgfx . BufferFlags . ComputeFormat8x2 ;
426+ }
427+
428+ if ( flags . HasFlag ( RenderBufferFlags . Compute8x4 ) )
429+ {
430+ outValue |= bgfx . BufferFlags . ComputeFormat8x4 ;
431+ }
432+
433+ if ( flags . HasFlag ( RenderBufferFlags . Compute16x1 ) )
434+ {
435+ outValue |= bgfx . BufferFlags . ComputeFormat16x1 ;
436+ }
437+
438+ if ( flags . HasFlag ( RenderBufferFlags . Compute16x2 ) )
439+ {
440+ outValue |= bgfx . BufferFlags . ComputeFormat16x2 ;
441+ }
442+
443+ if ( flags . HasFlag ( RenderBufferFlags . Compute16x4 ) )
444+ {
445+ outValue |= bgfx . BufferFlags . ComputeFormat16x4 ;
446+ }
447+
448+ if ( flags . HasFlag ( RenderBufferFlags . Compute32x1 ) )
449+ {
450+ outValue |= bgfx . BufferFlags . ComputeFormat32x1 ;
451+ }
452+
453+ if ( flags . HasFlag ( RenderBufferFlags . Compute32x2 ) )
454+ {
455+ outValue |= bgfx . BufferFlags . ComputeFormat32x2 ;
456+ }
457+
458+ if ( flags . HasFlag ( RenderBufferFlags . Compute32x4 ) )
459+ {
460+ outValue |= bgfx . BufferFlags . ComputeFormat32x4 ;
461+ }
462+
463+ if ( flags . HasFlag ( RenderBufferFlags . ComputeTypeInt ) )
464+ {
465+ outValue |= bgfx . BufferFlags . ComputeTypeInt ;
466+ }
467+
468+ if ( flags . HasFlag ( RenderBufferFlags . ComputeTypeUInt ) )
469+ {
470+ outValue |= bgfx . BufferFlags . ComputeTypeUint ;
471+ }
472+
473+ if ( flags . HasFlag ( RenderBufferFlags . ComputeTypeFloat ) )
474+ {
475+ outValue |= bgfx . BufferFlags . ComputeTypeFloat ;
476+ }
477+
478+ if ( flags . HasFlag ( RenderBufferFlags . ComputeWrite ) )
479+ {
480+ outValue |= bgfx . BufferFlags . ComputeWrite ;
481+ }
482+
483+ if ( flags . HasFlag ( RenderBufferFlags . ComputeRead ) )
484+ {
485+ outValue |= bgfx . BufferFlags . ComputeRead ;
486+ }
487+
488+ if ( flags . HasFlag ( RenderBufferFlags . ComputeReadWrite ) )
489+ {
490+ outValue |= bgfx . BufferFlags . ComputeReadWrite ;
491+ }
492+
493+ if ( flags . HasFlag ( RenderBufferFlags . DrawIndirect ) )
494+ {
495+ outValue |= bgfx . BufferFlags . DrawIndirect ;
496+ }
497+
498+ return outValue ;
499+ }
500+
501+ public static Access GetAccess ( bgfx . Access access )
502+ {
503+ return access switch
504+ {
505+ bgfx . Access . Read => Access . Read ,
506+ bgfx . Access . Write => Access . Write ,
507+ bgfx . Access . ReadWrite => Access . ReadWrite ,
508+ _ => Access . Read ,
509+ } ;
510+ }
511+
512+ public static bgfx . Access GetBGFXAccess ( Access access )
513+ {
514+ return access switch
515+ {
516+ Access . Read => bgfx . Access . Read ,
517+ Access . Write => bgfx . Access . Write ,
518+ Access . ReadWrite => bgfx . Access . ReadWrite ,
519+ _ => bgfx . Access . Read ,
520+ } ;
521+ }
306522}
0 commit comments