Fix more freezes and clipping issues

This commit is contained in:
Luke Benstead 2024-03-19 20:14:01 +00:00
parent d6ac295d18
commit d4f6a9636b

View File

@ -127,7 +127,7 @@ static inline void _glClipEdge(const Vertex* const v1, const Vertex* const v2, V
const static float o = 0.003921569f; // 1 / 255 const static float o = 0.003921569f; // 1 / 255
const float d0 = v1->w + v1->xyz[2]; const float d0 = v1->w + v1->xyz[2];
const float d1 = v2->w + v2->xyz[2]; const float d1 = v2->w + v2->xyz[2];
const float t = (fabs(d0) * (1.0f / sqrtf((d1 - d0) * (d1 - d0)))) + 0.000001f; const float t = (fabs(d0) * (1.0f / sqrtf((d1 - d0) * (d1 - d0))));
const float invt = 1.0f - t; const float invt = 1.0f - t;
vout->xyz[0] = invt * v1->xyz[0] + t * v2->xyz[0]; vout->xyz[0] = invt * v1->xyz[0] + t * v2->xyz[0];
@ -228,9 +228,9 @@ void SceneListSubmit(Vertex* v2, int n) {
Vertex* const v1 = v2 - 1; Vertex* const v1 = v2 - 1;
visible_mask = ( visible_mask = (
(v0->xyz[2] > -v0->w) << 0 | (v0->xyz[2] >= -v0->w) << 0 |
(v1->xyz[2] > -v1->w) << 1 | (v1->xyz[2] >= -v1->w) << 1 |
(v2->xyz[2] > -v2->w) << 2 | (v2->xyz[2] >= -v2->w) << 2 |
(counter == 0) << 3 (counter == 0) << 3
); );
@ -468,7 +468,7 @@ void SceneListSubmit(Vertex* v2, int n) {
_glPushHeaderOrVertex(c); _glPushHeaderOrVertex(c);
_glPerspectiveDivideVertex(b, h); _glPerspectiveDivideVertex(b, h);
_glPushHeaderOrVertex(b); _glPushHeaderOrVertex(b);
_glPushHeaderOrVertex(c); QUEUE_VERTEX(c);
} }
break; break;
case 14: case 14:
@ -514,6 +514,8 @@ void SceneListSubmit(Vertex* v2, int n) {
} }
} }
SUBMIT_QUEUED_VERTEX(GPU_CMD_VERTEX_EOL);
_glFlushBuffer(); _glFlushBuffer();
} }