Debian Codegraph @

Sources/nCine/Graphics/RHI/GXM/GxmShader.h

raw
1 #pragma once
2
3 #include <cstdint>
4
5 #include <Containers/ArrayView.h>
6 #include <Containers/StringView.h>
7
8 using namespace Death::Containers;
9
10 namespace nCine::RHI::GXM
11 {
12 /**
13 @brief Shader-object stub of the sceGxm backend
14
15 The Cg stage sources of every program variant are generated offline into
16 `Shaders/Generated/CgGeneratedShaders.h` and compiled on the console by SceShaccCg when the program
17 links (see @ref GxmShaderProgram), so this class carries no source of its own and every operation
18 succeeds trivially, only to satisfy the `RHI::Shader` contract alias.
19 */
20 class GxmShader
21 {
22 public:
23 /** @brief Compilation status of the shader (always @ref Status::Compiled for this stub) */
24 enum class Status
25 {
26 NotCompiled,
27 CompilationFailed,
28 Compiled,
29 CompiledWithDeferredChecks
30 };
31
32 /** @brief When the compilation status is checked (irrelevant for this stub) */
33 enum class ErrorChecking
34 {
35 Immediate,
36 Deferred
37 };
38
39 explicit GxmShader(std::uint32_t type)
40 : _type(type), _status(Status::Compiled) {}
41 GxmShader(std::uint32_t type, StringView filename)
42 : _type(type), _status(Status::Compiled) {
43 static_cast<void>(filename);
44 }
45
46 inline std::uint32_t GetGLHandle() const {
47 return 0;
48 }
49 inline Status GetStatus() const {
50 return _status;
51 }
52
53 bool LoadFromString(StringView string) {
54 static_cast<void>(string);
55 return true;
56 }
57 bool LoadFromStrings(ArrayView<const StringView> strings) {
58 static_cast<void>(strings);
59 return true;
60 }
61 bool LoadFromFile(StringView filename) {
62 static_cast<void>(filename);
63 return true;
64 }
65
66 bool Compile(ErrorChecking errorChecking, bool logOnErrors) {
67 static_cast<void>(errorChecking);
68 static_cast<void>(logOnErrors);
69 return true;
70 }
71 bool CheckCompilation(bool logOnErrors) {
72 static_cast<void>(logOnErrors);
73 return true;
74 }
75
76 void SetObjectLabel(StringView label) {
77 static_cast<void>(label);
78 }
79
80 private:
81 std::uint32_t _type;
82 Status _status;
83 };
84 }