summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGLSL/Linker.cpp
blob: 50e7790a89c4fcc60e995f03b8d236abc134c48f (plain)
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
/*
 * Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibGLSL/Linker.h>

namespace GLSL {

ErrorOr<NonnullOwnPtr<LinkedShader>> Linker::link(Vector<ObjectFile const*> const&)
{
    // FIXME: implement this function
    m_messages = {};

    GPU::IR::Shader shader;

    auto input_name = TRY(String::from_utf8("input0"sv));
    auto output_name = TRY(String::from_utf8("output0"sv));
    TRY(shader.inputs.try_append({ move(input_name), GPU::IR::StorageType::Vector4 }));
    TRY(shader.outputs.try_append({ move(output_name), GPU::IR::StorageType::Vector4 }));
    GPU::IR::Instruction instruction {
        GPU::IR::Opcode::Move,
        { { GPU::IR::StorageLocation::Input, 0 } },
        { GPU::IR::StorageLocation::Output, 0 }
    };
    TRY(shader.instructions.try_append(instruction));

    return try_make<LinkedShader>(shader);
}

}