Call TransformVertex directly instead of using TransformVertices

This commit is contained in:
UnknownShadow200 2025-02-02 15:58:19 +11:00
parent 3b2e549934
commit a566bba082
4 changed files with 13 additions and 49 deletions

View File

@ -615,9 +615,13 @@ static void transform(SubmissionTarget* target) {
TRACE();
/* Perform modelview transform, storing W */
Vertex* vertex = _glSubmissionTargetStart(target);
Vertex* it = _glSubmissionTargetStart(target);
int count = target->count;
TransformVertices(vertex, target->count);
for(int i = 0; i < count; ++i, ++it) {
TransformVertex(it->xyz[0], it->xyz[1], it->xyz[2], it->w,
it->xyz, &it->w);
}
}
static void mat_transform_normal3(const float* xyz, const float* xyzOut, const uint32_t count, const uint32_t inStride, const uint32_t outStride) {

View File

@ -124,28 +124,6 @@ GL_FORCE_INLINE void TransformVertex(float x, float y, float z, float w, float*
*ow = __w;
}
static inline void TransformVertices(Vertex* vertices, const int count) {
Vertex* it = vertices;
for(int i = 0; i < count; ++i, ++it) {
register float __x __asm__("fr12") = (it->xyz[0]);
register float __y __asm__("fr13") = (it->xyz[1]);
register float __z __asm__("fr14") = (it->xyz[2]);
register float __w __asm__("fr15") = (it->w);
__asm__ __volatile__(
"fldi1 fr15\n"
"ftrv xmtrx,fv12\n"
: "=f" (__x), "=f" (__y), "=f" (__z), "=f" (__w)
: "0" (__x), "1" (__y), "2" (__z), "3" (__w)
);
it->xyz[0] = __x;
it->xyz[1] = __y;
it->xyz[2] = __z;
it->w = __w;
}
}
void InitGPU(_Bool autosort, _Bool fsaa);
static inline size_t GPUMemoryAvailable() {

View File

@ -619,34 +619,17 @@ void TransformVec4(float* v) {
FASTCPY(v, ret, sizeof(float) * 4);
}
void TransformVertices(Vertex* vertices, const int count) {
float ret[4];
for(int i = 0; i < count; ++i, ++vertices) {
ret[0] = vertices->xyz[0];
ret[1] = vertices->xyz[1];
ret[2] = vertices->xyz[2];
ret[3] = 1.0f;
TransformVec4(ret);
vertices->xyz[0] = ret[0];
vertices->xyz[1] = ret[1];
vertices->xyz[2] = ret[2];
vertices->w = ret[3];
}
}
void TransformVertex(float x, float y, float z, float w, float* oxyz, float* ow) {
float ret[4];
ret[0] = x;
ret[1] = y;
ret[2] = z;
ret[3] = w;
float vec[4], ret[4];
vec[0] = x;
vec[1] = y;
vec[2] = z;
vec[3] = w;
TransformVec4(ret);
TransformVec4NoMod(vec, ret);
oxyz[0] = ret[0];
oxyz[1] = ret[1];
oxyz[2] = ret[2];
*ow = ret[3];
*ow = ret[3];
}

View File

@ -52,7 +52,6 @@ static inline void TransformNormalNoMod(const float* xIn, float* xOut) {
(void) xOut;
}
void TransformVertices(Vertex* vertices, const int count);
void TransformVertex(float x, float y, float z, float w, float* oxyz, float* ow);
void InitGPU(_Bool autosort, _Bool fsaa);