Implement glClearDepth
This commit is contained in:
parent
5c980d2183
commit
4292304df1
11
GL/draw.c
11
GL/draw.c
|
@ -1171,10 +1171,15 @@ GL_FORCE_INLINE void divide(SubmissionTarget* target) {
|
||||||
float f = MATH_fsrra(vertex->w * vertex->w);
|
float f = MATH_fsrra(vertex->w * vertex->w);
|
||||||
vertex->xyz[0] *= f;
|
vertex->xyz[0] *= f;
|
||||||
vertex->xyz[1] *= f;
|
vertex->xyz[1] *= f;
|
||||||
|
vertex->xyz[2] = f;
|
||||||
|
|
||||||
/* Scale depending on glDepthRange */
|
/* FIXME: Consider taking glDepthRange into account. PVR is designed to use invW rather
|
||||||
vertex->xyz[2] = 1.0f - ((DEPTH_RANGE_MULTIPLIER_L * vertex->xyz[2] * f) + DEPTH_RANGE_MULTIPLIER_H);
|
* than Z which is unlike most GPUs - this apparently provides advantages.
|
||||||
|
*
|
||||||
|
* This can be done (if Z is between -1 and 1) with:
|
||||||
|
*
|
||||||
|
* //((DEPTH_RANGE_MULTIPLIER_L * vertex->xyz[2] * f) + DEPTH_RANGE_MULTIPLIER_H);
|
||||||
|
*/
|
||||||
++vertex;
|
++vertex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,6 +274,7 @@ void _glInitContext() {
|
||||||
GL_CONTEXT.fmt.uv = PVR_UVFMT_32BIT;
|
GL_CONTEXT.fmt.uv = PVR_UVFMT_32BIT;
|
||||||
GL_CONTEXT.gen.color_clamp = PVR_CLRCLAMP_DISABLE;
|
GL_CONTEXT.gen.color_clamp = PVR_CLRCLAMP_DISABLE;
|
||||||
|
|
||||||
|
glClearDepth(1.0f);
|
||||||
glDepthFunc(GL_LESS);
|
glDepthFunc(GL_LESS);
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glFrontFace(GL_CCW);
|
glFrontFace(GL_CCW);
|
||||||
|
@ -439,13 +440,12 @@ GLAPI void APIENTRY glClearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
|
||||||
|
|
||||||
/* Depth Testing */
|
/* Depth Testing */
|
||||||
GLAPI void APIENTRY glClearDepthf(GLfloat depth) {
|
GLAPI void APIENTRY glClearDepthf(GLfloat depth) {
|
||||||
_GL_UNUSED(depth);
|
glClearDepth(depth);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLAPI void APIENTRY glClearDepth(GLfloat depth) {
|
GLAPI void APIENTRY glClearDepth(GLfloat depth) {
|
||||||
_GL_UNUSED(depth);
|
/* We reverse because using invW means that farther Z == lower number */
|
||||||
|
pvr_set_zclip(1.0f - depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLAPI void APIENTRY glDrawBuffer(GLenum mode) {
|
GLAPI void APIENTRY glDrawBuffer(GLenum mode) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user