shaders: Address PR review feedback.

merge-requests/60/head
bunnei 2018-04-14 15:57:58 +07:00
parent eabeedf6af
commit e6224fec27
2 changed files with 9 additions and 7 deletions

@ -247,6 +247,7 @@ static_assert(sizeof(OpCode) == 0x8, "Incorrect structure size");
namespace std { namespace std {
// TODO(bunne): The below is forbidden by the C++ standard, but works fine. See #330.
template <> template <>
struct make_unsigned<Tegra::Shader::Attribute> { struct make_unsigned<Tegra::Shader::Attribute> {
using type = Tegra::Shader::Attribute; using type = Tegra::Shader::Attribute;
@ -281,7 +282,6 @@ enum class SubOp : u64 {
Rsq = 0x5, Rsq = 0x5,
}; };
#pragma pack(1)
union Instruction { union Instruction {
Instruction& operator=(const Instruction& instr) { Instruction& operator=(const Instruction& instr) {
hex = instr.hex; hex = instr.hex;

@ -448,17 +448,19 @@ private:
for (const auto& index : declr_input_attribute) { for (const auto& index : declr_input_attribute) {
// TODO(bunnei): Use proper number of elements for these // TODO(bunnei): Use proper number of elements for these
declarations.AddLine( declarations.AddLine("layout(location = " +
"layout(location = " + std::to_string(static_cast<u32>(index) - 8) + ") in vec4 " + std::to_string(static_cast<u32>(index) -
GetInputAttribute(index) + ";"); static_cast<u32>(Attribute::Index::Attribute_0)) +
") in vec4 " + GetInputAttribute(index) + ";");
} }
declarations.AddLine(""); declarations.AddLine("");
for (const auto& index : declr_output_attribute) { for (const auto& index : declr_output_attribute) {
// TODO(bunnei): Use proper number of elements for these // TODO(bunnei): Use proper number of elements for these
declarations.AddLine( declarations.AddLine("layout(location = " +
"layout(location = " + std::to_string(static_cast<u32>(index) - 8) + ") out vec4 " + std::to_string(static_cast<u32>(index) -
GetOutputAttribute(index) + ";"); static_cast<u32>(Attribute::Index::Attribute_0)) +
") out vec4 " + GetOutputAttribute(index) + ";");
} }
declarations.AddLine(""); declarations.AddLine("");
} }