Allow compiling containers on Xbox
Obviously GLdc doesn't work on XBox but the containers are fairly generic and are (ab)used in the Simulant engine which does compile there.
This commit is contained in:
parent
105e3253e2
commit
ba10615722
12
GL/texture.c
12
GL/texture.c
@ -62,7 +62,7 @@ static void calc_twiddle_factors(uint32_t w, uint32_t h, uint32_t* maskX, uint32
|
||||
} else if (w > 1) {
|
||||
// Add a linear X bit
|
||||
*maskX += 0x01 << shift;
|
||||
shift += 1;
|
||||
shift += 1;
|
||||
} else if (h > 1) {
|
||||
// Add a linear Y bit
|
||||
*maskY += 0x01 << shift;
|
||||
@ -82,7 +82,7 @@ void build_twiddle_table(int32_t w, int32_t h) {
|
||||
calc_twiddle_factors(w, h, &maskX, &maskY);
|
||||
|
||||
for (int32_t y = 0; y < h; y++) {
|
||||
idxX = 0;
|
||||
idxX = 0;
|
||||
for (int32_t x = 0; x < w; x++) {
|
||||
TWIDDLE_TABLE.table[idx++] = idxX | idxY;
|
||||
idxX = (idxX - maskX) & maskX;
|
||||
@ -1590,8 +1590,8 @@ static bool _glTexSubImage2DValidate(GLenum target, GLint level, GLint xoffset,
|
||||
}
|
||||
|
||||
// Validate offsets and dimensions using the underlying texture size
|
||||
if (xoffset < 0 || yoffset < 0 ||
|
||||
(xoffset + width) > textureWidth ||
|
||||
if (xoffset < 0 || yoffset < 0 ||
|
||||
(xoffset + width) > textureWidth ||
|
||||
(yoffset + height) > textureHeight) {
|
||||
INFO_MSG("Subimage exceeds the dimensions of the texture.");
|
||||
_glKosThrowError(GL_INVALID_VALUE, __func__);
|
||||
@ -1672,7 +1672,7 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
||||
GLuint srcBytes = (width * height * sourceStride);
|
||||
GLuint destBytes = (width * height * destStride);
|
||||
|
||||
TextureConversionFunc conversion;
|
||||
TextureConversionFunc conversion = NULL;
|
||||
int needs_conversion = _determineConversion(cleanInternalFormat, format, type, &conversion);
|
||||
|
||||
// Hack: If we're doing a 4bpp source (via glCompressedTexture...)
|
||||
@ -2183,7 +2183,7 @@ void APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint y
|
||||
// Calculate destBytes using the texture's full dimensions
|
||||
GLuint destBytes = (textureWidth * textureHeight * destStride);
|
||||
|
||||
TextureConversionFunc conversion;
|
||||
TextureConversionFunc conversion = NULL;
|
||||
int needs_conversion = _determineConversion(cleanInternalFormat, format, type, &conversion);
|
||||
|
||||
// Adjust source bytes for 4bpp formats
|
||||
|
||||
@ -45,7 +45,12 @@ void* aligned_vector_reserve(AlignedVector* vector, uint32_t element_count) {
|
||||
uint32_t new_byte_size = (element_count * hdr->element_size);
|
||||
uint8_t* original_data = vector->data;
|
||||
|
||||
vector->data = (uint8_t*) memalign(0x20, new_byte_size);
|
||||
#ifdef __XBOX__
|
||||
vector->data = (unsigned char*) aligned_alloc(0x20, new_byte_size);
|
||||
#else
|
||||
vector->data = (unsigned char*) memalign(0x20, new_byte_size);
|
||||
#endif
|
||||
|
||||
assert(vector->data);
|
||||
|
||||
AV_MEMCPY4(vector->data, original_data, original_byte_size);
|
||||
@ -68,8 +73,11 @@ void aligned_vector_shrink_to_fit(AlignedVector* vector) {
|
||||
} else {
|
||||
uint32_t new_byte_size = (hdr->size * hdr->element_size);
|
||||
uint8_t* original_data = vector->data;
|
||||
#ifdef __XBOX__
|
||||
vector->data = (unsigned char*) aligned_alloc(0x20, new_byte_size);
|
||||
#else
|
||||
vector->data = (unsigned char*) memalign(0x20, new_byte_size);
|
||||
|
||||
#endif
|
||||
if(original_data) {
|
||||
FASTCPY(vector->data, original_data, new_byte_size);
|
||||
free(original_data);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(__APPLE__) || defined(__WIN32__)
|
||||
#if defined(__APPLE__) || defined(__WIN32__) || defined(__XBOX__)
|
||||
/* Linux + Kos define this, OSX does not, so just use malloc there */
|
||||
static inline void* memalign(size_t alignment, size_t size) {
|
||||
return malloc(size);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user