Fix software renderer
This commit is contained in:
parent
840ac7f0cd
commit
5ea4313d59
GL
10
GL/draw.c
10
GL/draw.c
|
@ -471,7 +471,7 @@ GL_FORCE_INLINE void genQuads(Vertex* output, GLuint count) {
|
||||||
Vertex* final = output + 3;
|
Vertex* final = output + 3;
|
||||||
GLuint i = count >> 2;
|
GLuint i = count >> 2;
|
||||||
while(i--) {
|
while(i--) {
|
||||||
__asm__("pref @%0" : : "r"(pen + 4));
|
PREFETCH(pen + 4);
|
||||||
|
|
||||||
swapVertex(pen, final);
|
swapVertex(pen, final);
|
||||||
final->flags = GPU_CMD_VERTEX_EOL;
|
final->flags = GPU_CMD_VERTEX_EOL;
|
||||||
|
@ -639,7 +639,7 @@ static void _readPositionData(ReadDiffuseFunc func, const GLuint first, const GL
|
||||||
uint32_t* flags;
|
uint32_t* flags;
|
||||||
|
|
||||||
ITERATE(count) {
|
ITERATE(count) {
|
||||||
__asm__("pref @%0" : : "r"(vptr + vstride));
|
PREFETCH(vptr + vstride);
|
||||||
|
|
||||||
func(vptr, out);
|
func(vptr, out);
|
||||||
vptr += vstride;
|
vptr += vstride;
|
||||||
|
@ -660,7 +660,7 @@ static void _readUVData(ReadUVFunc func, const GLuint first, const GLuint count,
|
||||||
GLubyte* out = (GLubyte*) output[0].uv;
|
GLubyte* out = (GLubyte*) output[0].uv;
|
||||||
|
|
||||||
ITERATE(count) {
|
ITERATE(count) {
|
||||||
__asm__("pref @%0" : : "r"(uvptr + uvstride));
|
PREFETCH(uvptr + uvstride);
|
||||||
|
|
||||||
func(uvptr, out);
|
func(uvptr, out);
|
||||||
uvptr += uvstride;
|
uvptr += uvstride;
|
||||||
|
@ -675,7 +675,7 @@ static void _readSTData(ReadUVFunc func, const GLuint first, const GLuint count,
|
||||||
GLubyte* out = (GLubyte*) extra[0].st;
|
GLubyte* out = (GLubyte*) extra[0].st;
|
||||||
|
|
||||||
ITERATE(count) {
|
ITERATE(count) {
|
||||||
__asm__("pref @%0" : : "r"(stptr + ststride));
|
PREFETCH(stptr + ststride);
|
||||||
|
|
||||||
func(stptr, out);
|
func(stptr, out);
|
||||||
stptr += ststride;
|
stptr += ststride;
|
||||||
|
@ -725,7 +725,7 @@ static void _readDiffuseData(ReadDiffuseFunc func, const GLuint first, const GLu
|
||||||
GLubyte* out = (GLubyte*) output[0].bgra;
|
GLubyte* out = (GLubyte*) output[0].bgra;
|
||||||
|
|
||||||
ITERATE(count) {
|
ITERATE(count) {
|
||||||
__asm__("pref @%0" : : "r"(cptr + cstride));
|
PREFETCH(cptr + cstride);
|
||||||
|
|
||||||
func(cptr, out);
|
func(cptr, out);
|
||||||
cptr += cstride;
|
cptr += cstride;
|
||||||
|
|
|
@ -101,7 +101,7 @@ GL_FORCE_INLINE void glPerspectiveDivideStandard(void* src, uint32_t n) {
|
||||||
const float h = GetVideoMode()->height;
|
const float h = GetVideoMode()->height;
|
||||||
|
|
||||||
while(n--) {
|
while(n--) {
|
||||||
__asm__("pref @%0" : : "r"(vertex + 1));
|
PREFETCH(vertex + 1);
|
||||||
|
|
||||||
if(likely(glIsVertex(vertex->flags))) {
|
if(likely(glIsVertex(vertex->flags))) {
|
||||||
const float f = MATH_Fast_Invert(vertex->w);
|
const float f = MATH_Fast_Invert(vertex->w);
|
||||||
|
@ -135,7 +135,7 @@ GL_FORCE_INLINE void glPerspectiveDivideFastMode(void* src, uint32_t n) {
|
||||||
const float h = GetVideoMode()->height;
|
const float h = GetVideoMode()->height;
|
||||||
|
|
||||||
while(n--) {
|
while(n--) {
|
||||||
__asm__("pref @%0" : : "r"(vertex + 1));
|
PREFETCH(vertex + 1);
|
||||||
|
|
||||||
if(likely(glIsVertex(vertex->flags))) {
|
if(likely(glIsVertex(vertex->flags))) {
|
||||||
const float f = MATH_Fast_Invert(vertex->w);
|
const float f = MATH_Fast_Invert(vertex->w);
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define PREFETCH(addr) __asm__("pref @%0" : : "r"((addr)))
|
||||||
|
|
||||||
/* We use sq_cpy if the src and size is properly aligned. We control that the
|
/* We use sq_cpy if the src and size is properly aligned. We control that the
|
||||||
* destination is properly aligned so we assert that. */
|
* destination is properly aligned so we assert that. */
|
||||||
#define FASTCPY(dst, src, bytes) \
|
#define FASTCPY(dst, src, bytes) \
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
|
|
||||||
|
#define PREFETCH(addr) do {} while(0)
|
||||||
|
|
||||||
#define MATH_Fast_Divide(n, d) (n / d)
|
#define MATH_Fast_Divide(n, d) (n / d)
|
||||||
#define MATH_fmac(a, b, c) (a * b + c)
|
#define MATH_fmac(a, b, c) (a * b + c)
|
||||||
#define MATH_Fast_Sqrt(x) sqrtf((x))
|
#define MATH_Fast_Sqrt(x) sqrtf((x))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user