From fe700e1856fa078ba0fc93ced8576f5023f3146a Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Tue, 30 Apr 2019 19:46:49 -0300 Subject: shader: Add physical attributes commentaries --- src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 2 ++ src/video_core/shader/decode/memory.cpp | 2 +- src/video_core/shader/shader_ir.cpp | 2 +- src/video_core/shader/shader_ir.h | 6 ++++-- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 47bfa5538..52552333f 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -895,6 +895,8 @@ private: target = GetRegister(gpr->GetIndex()); } else if (const auto abuf = std::get_if(dest)) { + UNIMPLEMENTED_IF(abuf->IsPhysicalBuffer()); + target = [&]() -> std::string { switch (const auto attribute = abuf->GetIndex(); abuf->GetIndex()) { case Attribute::Index::Position: diff --git a/src/video_core/shader/decode/memory.cpp b/src/video_core/shader/decode/memory.cpp index 339692295..c4f68f8ab 100644 --- a/src/video_core/shader/decode/memory.cpp +++ b/src/video_core/shader/decode/memory.cpp @@ -253,7 +253,7 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { SetRegister(bb, instr.gpr0, fake_address); // Signal the shader IR to declare all possible attributes and varyings - use_physical_attributes = true; + uses_physical_attributes = true; break; } default: diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cpp index 947a372a2..691d095c8 100644 --- a/src/video_core/shader/shader_ir.cpp +++ b/src/video_core/shader/shader_ir.cpp @@ -95,7 +95,7 @@ Node ShaderIR::GetInputAttribute(Attribute::Index index, u64 element, Node buffe } 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)); } diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h index a4bb0c41c..7e54f7e74 100644 --- a/src/video_core/shader/shader_ir.h +++ b/src/video_core/shader/shader_ir.h @@ -465,10 +465,12 @@ private: /// Attribute buffer memory (known as attributes or varyings in GLSL terms) class AbufNode final { public: + // Initialize for standard attributes (index is explicit). explicit constexpr AbufNode(Tegra::Shader::Attribute::Index index, u32 element, Node buffer = {}) : buffer{buffer}, index{index}, element{element} {} + // Initialize for physical attributes (index is a variable value). explicit constexpr AbufNode(Node physical_address, Node buffer = {}) : physical_address{physical_address}, buffer{buffer} {} @@ -618,7 +620,7 @@ public: } bool HasPhysicalAttributes() const { - return use_physical_attributes; + return uses_physical_attributes; } const Tegra::Shader::Header& GetHeader() const { @@ -885,7 +887,7 @@ private: std::set used_samplers; std::array used_clip_distances{}; std::map 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; }; -- cgit v1.2.3