mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-24 05:42:52 +00:00
Shaders: Implement depth writing in fragment shaders.
We'll write <last color output reg + 2> to gl_FragDepth.
This commit is contained in:
parent
c4ce7e456a
commit
e3bddf8137
|
@ -918,7 +918,6 @@ private:
|
|||
FragmentHeader header;
|
||||
std::memcpy(&header, program_code.data(), PROGRAM_HEADER_SIZE);
|
||||
|
||||
ASSERT_MSG(header.writes_depth == 0, "Depth write is unimplemented");
|
||||
ASSERT_MSG(header.writes_samplemask == 0, "Samplemask write is unimplemented");
|
||||
|
||||
// Write the color outputs using the data in the shader registers, disabled
|
||||
|
@ -935,6 +934,12 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (header.writes_depth) {
|
||||
// The depth output is always 2 registers after the last color output, and current_reg
|
||||
// already contains one past the last color register.
|
||||
shader.AddLine("gl_FragDepth = " + regs.GetRegisterAsFloat(current_reg + 1) + ';');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue