rsx/gl/vk: Simulate z clipping with selective depth clamp

- The scale offset matrix is fine but on real hardware the z results seem to be independent of near/far clipping distances
-- If depth falls within near/far, clamp depth value to [0,1]
This commit is contained in:
kd-11 2018-01-18 15:06:28 +03:00
parent 1a6e53ec98
commit 0a2992839b
6 changed files with 30 additions and 12 deletions

View file

@ -37,6 +37,8 @@ void VKVertexDecompilerThread::insertHeader(std::stringstream &OS)
OS << " uint transform_branch_bits;\n";
OS << " uint vertex_base_index;\n";
OS << " float point_size;\n";
OS << " float z_near;\n";
OS << " float z_far;\n";
OS << " ivec4 input_attributes[16];\n";
OS << "};\n";
@ -312,6 +314,7 @@ void VKVertexDecompilerThread::insertMainEnd(std::stringstream & OS)
OS << " gl_PointSize = point_size;\n";
OS << " gl_Position = gl_Position * scale_offset_mat;\n";
OS << " gl_Position = apply_zclip_xform(gl_Position, z_near, z_far);\n";
OS << "}\n";
}