mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-16 04:40:06 +00:00
gl_shader_decompiler: Allow vertex position to be used in fragment shader.
This commit is contained in:
parent
95144cc39c
commit
8d4899d6ea
@ -156,23 +156,27 @@ private:
|
|||||||
|
|
||||||
/// Generates code representing an input attribute register.
|
/// Generates code representing an input attribute register.
|
||||||
std::string GetInputAttribute(Attribute::Index attribute) {
|
std::string GetInputAttribute(Attribute::Index attribute) {
|
||||||
declr_input_attribute.insert(attribute);
|
switch (attribute) {
|
||||||
|
case Attribute::Index::Position:
|
||||||
|
return "position";
|
||||||
|
default:
|
||||||
const u32 index{static_cast<u32>(attribute) -
|
const u32 index{static_cast<u32>(attribute) -
|
||||||
static_cast<u32>(Attribute::Index::Attribute_0)};
|
static_cast<u32>(Attribute::Index::Attribute_0)};
|
||||||
if (attribute >= Attribute::Index::Attribute_0) {
|
if (attribute >= Attribute::Index::Attribute_0) {
|
||||||
|
declr_input_attribute.insert(attribute);
|
||||||
return "input_attribute_" + std::to_string(index);
|
return "input_attribute_" + std::to_string(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_CRITICAL(HW_GPU, "Unhandled input attribute: 0x%02x", index);
|
LOG_CRITICAL(HW_GPU, "Unhandled input attribute: 0x%02x", index);
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Generates code representing an output attribute register.
|
/// Generates code representing an output attribute register.
|
||||||
std::string GetOutputAttribute(Attribute::Index attribute) {
|
std::string GetOutputAttribute(Attribute::Index attribute) {
|
||||||
switch (attribute) {
|
switch (attribute) {
|
||||||
case Attribute::Index::Position:
|
case Attribute::Index::Position:
|
||||||
return "gl_Position";
|
return "position";
|
||||||
default:
|
default:
|
||||||
const u32 index{static_cast<u32>(attribute) -
|
const u32 index{static_cast<u32>(attribute) -
|
||||||
static_cast<u32>(Attribute::Index::Attribute_0)};
|
static_cast<u32>(Attribute::Index::Attribute_0)};
|
||||||
@ -381,12 +385,6 @@ private:
|
|||||||
}
|
}
|
||||||
case OpCode::Id::IPA: {
|
case OpCode::Id::IPA: {
|
||||||
const auto& attribute = instr.attribute.fmt28;
|
const auto& attribute = instr.attribute.fmt28;
|
||||||
|
|
||||||
if (attribute.index == Attribute::Index::Position) {
|
|
||||||
LOG_CRITICAL(HW_GPU, "Unimplemented");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string dest = GetRegister(instr.gpr0);
|
std::string dest = GetRegister(instr.gpr0);
|
||||||
SetDest(attribute.element, dest, GetInputAttribute(attribute.index), 1, 4);
|
SetDest(attribute.element, dest, GetInputAttribute(attribute.index), 1, 4);
|
||||||
break;
|
break;
|
||||||
|
@ -27,10 +27,13 @@ out gl_PerVertex {
|
|||||||
vec4 gl_Position;
|
vec4 gl_Position;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
out vec4 position;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
exec_shader();
|
exec_shader();
|
||||||
}
|
|
||||||
|
|
||||||
|
gl_Position = position;
|
||||||
|
}
|
||||||
)";
|
)";
|
||||||
out += program.first;
|
out += program.first;
|
||||||
return {out, program.second};
|
return {out, program.second};
|
||||||
@ -46,6 +49,7 @@ ProgramResult GenerateFragmentShader(const ShaderSetup& setup, const MaxwellFSCo
|
|||||||
.get_value_or({});
|
.get_value_or({});
|
||||||
out += R"(
|
out += R"(
|
||||||
|
|
||||||
|
in vec4 position;
|
||||||
out vec4 color;
|
out vec4 color;
|
||||||
|
|
||||||
uniform sampler2D tex[32];
|
uniform sampler2D tex[32];
|
||||||
|
Loading…
Reference in New Issue
Block a user