mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-24 12:26:26 -05:00
ShaderGen: Register id 255 is special and is hardcoded to return 0 (SR_ZERO).
This commit is contained in:
parent
2e0a9f66a0
commit
d03fc77475
2 changed files with 5 additions and 0 deletions
|
@ -13,6 +13,9 @@ namespace Tegra {
|
||||||
namespace Shader {
|
namespace Shader {
|
||||||
|
|
||||||
struct Register {
|
struct Register {
|
||||||
|
// Register 255 is special cased to always be 0
|
||||||
|
static constexpr size_t ZeroIndex = 255;
|
||||||
|
|
||||||
constexpr Register() = default;
|
constexpr Register() = default;
|
||||||
|
|
||||||
constexpr Register(u64 value) : value(value) {}
|
constexpr Register(u64 value) : value(value) {}
|
||||||
|
|
|
@ -220,6 +220,8 @@ private:
|
||||||
|
|
||||||
/// Generates code representing a temporary (GPR) register.
|
/// Generates code representing a temporary (GPR) register.
|
||||||
std::string GetRegister(const Register& reg, unsigned elem = 0) {
|
std::string GetRegister(const Register& reg, unsigned elem = 0) {
|
||||||
|
if (reg == Register::ZeroIndex)
|
||||||
|
return "0";
|
||||||
if (stage == Maxwell3D::Regs::ShaderStage::Fragment && reg < 4) {
|
if (stage == Maxwell3D::Regs::ShaderStage::Fragment && reg < 4) {
|
||||||
// GPRs 0-3 are output color for the fragment shader
|
// GPRs 0-3 are output color for the fragment shader
|
||||||
return std::string{"color."} + "rgba"[(reg + elem) & 3];
|
return std::string{"color."} + "rgba"[(reg + elem) & 3];
|
||||||
|
|
Loading…
Reference in a new issue