porky11 / wgpu

fix some depth stencil stuff in advanced wrapper

By fabio.u.krapohl@fau.de on February 12, 2020
This patch is not signed.
7GPWnvmimjL33ngBPiXCqs3xhPGbuv4dPAgcuPMyex4p6S7Prj5WLcgBAuQXDK8QWLWZQmcZs3j8dTA8BVtXHFHP
This patch is in the following branches:
api-cleanup
master
In file init.sc
396
397

398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461

462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478

479
480

        redef-type RenderPipelineDescriptor
            inline (layout color_states color_states_length vertex_stage fragment_stage rasterization_state rest...)
            inline (layout color_states color_states_length vertex_stage fragment_stage rasterization_state depth_stencil_state rest...)
                static-assert (none? color_states_length) "Length not supported. Use an array type instead."
                let color_states color_states_length =
                    do
                        let ptr count =
                            static-if ((typeof color_states) == ColorStateDescriptor)
                                _
                                    reftoptr color_states
                                    1
                            else
                                to-pointer-count color_states
                        let ptr =
                            bitcast ptr (pointer native.ColorStateDescriptor)
                        _ ptr count
                _
                    layout =
                        'native layout
                    vertex_stage =
                        'native vertex_stage
                    fragment_stage =
                        reftoptr
                            'native fragment_stage
                    rasterization_state =
                        reftoptr
                            'native rasterization_state
                    color_states = color_states
                    color_states_length = color_states_length
                    depth_stencil_state =
                        reftoptr
                            'native depth_stencil_state
                    rest...

        redef-type ComputePipelineDescriptor
            inline (layout rest...)
                _
                    layout =
                        'native layout
                    rest...

        redef-type ProgrammableStageDescriptor
            inline (module rest...)
                _
                    module =
                        'native module
                    rest...

        redef-type VertexInputDescriptor
            inline (vertex_buffers rest...)
                _
                    call
                        va-join
                            static-if ((typeof vertex_buffers) == VertexBufferDescriptor)
                                _ 
                                    vertex_buffers = (reftoptr ('native vertex_buffers))
                                    vertex_buffers_length = 1
                            else
                                let ptr count =
                                    to-pointer-count vertex_buffers
                                _
                                    vertex_buffers = (bitcast ptr (pointer VertexBufferDescriptor_native))
                                    vertex_buffers_length = count
                        rest...

        redef-type RenderPassDescriptor
            inline (color_attachments rest...)
            inline (color_attachments depth_stencil_attachment)
                _
                    call
                        va-join
                            do
                                let ptr count =
                                    static-if ((typeof color_attachments) == RenderPassColorAttachmentDescriptor)
                                        _
                                            reftoptr color_attachments
                                            color_attachments_length = 1
                                    else
                                        to-pointer-count color_attachments
                                let ptr =
                                    bitcast ptr (pointer native.RenderPassColorAttachmentDescriptor)
                                _
                                    color_attachments = ptr
                                    color_attachments_length = count
                        rest...
                        depth_stencil_attachment = &depth_stencil_attachment
        locals;