| 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::RSX |
| 11 |
{ |
| 12 |
/** |
| 13 |
@brief Shader-object stub of the RSX backend |
| 14 |
|
| 15 |
The RSX has no runtime shader compiler at all, so there is even less for this class to do than for |
| 16 |
its sceGxm counterpart: the microcode of every program variant is compiled offline by cgcomp and |
| 17 |
embedded in `Shaders/Generated/RsxGeneratedShaders.h`, and @ref RsxShaderProgram merely looks its |
| 18 |
pair up there and hands it to the GPU. This class therefore carries no source of its own and every |
| 19 |
operation succeeds trivially, only to satisfy the `RHI::Shader` contract alias. |
| 20 |
*/ |
| 21 |
class RsxShader |
| 22 |
{ |
| 23 |
public: |
| 24 |
/** @brief Compilation status of the shader (always @ref Status::Compiled for this stub) */ |
| 25 |
enum class Status |
| 26 |
{ |
| 27 |
NotCompiled, |
| 28 |
CompilationFailed, |
| 29 |
Compiled, |
| 30 |
CompiledWithDeferredChecks |
| 31 |
}; |
| 32 |
|
| 33 |
/** @brief When the compilation status is checked (irrelevant for this stub) */ |
| 34 |
enum class ErrorChecking |
| 35 |
{ |
| 36 |
Immediate, |
| 37 |
Deferred |
| 38 |
}; |
| 39 |
|
| 40 |
explicit RsxShader(std::uint32_t type) |
| 41 |
: _type(type), _status(Status::Compiled) {} |
| 42 |
RsxShader(std::uint32_t type, StringView filename) |
| 43 |
: _type(type), _status(Status::Compiled) { |
| 44 |
static_cast<void>(filename); |
| 45 |
} |
| 46 |
|
| 47 |
inline std::uint32_t GetGLHandle() const { |
| 48 |
return 0; |
| 49 |
} |
| 50 |
inline Status GetStatus() const { |
| 51 |
return _status; |
| 52 |
} |
| 53 |
|
| 54 |
bool LoadFromString(StringView string) { |
| 55 |
static_cast<void>(string); |
| 56 |
return true; |
| 57 |
} |
| 58 |
bool LoadFromStrings(ArrayView<const StringView> strings) { |
| 59 |
static_cast<void>(strings); |
| 60 |
return true; |
| 61 |
} |
| 62 |
bool LoadFromFile(StringView filename) { |
| 63 |
static_cast<void>(filename); |
| 64 |
return true; |
| 65 |
} |
| 66 |
|
| 67 |
bool Compile(ErrorChecking errorChecking, bool logOnErrors) { |
| 68 |
static_cast<void>(errorChecking); |
| 69 |
static_cast<void>(logOnErrors); |
| 70 |
return true; |
| 71 |
} |
| 72 |
bool CheckCompilation(bool logOnErrors) { |
| 73 |
static_cast<void>(logOnErrors); |
| 74 |
return true; |
| 75 |
} |
| 76 |
|
| 77 |
void SetObjectLabel(StringView label) { |
| 78 |
static_cast<void>(label); |
| 79 |
} |
| 80 |
|
| 81 |
private: |
| 82 |
std::uint32_t _type; |
| 83 |
Status _status; |
| 84 |
}; |
| 85 |
} |