Debian Codegraph @

Sources/nCine/Graphics/RHI/PVR/PvrShader.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::PVR
11 {
12 /**
13 @brief Shader-object stub of the PVR backend
14
15 GX is fixed-function - the backend drives TEV configurations selected from the program's label and
16 the offline reflection instead of compiling GLSL - so this class carries no source and every
17 operation succeeds trivially. It exists only to satisfy the `RHI::Shader` contract alias.
18 */
19 class PvrShader
20 {
21 public:
22 /** @brief Compilation status of the shader (always @ref Status::Compiled for the PVR backend) */
23 enum class Status
24 {
25 NotCompiled,
26 CompilationFailed,
27 Compiled,
28 CompiledWithDeferredChecks
29 };
30
31 /** @brief When the compilation status is checked (irrelevant for the PVR backend) */
32 enum class ErrorChecking
33 {
34 Immediate,
35 Deferred
36 };
37
38 explicit PvrShader(std::uint32_t type)
39 : _type(type), _status(Status::Compiled) {}
40 PvrShader(std::uint32_t type, StringView filename)
41 : _type(type), _status(Status::Compiled) {
42 static_cast<void>(filename);
43 }
44
45 inline std::uint32_t GetGLHandle() const {
46 return 0;
47 }
48 inline Status GetStatus() const {
49 return _status;
50 }
51
52 bool LoadFromString(StringView string) {
53 static_cast<void>(string);
54 return true;
55 }
56 bool LoadFromStrings(ArrayView<const StringView> strings) {
57 static_cast<void>(strings);
58 return true;
59 }
60 bool LoadFromFile(StringView filename) {
61 static_cast<void>(filename);
62 return true;
63 }
64
65 bool Compile(ErrorChecking errorChecking, bool logOnErrors) {
66 static_cast<void>(errorChecking);
67 static_cast<void>(logOnErrors);
68 return true;
69 }
70 bool CheckCompilation(bool logOnErrors) {
71 static_cast<void>(logOnErrors);
72 return true;
73 }
74
75 void SetObjectLabel(StringView label) {
76 static_cast<void>(label);
77 }
78
79 private:
80 std::uint32_t _type;
81 Status _status;
82 };
83 }