Add some copy safety and remove some print statements
This commit is contained in:
parent
150c95bd33
commit
2b53f50c46
|
@ -12,6 +12,9 @@
|
||||||
#include "../containers/aligned_vector.h"
|
#include "../containers/aligned_vector.h"
|
||||||
#include "../containers/named_array.h"
|
#include "../containers/named_array.h"
|
||||||
|
|
||||||
|
#define FASTCPY(dst, src, bytes) \
|
||||||
|
(bytes % 32 == 0) ? sq_cpy(dst, src, bytes) : memcpy(dst, src, bytes);
|
||||||
|
|
||||||
#define TRACE_ENABLED 0
|
#define TRACE_ENABLED 0
|
||||||
#define TRACE() if(TRACE_ENABLED) {fprintf(stderr, "%s\n", __func__);}
|
#define TRACE() if(TRACE_ENABLED) {fprintf(stderr, "%s\n", __func__);}
|
||||||
|
|
||||||
|
|
|
@ -860,11 +860,9 @@ void _glAllocateSpaceForMipmaps(TextureObject* active) {
|
||||||
/* Figure out how much room to allocate for mipmaps */
|
/* Figure out how much room to allocate for mipmaps */
|
||||||
GLuint bytes = _glGetMipmapDataSize(active);
|
GLuint bytes = _glGetMipmapDataSize(active);
|
||||||
|
|
||||||
fprintf(stderr, "Allocating %d PVR bytes\n", bytes);
|
|
||||||
active->data = pvr_mem_malloc(bytes);
|
active->data = pvr_mem_malloc(bytes);
|
||||||
|
|
||||||
/* If there was existing data, then copy it where it should go */
|
/* If there was existing data, then copy it where it should go */
|
||||||
fprintf(stderr, "Copying data\n");
|
|
||||||
memcpy(_glGetMipmapLocation(active, 0), temp, size);
|
memcpy(_glGetMipmapLocation(active, 0), temp, size);
|
||||||
|
|
||||||
/* Set the data offset depending on whether or not this is a
|
/* Set the data offset depending on whether or not this is a
|
||||||
|
@ -1054,7 +1052,7 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
||||||
assert(bytes);
|
assert(bytes);
|
||||||
|
|
||||||
/* No conversion? Just copy the data, and the pvr_format is correct */
|
/* No conversion? Just copy the data, and the pvr_format is correct */
|
||||||
sq_cpy(targetData, data, bytes);
|
FASTCPY(targetData, data, bytes);
|
||||||
return;
|
return;
|
||||||
} else if(needsConversion) {
|
} else if(needsConversion) {
|
||||||
TextureConversionFunc convert = _determineConversion(
|
TextureConversionFunc convert = _determineConversion(
|
||||||
|
@ -1114,7 +1112,7 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
||||||
|
|
||||||
// We've already converted the data and we
|
// We've already converted the data and we
|
||||||
// don't need to twiddle it!
|
// don't need to twiddle it!
|
||||||
sq_cpy(targetData, conversionBuffer, bytes);
|
FASTCPY(targetData, conversionBuffer, bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(conversionBuffer) {
|
if(conversionBuffer) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user