shader: Add physical attributes commentaries

This commit is contained in:
ReinUsesLisp 2019-04-30 19:46:49 -03:00
parent c6f9e651b2
commit fe700e1856
4 changed files with 8 additions and 4 deletions

View file

@ -895,6 +895,8 @@ private:
target = GetRegister(gpr->GetIndex()); target = GetRegister(gpr->GetIndex());
} else if (const auto abuf = std::get_if<AbufNode>(dest)) { } else if (const auto abuf = std::get_if<AbufNode>(dest)) {
UNIMPLEMENTED_IF(abuf->IsPhysicalBuffer());
target = [&]() -> std::string { target = [&]() -> std::string {
switch (const auto attribute = abuf->GetIndex(); abuf->GetIndex()) { switch (const auto attribute = abuf->GetIndex(); abuf->GetIndex()) {
case Attribute::Index::Position: case Attribute::Index::Position:

View file

@ -253,7 +253,7 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) {
SetRegister(bb, instr.gpr0, fake_address); SetRegister(bb, instr.gpr0, fake_address);
// Signal the shader IR to declare all possible attributes and varyings // Signal the shader IR to declare all possible attributes and varyings
use_physical_attributes = true; uses_physical_attributes = true;
break; break;
} }
default: default:

View file

@ -95,7 +95,7 @@ Node ShaderIR::GetInputAttribute(Attribute::Index index, u64 element, Node buffe
} }
Node ShaderIR::GetPhysicalInputAttribute(Tegra::Shader::Register physical_address, Node buffer) { Node ShaderIR::GetPhysicalInputAttribute(Tegra::Shader::Register physical_address, Node buffer) {
use_physical_attributes = true; uses_physical_attributes = true;
return StoreNode(AbufNode(GetRegister(physical_address), buffer)); return StoreNode(AbufNode(GetRegister(physical_address), buffer));
} }

View file

@ -465,10 +465,12 @@ private:
/// Attribute buffer memory (known as attributes or varyings in GLSL terms) /// Attribute buffer memory (known as attributes or varyings in GLSL terms)
class AbufNode final { class AbufNode final {
public: public:
// Initialize for standard attributes (index is explicit).
explicit constexpr AbufNode(Tegra::Shader::Attribute::Index index, u32 element, explicit constexpr AbufNode(Tegra::Shader::Attribute::Index index, u32 element,
Node buffer = {}) Node buffer = {})
: buffer{buffer}, index{index}, element{element} {} : buffer{buffer}, index{index}, element{element} {}
// Initialize for physical attributes (index is a variable value).
explicit constexpr AbufNode(Node physical_address, Node buffer = {}) explicit constexpr AbufNode(Node physical_address, Node buffer = {})
: physical_address{physical_address}, buffer{buffer} {} : physical_address{physical_address}, buffer{buffer} {}
@ -618,7 +620,7 @@ public:
} }
bool HasPhysicalAttributes() const { bool HasPhysicalAttributes() const {
return use_physical_attributes; return uses_physical_attributes;
} }
const Tegra::Shader::Header& GetHeader() const { const Tegra::Shader::Header& GetHeader() const {
@ -885,7 +887,7 @@ private:
std::set<Sampler> used_samplers; std::set<Sampler> used_samplers;
std::array<bool, Tegra::Engines::Maxwell3D::Regs::NumClipDistances> used_clip_distances{}; std::array<bool, Tegra::Engines::Maxwell3D::Regs::NumClipDistances> used_clip_distances{};
std::map<GlobalMemoryBase, GlobalMemoryUsage> used_global_memory; std::map<GlobalMemoryBase, GlobalMemoryUsage> used_global_memory;
bool use_physical_attributes{}; // Shader uses AL2P or physical attribute read/writes bool uses_physical_attributes{}; // Shader uses AL2P or physical attribute read/writes
Tegra::Shader::Header header; Tegra::Shader::Header header;
}; };