yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Merge pull request #1132 from Subv/gl_FragDepth

Shaders: Implement depth writing in fragment shaders.
This commit is contained in:
bunnei 2018-08-21 01:17:53 -04:00 committed by GitHub
commit b0f7713fce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -918,7 +918,6 @@ private:
FragmentHeader header; FragmentHeader header;
std::memcpy(&header, program_code.data(), PROGRAM_HEADER_SIZE); 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"); ASSERT_MSG(header.writes_samplemask == 0, "Samplemask write is unimplemented");
// Write the color outputs using the data in the shader registers, disabled // 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) + ';');
}
} }
/** /**