Add some copy safety and remove some print statements

This commit is contained in:
Luke Benstead 2019-09-24 19:39:23 +01:00
parent 150c95bd33
commit 2b53f50c46
2 changed files with 5 additions and 4 deletions

View File

@ -12,6 +12,9 @@
#include "../containers/aligned_vector.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() if(TRACE_ENABLED) {fprintf(stderr, "%s\n", __func__);}

View File

@ -860,11 +860,9 @@ void _glAllocateSpaceForMipmaps(TextureObject* active) {
/* Figure out how much room to allocate for mipmaps */
GLuint bytes = _glGetMipmapDataSize(active);
fprintf(stderr, "Allocating %d PVR bytes\n", bytes);
active->data = pvr_mem_malloc(bytes);
/* If there was existing data, then copy it where it should go */
fprintf(stderr, "Copying data\n");
memcpy(_glGetMipmapLocation(active, 0), temp, size);
/* 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);
/* No conversion? Just copy the data, and the pvr_format is correct */
sq_cpy(targetData, data, bytes);
FASTCPY(targetData, data, bytes);
return;
} else if(needsConversion) {
TextureConversionFunc convert = _determineConversion(
@ -1114,7 +1112,7 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
// We've already converted the data and we
// don't need to twiddle it!
sq_cpy(targetData, conversionBuffer, bytes);
FASTCPY(targetData, conversionBuffer, bytes);
}
if(conversionBuffer) {