def generate_shader_code(self):  # pylint: disable=too-many-branches

        content = "#pragma once\n\n"
        content += "// Autogenerated by the render pipeline\n"
        content += "// Do not edit! Your changes will be lost.\n\n"

        structs = {}
        inputs = []

        for input_name, handle in iteritems(self.ptas):
            parts = input_name.split(".")

            # Single input, simply add it to the input list
            if len(parts) == 1:
                inputs.append(self.pta_to_glsl_type(handle) + " " + input_name + ";")

            # Nested input, like scattering.sun_color
            elif len(parts) == 2:
                struct_name = parts[0]
                actual_input_name = parts[1]
                if struct_name in structs:
                    # Struct is already defined, add member definition
                    structs[struct_name].append(
                        self.pta_to_glsl_type(handle) + " " + actual_input_name + ";")
                else:
                    # Construct a new struct and add it to the list of inputs
                    inputs.append(struct_name + "_UBOSTRUCT " + struct_name + ";")
                    structs[struct_name] = [
                        self.pta_to_glsl_type(handle) + " " + actual_input_name + ";"
                    ]

            # Nested input, like scattering.some_setting.sun_color, not supported yet
            else:
                self.warn("Structure definition too nested, not supported (yet):", input_name)

        # Add structures
        for struct_name, members in iteritems(structs):
            content += "struct " + struct_name + "_UBOSTRUCT {\n"
            for member in members:
                content += " " * 4 + member + "\n"
            content += "};\n\n"

        # Add actual inputs
        if len(inputs) < 1:
            self.debug("No UBO inputs present for", self.name)
        else:
            if self.use_ubo:

                content += "layout(shared, binding={}) uniform {}_UBO {{\n".format(
                    self.bind_id, self.name)
                for ipt in inputs:
                    content += " " * 4 + ipt + "\n"
                content += "} " + self.name + ";\n"
            else:
                content += "uniform struct {\n"
                for ipt in inputs:
                    content += " " * 4 + ipt + "\n"
                content += "} " + self.name + ";\n"

        content += "\n"
        return content
Generates the GLSL shader code to use the UBO
dataset/ETHPy150Open tobspr/RenderPipeline/rpcore/util/shader_input_blocks.py/GroupedInputBlock.generate_shader_code