mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibGLSL: Add LibGLSL
This adds a new library, LibGLSL for parsing and compiling GLSL programs to LibGPU IR. Currently the compiler consists only of stubs.
This commit is contained in:
parent
5f0eb812ac
commit
67b2f8d68d
Notes:
sideshowbarker
2024-07-17 08:45:34 +09:00
Author: https://github.com/sunverwerth Commit: https://github.com/SerenityOS/serenity/commit/67b2f8d68d Pull-request: https://github.com/SerenityOS/serenity/pull/16225 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/supercomputer7
10 changed files with 139 additions and 1 deletions
|
@ -347,6 +347,7 @@ if (BUILD_LAGOM)
|
|||
Gemini
|
||||
Gfx
|
||||
GL
|
||||
GLSL
|
||||
GPU
|
||||
HTTP
|
||||
IMAP
|
||||
|
|
|
@ -23,6 +23,7 @@ add_subdirectory(LibFileSystemAccessClient)
|
|||
add_subdirectory(LibGemini)
|
||||
add_subdirectory(LibGfx)
|
||||
add_subdirectory(LibGL)
|
||||
add_subdirectory(LibGLSL)
|
||||
add_subdirectory(LibGPU)
|
||||
add_subdirectory(LibGUI)
|
||||
add_subdirectory(LibHTTP)
|
||||
|
|
|
@ -20,4 +20,4 @@ set(SOURCES
|
|||
)
|
||||
|
||||
serenity_lib(LibGL gl)
|
||||
target_link_libraries(LibGL PRIVATE LibCore LibGfx LibGPU)
|
||||
target_link_libraries(LibGL PRIVATE LibCore LibGfx LibGLSL LibGPU)
|
||||
|
|
7
Userland/Libraries/LibGLSL/CMakeLists.txt
Normal file
7
Userland/Libraries/LibGLSL/CMakeLists.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
set(SOURCES
|
||||
Compiler.cpp
|
||||
Linker.cpp
|
||||
)
|
||||
|
||||
serenity_lib(LibGLSL glsl)
|
||||
target_link_libraries(LibGLSL PRIVATE LibGPU)
|
18
Userland/Libraries/LibGLSL/Compiler.cpp
Normal file
18
Userland/Libraries/LibGLSL/Compiler.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGLSL/Compiler.h>
|
||||
|
||||
namespace GLSL {
|
||||
|
||||
ErrorOr<NonnullOwnPtr<ObjectFile>> Compiler::compile(Vector<String> const&)
|
||||
{
|
||||
// FIXME: implement this function
|
||||
m_messages = TRY(String::from_utf8(""sv));
|
||||
return adopt_own(*new ObjectFile());
|
||||
}
|
||||
|
||||
}
|
27
Userland/Libraries/LibGLSL/Compiler.h
Normal file
27
Userland/Libraries/LibGLSL/Compiler.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGLSL/ObjectFile.h>
|
||||
|
||||
namespace GLSL {
|
||||
|
||||
class Compiler final {
|
||||
public:
|
||||
ErrorOr<NonnullOwnPtr<ObjectFile>> compile(Vector<String> const& sources);
|
||||
|
||||
String messages() const { return m_messages; }
|
||||
|
||||
private:
|
||||
String m_messages;
|
||||
};
|
||||
|
||||
}
|
22
Userland/Libraries/LibGLSL/LinkedShader.h
Normal file
22
Userland/Libraries/LibGLSL/LinkedShader.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGLSL/ObjectFile.h>
|
||||
|
||||
namespace GLSL {
|
||||
|
||||
// FIXME: Implement this class
|
||||
|
||||
class LinkedShader final {
|
||||
};
|
||||
|
||||
}
|
18
Userland/Libraries/LibGLSL/Linker.cpp
Normal file
18
Userland/Libraries/LibGLSL/Linker.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* 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 = TRY(String::from_utf8(""sv));
|
||||
return adopt_own(*new LinkedShader());
|
||||
}
|
||||
|
||||
}
|
28
Userland/Libraries/LibGLSL/Linker.h
Normal file
28
Userland/Libraries/LibGLSL/Linker.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGLSL/LinkedShader.h>
|
||||
#include <LibGLSL/ObjectFile.h>
|
||||
|
||||
namespace GLSL {
|
||||
|
||||
class Linker final {
|
||||
public:
|
||||
ErrorOr<NonnullOwnPtr<LinkedShader>> link(Vector<ObjectFile const*> const&);
|
||||
|
||||
String messages() const { return m_messages; }
|
||||
|
||||
private:
|
||||
String m_messages;
|
||||
};
|
||||
|
||||
}
|
16
Userland/Libraries/LibGLSL/ObjectFile.h
Normal file
16
Userland/Libraries/LibGLSL/ObjectFile.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace GLSL {
|
||||
|
||||
// FIXME: Implement this class
|
||||
|
||||
class ObjectFile final {
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue