Merge pull request #506 from bunnei/depth-functions
GPU: Implement the remaining depth testing functions.
This commit is contained in:
commit
0cf3c40aa9
@ -311,9 +311,14 @@ struct Regs {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
enum DepthFunc : u32 {
|
enum DepthFunc : u32 {
|
||||||
|
Never = 0,
|
||||||
Always = 1,
|
Always = 1,
|
||||||
|
Equal = 2,
|
||||||
|
NotEqual = 3,
|
||||||
LessThan = 4,
|
LessThan = 4,
|
||||||
|
LessThanOrEqual = 5,
|
||||||
GreaterThan = 6,
|
GreaterThan = 6,
|
||||||
|
GreaterThanOrEqual = 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
@ -441,18 +441,38 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
|
|||||||
bool pass = false;
|
bool pass = false;
|
||||||
|
|
||||||
switch (registers.output_merger.depth_test_func) {
|
switch (registers.output_merger.depth_test_func) {
|
||||||
|
case registers.output_merger.Never:
|
||||||
|
pass = false;
|
||||||
|
break;
|
||||||
|
|
||||||
case registers.output_merger.Always:
|
case registers.output_merger.Always:
|
||||||
pass = true;
|
pass = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case registers.output_merger.Equal:
|
||||||
|
pass = z == ref_z;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case registers.output_merger.NotEqual:
|
||||||
|
pass = z != ref_z;
|
||||||
|
break;
|
||||||
|
|
||||||
case registers.output_merger.LessThan:
|
case registers.output_merger.LessThan:
|
||||||
pass = z < ref_z;
|
pass = z < ref_z;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case registers.output_merger.LessThanOrEqual:
|
||||||
|
pass = z <= ref_z;
|
||||||
|
break;
|
||||||
|
|
||||||
case registers.output_merger.GreaterThan:
|
case registers.output_merger.GreaterThan:
|
||||||
pass = z > ref_z;
|
pass = z > ref_z;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case registers.output_merger.GreaterThanOrEqual:
|
||||||
|
pass = z >= ref_z;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(HW_GPU, "Unknown depth test function %x", registers.output_merger.depth_test_func.Value());
|
LOG_ERROR(HW_GPU, "Unknown depth test function %x", registers.output_merger.depth_test_func.Value());
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user