Finally Finish Complete Merge
This commit is contained in:
commit
9c8034ba69
10
GL/draw.c
10
GL/draw.c
|
@ -757,6 +757,7 @@ static void genArraysTriangleStrip(
|
|||
}
|
||||
|
||||
#define MAX_POLYGON_SIZE 32
|
||||
static ClipVertex buffer[MAX_POLYGON_SIZE];
|
||||
|
||||
static void genArraysTriangleFan(
|
||||
ClipVertex* output,
|
||||
|
@ -769,8 +770,7 @@ static void genArraysTriangleFan(
|
|||
GLboolean doTexture, GLboolean doMultitexture, GLboolean doLighting) {
|
||||
|
||||
assert(count < MAX_POLYGON_SIZE);
|
||||
static ClipVertex buffer[MAX_POLYGON_SIZE];
|
||||
|
||||
|
||||
genArraysCommon(
|
||||
output, count,
|
||||
vptr, vstride, cptr, cstride, uvptr, uvstride, stptr, ststride, nptr, nstride,
|
||||
|
@ -1280,7 +1280,7 @@ void APIENTRY glEnableClientState(GLenum cap) {
|
|||
(ENABLED_VERTEX_ATTRIBUTES |= UV_ENABLED_FLAG);
|
||||
break;
|
||||
default:
|
||||
_glKosThrowError(GL_INVALID_ENUM, "glEnableClientState");
|
||||
_glKosThrowError(GL_INVALID_ENUM, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1303,7 +1303,7 @@ void APIENTRY glDisableClientState(GLenum cap) {
|
|||
(ENABLED_VERTEX_ATTRIBUTES &= ~UV_ENABLED_FLAG);
|
||||
break;
|
||||
default:
|
||||
_glKosThrowError(GL_INVALID_ENUM, "glDisableClientState");
|
||||
_glKosThrowError(GL_INVALID_ENUM, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1315,7 +1315,7 @@ void APIENTRY glClientActiveTextureARB(GLenum texture) {
|
|||
TRACE();
|
||||
|
||||
if(texture < GL_TEXTURE0_ARB || texture > GL_TEXTURE0_ARB + MAX_TEXTURE_UNITS) {
|
||||
_glKosThrowError(GL_INVALID_ENUM, "glClientActiveTextureARB");
|
||||
_glKosThrowError(GL_INVALID_ENUM, __func__);
|
||||
}
|
||||
|
||||
if(_glKosHasError()) {
|
||||
|
|
|
@ -57,6 +57,7 @@ void _glKosPrintError() {
|
|||
}
|
||||
|
||||
fprintf(stderr, "GL ERROR: %s when calling %s\n", _glErrorEnumAsString(last_error), error_function);
|
||||
_glKosResetError();
|
||||
}
|
||||
|
||||
GLenum glGetError(void) {
|
||||
|
|
|
@ -186,7 +186,7 @@ GLboolean _glCalculateAverageTexel(const GLubyte* src, const GLuint srcWidth, co
|
|||
*d1 = (r << 11 | g << 5 | b);
|
||||
} else {
|
||||
fprintf(stderr, "ERROR: Unsupported PVR format for mipmap generation");
|
||||
_glKosThrowError(GL_INVALID_OPERATION, "glGenerateMipmapEXT");
|
||||
_glKosThrowError(GL_INVALID_OPERATION, __func__);
|
||||
_glKosPrintError();
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "profiler.h"
|
||||
#include "../containers/aligned_vector.h"
|
||||
|
||||
#ifdef PROFILER_COMPILE
|
||||
|
||||
#define MAX_PATH 256
|
||||
|
||||
typedef struct {
|
||||
|
@ -126,7 +128,7 @@ void profiler_pop() {
|
|||
|
||||
aligned_vector_resize(&root->stack, root->stack.size - 1);
|
||||
}
|
||||
|
||||
#include <inttypes.h>
|
||||
void profiler_print_stats() {
|
||||
if(!PROFILER_ENABLED) return;
|
||||
|
||||
|
@ -138,6 +140,8 @@ void profiler_print_stats() {
|
|||
float ms = ((float) result->total_time_us) / 1000.0f;
|
||||
float avg = ms / (float) result->total_calls;
|
||||
|
||||
fprintf(stderr, "%-60s%-20f%-20f%u\n", result->name, avg, ms, result->total_calls);
|
||||
fprintf(stderr, "%-60s%-20f%-20f%" PRIu64 "\n", result->name, (double)avg, (double)ms, result->total_calls);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#define PROFILER_COMPILE 0
|
||||
#ifdef PROFILER_COMPILE
|
||||
#define PROFILER_PUSH(S) profiler_push(S)
|
||||
#define PROFILER_CHECKPOINT(P) profiler_checkpoint(P)
|
||||
#define PROFILER_POP() profiler_pop()
|
||||
void profiler_enable();
|
||||
void profiler_disable();
|
||||
|
||||
typedef struct {
|
||||
char name[64];
|
||||
uint64_t start_time_in_us;
|
||||
|
@ -13,6 +21,8 @@ void profiler_checkpoint(const char* name);
|
|||
void profiler_pop();
|
||||
|
||||
void profiler_print_stats();
|
||||
|
||||
void profiler_enable();
|
||||
void profiler_disable();
|
||||
#else
|
||||
#define PROFILER_PUSH(S) do {} while (0)
|
||||
#define PROFILER_CHECKPOINT(P) do {} while (0)
|
||||
#define PROFILER_POP() do {} while (0)
|
||||
#endif
|
||||
|
|
|
@ -134,7 +134,7 @@ static void _updatePVRBlend(pvr_poly_cxt_t* context) {
|
|||
GLboolean _glCheckValidEnum(GLint param, GLenum* values, const char* func) {
|
||||
GLubyte found = 0;
|
||||
while(*values != 0) {
|
||||
if(*values == param) {
|
||||
if(*values == (GLenum)param) {
|
||||
found++;
|
||||
break;
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ void APIENTRY glGetFloatv(GLenum pname, GLfloat* params) {
|
|||
memcpy(params, _glGetModelViewMatrix(), sizeof(float) * 16);
|
||||
break;
|
||||
default:
|
||||
_glKosThrowError(GL_INVALID_ENUM, "glGetIntegerv");
|
||||
_glKosThrowError(GL_INVALID_ENUM, __func__);
|
||||
_glKosPrintError();
|
||||
break;
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ void APIENTRY glGetIntegerv(GLenum pname, GLint *params) {
|
|||
}
|
||||
} break;
|
||||
default:
|
||||
_glKosThrowError(GL_INVALID_ENUM, "glGetIntegerv");
|
||||
_glKosThrowError(GL_INVALID_ENUM, __func__);
|
||||
_glKosPrintError();
|
||||
break;
|
||||
}
|
||||
|
|
29
GL/texture.c
29
GL/texture.c
|
@ -366,7 +366,7 @@ void APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param) {
|
|||
}
|
||||
}
|
||||
|
||||
void APIENTRY glTexEnvf(GLenum target, GLenum pname, GLfloat param) {
|
||||
void APIENTRY glTexEnvf(GLenum target, GLenum pname, GLint param) {
|
||||
glTexEnvi(target, pname, param);
|
||||
}
|
||||
|
||||
|
@ -929,7 +929,7 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
|||
assert(bytes);
|
||||
|
||||
if(needsTwiddling) {
|
||||
assert(type == GL_UNSIGNED_BYTE); // Anything else needs this loop adjusting
|
||||
/*assert(type == GL_UNSIGNED_BYTE); // Anything else needs this loop adjusting
|
||||
GLuint x, y;
|
||||
for(y = 0; y < height; ++y) {
|
||||
for(x = 0; x < width; ++x) {
|
||||
|
@ -939,7 +939,32 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
|||
targetData[dest] = ((GLubyte*) data)[src];
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* Don't convert color indexes */
|
||||
/* Linear/iterative twiddling algorithm from Marcus' tatest */
|
||||
#define TWIDTAB(x) ( (x&1)|((x&2)<<1)|((x&4)<<2)|((x&8)<<3)|((x&16)<<4)| \
|
||||
((x&32)<<5)|((x&64)<<6)|((x&128)<<7)|((x&256)<<8)|((x&512)<<9) )
|
||||
#define TWIDOUT(x, y) ( TWIDTAB((y)) | (TWIDTAB((x)) << 1) )
|
||||
|
||||
#define MIN(a, b) ( (a)<(b)? (a):(b) )
|
||||
|
||||
uint32 x, y, min, mask;
|
||||
|
||||
min = MIN(w, h);
|
||||
mask = min - 1;
|
||||
|
||||
uint8 * pixels;
|
||||
uint16 * vtex;
|
||||
pixels = (uint8 *) data;
|
||||
vtex = (uint16*)targetData;
|
||||
|
||||
for(y = 0; y < h; y += 2) {
|
||||
for(x = 0; x < w; x++) {
|
||||
vtex[TWIDOUT((y & mask) / 2, x & mask) +
|
||||
(x / min + y / min)*min * min / 2] =
|
||||
pixels[y * w + x] | (pixels[(y + 1) * w + x] << 8);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* No conversion? Just copy the data, and the pvr_format is correct */
|
||||
sq_cpy(targetData, data, bytes);
|
||||
|
|
|
@ -12,6 +12,17 @@
|
|||
|
||||
#include "named_array.h"
|
||||
|
||||
#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c"
|
||||
#define BYTE_TO_BINARY(byte) \
|
||||
(byte & 0x80 ? '1' : '0'), \
|
||||
(byte & 0x40 ? '1' : '0'), \
|
||||
(byte & 0x20 ? '1' : '0'), \
|
||||
(byte & 0x10 ? '1' : '0'), \
|
||||
(byte & 0x08 ? '1' : '0'), \
|
||||
(byte & 0x04 ? '1' : '0'), \
|
||||
(byte & 0x02 ? '1' : '0'), \
|
||||
(byte & 0x01 ? '1' : '0')
|
||||
|
||||
void named_array_init(NamedArray* array, unsigned int element_size, unsigned int max_elements) {
|
||||
array->element_size = element_size;
|
||||
array->max_element_count = max_elements;
|
||||
|
@ -33,7 +44,7 @@ void named_array_init(NamedArray* array, unsigned int element_size, unsigned int
|
|||
char named_array_used(NamedArray* array, unsigned int id) {
|
||||
unsigned int i = id / 8;
|
||||
unsigned int j = id % 8;
|
||||
|
||||
|
||||
unsigned char v = array->used_markers[i] & (unsigned char) (1 << j);
|
||||
return !!(v);
|
||||
}
|
||||
|
@ -60,8 +71,7 @@ void* named_array_reserve(NamedArray* array, unsigned int id) {
|
|||
if(!named_array_used(array, id)) {
|
||||
unsigned int j = (id % 8);
|
||||
unsigned int i = id / 8;
|
||||
|
||||
assert(!named_array_used(array, id));
|
||||
|
||||
array->used_markers[i] |= (unsigned char) 1 << j;
|
||||
assert(named_array_used(array, id));
|
||||
|
||||
|
|
10
include/gl.h
10
include/gl.h
|
@ -112,10 +112,10 @@ __BEGIN_DECLS
|
|||
|
||||
/* Texture Environment */
|
||||
#define GL_TEXTURE_ENV_MODE 0x2200
|
||||
#define GL_REPLACE 0x0
|
||||
#define GL_MODULATE 0x1
|
||||
#define GL_DECAL 0x2
|
||||
#define GL_MODULATEALPHA 0x3
|
||||
#define GL_REPLACE 0x1E01
|
||||
#define GL_MODULATE 0x2100
|
||||
#define GL_DECAL 0x2101
|
||||
|
||||
|
||||
/* TextureMagFilter */
|
||||
#define GL_NEAREST 0x2600
|
||||
|
@ -493,7 +493,7 @@ GLAPI void APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor);
|
|||
/* Texturing */
|
||||
GLAPI void APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param);
|
||||
GLAPI void APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param);
|
||||
GLAPI void APIENTRY glTexEnvf(GLenum target, GLenum pname, GLfloat param);
|
||||
GLAPI void APIENTRY glTexEnvf(GLenum target, GLenum pname, GLint param);
|
||||
|
||||
GLAPI GLboolean APIENTRY glIsTexture(GLuint texture);
|
||||
GLAPI void APIENTRY glGenTextures(GLsizei n, GLuint *textures);
|
||||
|
|
Loading…
Reference in New Issue
Block a user