File: GL_Mesh_Zoo.py

package info (click to toggle)
renderdoc 1.11%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 93,988 kB
  • sloc: cpp: 662,188; ansic: 350,046; python: 22,871; xml: 14,473; java: 11,365; cs: 7,181; makefile: 6,703; yacc: 5,682; ruby: 4,648; perl: 3,461; sh: 2,277; php: 2,119; lisp: 1,835; javascript: 1,524; tcl: 1,068; ml: 747
file content (95 lines) | stat: -rw-r--r-- 3,362 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import rdtest
import renderdoc as rd


class GL_Mesh_Zoo(rdtest.TestCase):
    demos_test_name = 'GL_Mesh_Zoo'

    def __init__(self):
        rdtest.TestCase.__init__(self)
        self.zoo_helper = rdtest.Mesh_Zoo()

    def check_capture(self):
        self.zoo_helper.check_capture(self.capture_filename, self.controller)

        # Test GL-only thing with geometry shader only and completely no-op vertex shader
        draw = self.zoo_helper.find_draw("Geom Only").next
        self.controller.SetFrameEvent(draw.eventId, False)

        pos: rd.MeshFormat = self.controller.GetPostVSData(0, 0, rd.MeshDataStage.VSOut)

        # vertex output should be completely empty
        self.check(pos.vertexByteStride == 0)
        self.check(pos.numIndices == 0)
        self.check(self.controller.GetBufferData(pos.vertexResourceId, 0, 0) == bytes())

        gsout_ref = {
            0: {
                'gl_Position': [-0.4, -0.4, 0.5, 1.0],
                'col': [1.0, 0.0, 0.0, 1.0],
            },
            1: {
                'gl_Position': [0.6, -0.6, 0.5, 1.0],
                'col': [1.0, 0.0, 0.0, 1.0],
            },
            2: {
                'gl_Position': [-0.5, 0.5, 0.5, 1.0],
                'col': [1.0, 0.0, 0.0, 1.0],
            },
        }

        self.check_mesh_data(gsout_ref, self.get_postvs(draw, rd.MeshDataStage.GSOut))

        # Test GL-only thing with geometry shader only and completely no-op vertex shader
        multibase = self.zoo_helper.find_draw("Multi Draw").next.parent
        self.controller.SetFrameEvent(multibase.children[-1].eventId, False)

        baseVertex = [10, 11]
        baseInstance = [20, 22]

        for d, draw in enumerate(multibase.children):
            draw: rd.DrawcallDescription

            self.controller.SetFrameEvent(draw.eventId, False)

            pipe: rd.PipeState = self.controller.GetPipelineState()

            shad: rd.ShaderReflection = pipe.GetShaderReflection(rd.ShaderStage.Vertex)

            builtins = [sig.systemValue for sig in shad.inputSignature if sig.systemValue != rd.ShaderBuiltin.Undefined]

            self.check(rd.ShaderBuiltin.BaseInstance in builtins)
            self.check(rd.ShaderBuiltin.BaseVertex in builtins)
            self.check(rd.ShaderBuiltin.DrawIndex in builtins)

            bv = baseVertex[d]
            bi = baseInstance[d]

            for inst in range(draw.numInstances):
                multi_ref = {
                    0: {
                        'basevtx': bv,
                        'baseinst': bi,
                        'inst': inst,
                        'draw': d,
                        'vert': bv + 0,
                    },
                    1: {
                        'basevtx': bv,
                        'baseinst': bi,
                        'inst': inst,
                        'draw': d,
                        'vert': bv + 1,
                    },
                    2: {
                        'basevtx': bv,
                        'baseinst': bi,
                        'inst': inst,
                        'draw': d,
                        'vert': bv + 2,
                    },
                }

                self.check_mesh_data(multi_ref, self.get_postvs(draw, rd.MeshDataStage.VSOut, instance=inst))

        rdtest.log.success("Multi-draw pass is as expected")