Fix test compilation

This commit is contained in:
Luke Benstead 2020-10-27 14:11:34 +00:00
parent 3fde2abd3e
commit 0e780ad271
5 changed files with 31 additions and 12 deletions

View File

@ -78,7 +78,7 @@ GL_FORCE_INLINE GLboolean shift(ListIterator* it, Vertex* new_vertex) {
return new_vertex != NULL;
}
ListIterator* next(ListIterator* it) {
ListIterator* _glIteratorNext(ListIterator* it) {
if(!isVertex(it->current)) {
return header_reset(it, current_postinc(it));
} else {
@ -136,7 +136,7 @@ static void pvr_list_submit(void *src, int n) {
/* First entry is assumed to always be a header and therefore
* always submitted (e.g. not clipped) */
ListIterator* it = begin(src, n);
ListIterator* it = _glIteratorBegin(src, n);
/* fill/write queues as many times necessary */
while(it) {
__asm__("pref @%0" : : "r"(it->current + 1)); /* prefetch 64 bytes for next loop */
@ -161,7 +161,7 @@ static void pvr_list_submit(void *src, int n) {
d += 8; /* Move to the next SQ address */
it = next(it);
it = _glIteratorNext(it);
}
/* Wait for both store queues to complete */

View File

@ -2,6 +2,10 @@
#include "private.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_STACK 3
#define B000 0
@ -33,7 +37,7 @@ typedef struct {
int8_t stack_idx;
} ListIterator;
GL_FORCE_INLINE ListIterator* begin(void* src, int n) {
inline ListIterator* _glIteratorBegin(void* src, int n) {
ListIterator* it = (ListIterator*) malloc(sizeof(ListIterator));
it->remaining = n;
it->current = (Vertex*) src;
@ -43,6 +47,8 @@ GL_FORCE_INLINE ListIterator* begin(void* src, int n) {
return (n) ? it : NULL;
}
extern ListIterator* next(ListIterator* it);
ListIterator* _glIteratorNext(ListIterator* it);
#ifdef __cplusplus
}
#endif

View File

@ -13,11 +13,20 @@
#include "../containers/named_array.h"
#include "sh4_math.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void* memcpy4 (void *dest, const void *src, size_t count);
#ifdef __cplusplus
#define GL_FORCE_INLINE inline
#else
#define GL_NO_INSTRUMENT inline __attribute__((no_instrument_function))
#define GL_INLINE_DEBUG GL_NO_INSTRUMENT __attribute__((always_inline))
#define GL_FORCE_INLINE static GL_INLINE_DEBUG
#endif
#define _GL_UNUSED(x) (void)(x)
#define FASTCPY(dst, src, bytes) \
@ -288,8 +297,6 @@ typedef enum {
#define G8IDX 1
#define B8IDX 0
struct SubmissionTarget;
float _glClipLineToNearZ(const Vertex* v1, const Vertex* v2, Vertex* vout);
void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade);
@ -389,4 +396,8 @@ GLubyte _glKosHasError();
#define MAX(a,b) (((a)>(b))?(a):(b))
#define CLAMP( X, _MIN, _MAX ) ( (X)<(_MIN) ? (_MIN) : ((X)>(_MAX) ? (_MAX) : (X)) )
#ifdef __cplusplus
}
#endif
#endif // PRIVATE_H

View File

@ -14,13 +14,13 @@ clean:
rm-elf:
-rm -f $(TARGET) romdisk.*
test_runner.cpp:
test_runner.cpp:
$(shell python3 test_generator.py --output=test_runner.cpp $(TESTS))
test_runner.o: test_runner.cpp
$(TARGET): $(OBJS) romdisk.o
kos-c++ -o $(TARGET) $(OBJS) romdisk.o
kos-c++ -o $(TARGET) $(OBJS) ../libGLdc.a romdisk.o
romdisk.img:
$(KOS_GENROMFS) -f romdisk.img -d romdisk -v

View File

@ -10,6 +10,7 @@ struct VertexBuilder {
Vertex v;
v.flags = 100; // I dunno what this bit of memory would be
list_.push_back(std::move(v));
return *this;
}
VertexBuilder& add(float x, float y, float z, float w) {
@ -18,6 +19,7 @@ struct VertexBuilder {
v.xyz[1] = y;
v.xyz[2] = z;
v.w = w;
return *this;
}
std::vector<Vertex> done() {
@ -39,11 +41,11 @@ public:
add(1, 0, 2, -1).
add(0, 1, 2, -1).done();
ListIterator* it = begin(&list[0], list.size());
ListIterator* it = _glIteratorBegin(&list[0], list.size());
Vertex* v0 = it->current;
assert_is_not_null(v0);
it = next(it);
it = _glIteratorNext(it);
Vertex* v1 = it->current;
assert_is_not_null(v1);