mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Shader_IR: Correct TLD4S Depth Compare.
This commit is contained in:
parent
af89723fa3
commit
c0ee0aa1a8
2 changed files with 16 additions and 9 deletions
|
@ -1091,7 +1091,8 @@ private:
|
||||||
expr += "Offset";
|
expr += "Offset";
|
||||||
}
|
}
|
||||||
expr += '(' + GetSampler(meta->sampler) + ", ";
|
expr += '(' + GetSampler(meta->sampler) + ", ";
|
||||||
expr += coord_constructors.at(count + (has_array ? 1 : 0) + (has_shadow && !sepparate_dc ? 1 : 0) - 1);
|
expr += coord_constructors.at(count + (has_array ? 1 : 0) +
|
||||||
|
(has_shadow && !sepparate_dc ? 1 : 0) - 1);
|
||||||
expr += '(';
|
expr += '(';
|
||||||
for (std::size_t i = 0; i < count; ++i) {
|
for (std::size_t i = 0; i < count; ++i) {
|
||||||
expr += Visit(operation[i]).AsFloat();
|
expr += Visit(operation[i]).AsFloat();
|
||||||
|
@ -1712,14 +1713,13 @@ private:
|
||||||
|
|
||||||
const auto type = meta->sampler.IsShadow() ? Type::Float : Type::Int;
|
const auto type = meta->sampler.IsShadow() ? Type::Float : Type::Int;
|
||||||
if (meta->sampler.IsShadow()) {
|
if (meta->sampler.IsShadow()) {
|
||||||
return {GenerateTexture(operation, "Gather",
|
return {GenerateTexture(operation, "Gather", {TextureAoffi{}}, true) +
|
||||||
{TextureAoffi{}}, true) +
|
|
||||||
GetSwizzle(meta->element),
|
GetSwizzle(meta->element),
|
||||||
Type::Float};
|
Type::Float};
|
||||||
} else {
|
} else {
|
||||||
return {GenerateTexture(operation, "Gather",
|
return {GenerateTexture(operation, "Gather",
|
||||||
{TextureAoffi{}, TextureArgument{type, meta->component}},
|
{TextureAoffi{}, TextureArgument{type, meta->component}},
|
||||||
true) +
|
false) +
|
||||||
GetSwizzle(meta->element),
|
GetSwizzle(meta->element),
|
||||||
Type::Float};
|
Type::Float};
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,8 +107,8 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OpCode::Id::TLD4S: {
|
case OpCode::Id::TLD4S: {
|
||||||
UNIMPLEMENTED_IF_MSG(instr.tld4s.UsesMiscMode(TextureMiscMode::AOFFI),
|
const bool uses_aoffi = instr.tld4s.UsesMiscMode(TextureMiscMode::AOFFI);
|
||||||
"AOFFI is not implemented");
|
UNIMPLEMENTED_IF_MSG(uses_aoffi, "AOFFI is not implemented");
|
||||||
|
|
||||||
const bool depth_compare = instr.tld4s.UsesMiscMode(TextureMiscMode::DC);
|
const bool depth_compare = instr.tld4s.UsesMiscMode(TextureMiscMode::DC);
|
||||||
const Node op_a = GetRegister(instr.gpr8);
|
const Node op_a = GetRegister(instr.gpr8);
|
||||||
|
@ -116,16 +116,23 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) {
|
||||||
|
|
||||||
// TODO(Subv): Figure out how the sampler type is encoded in the TLD4S instruction.
|
// TODO(Subv): Figure out how the sampler type is encoded in the TLD4S instruction.
|
||||||
std::vector<Node> coords;
|
std::vector<Node> coords;
|
||||||
|
Node dc_reg;
|
||||||
if (depth_compare) {
|
if (depth_compare) {
|
||||||
// Note: TLD4S coordinate encoding works just like TEXS's
|
// Note: TLD4S coordinate encoding works just like TEXS's
|
||||||
const Node op_y = GetRegister(instr.gpr8.Value() + 1);
|
const Node op_y = GetRegister(instr.gpr8.Value() + 1);
|
||||||
coords.push_back(op_a);
|
coords.push_back(op_a);
|
||||||
coords.push_back(op_y);
|
coords.push_back(op_y);
|
||||||
coords.push_back(op_b);
|
dc_reg = uses_aoffi ? GetRegister(instr.gpr20.Value() + 1) : op_b;
|
||||||
} else {
|
} else {
|
||||||
coords.push_back(op_a);
|
coords.push_back(op_a);
|
||||||
|
if (uses_aoffi) {
|
||||||
|
const Node op_y = GetRegister(instr.gpr8.Value() + 1);
|
||||||
|
coords.push_back(op_y);
|
||||||
|
} else {
|
||||||
coords.push_back(op_b);
|
coords.push_back(op_b);
|
||||||
}
|
}
|
||||||
|
dc_reg = {};
|
||||||
|
}
|
||||||
const Node component = Immediate(static_cast<u32>(instr.tld4s.component));
|
const Node component = Immediate(static_cast<u32>(instr.tld4s.component));
|
||||||
|
|
||||||
const SamplerInfo info{TextureType::Texture2D, false, depth_compare};
|
const SamplerInfo info{TextureType::Texture2D, false, depth_compare};
|
||||||
|
@ -134,7 +141,7 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) {
|
||||||
Node4 values;
|
Node4 values;
|
||||||
for (u32 element = 0; element < values.size(); ++element) {
|
for (u32 element = 0; element < values.size(); ++element) {
|
||||||
auto coords_copy = coords;
|
auto coords_copy = coords;
|
||||||
MetaTexture meta{sampler, {}, {}, {}, {}, {}, {}, component, element};
|
MetaTexture meta{sampler, {}, dc_reg, {}, {}, {}, {}, component, element};
|
||||||
values[element] = Operation(OperationCode::TextureGather, meta, std::move(coords_copy));
|
values[element] = Operation(OperationCode::TextureGather, meta, std::move(coords_copy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue