| 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::GS |
| 11 |
{ |
| 12 |
/** |
| 13 |
@brief Shader-object stub of the GS backend |
| 14 |
|
| 15 |
The Graphics Synthesizer is fixed-function - it has one texture function and one blend equation per |
| 16 |
draw, and no programmable stage at all - so the backend dispatches the effect functions transpiled |
| 17 |
from the shaders' `fixed_function` blocks instead of compiling anything. This class carries no source |
| 18 |
and every operation succeeds trivially; it exists only to satisfy the `RHI::Shader` contract alias. |
| 19 |
*/ |
| 20 |
class GsShader |
| 21 |
{ |
| 22 |
public: |
| 23 |
/** @brief Compilation status of the shader (always @ref Status::Compiled for the GS backend) */ |
| 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 the GS backend) */ |
| 33 |
enum class ErrorChecking |
| 34 |
{ |
| 35 |
Immediate, |
| 36 |
Deferred |
| 37 |
}; |
| 38 |
|
| 39 |
explicit GsShader(std::uint32_t type) |
| 40 |
: _type(type), _status(Status::Compiled) {} |
| 41 |
GsShader(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 |
} |