mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Xbox: Try to fix texture allocation failure
This commit is contained in:
parent
450b4c921e
commit
f3a391e9c3
@ -141,8 +141,7 @@ void Gfx_FreeState(void) { }
|
|||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
typedef struct CCTexture_ {
|
typedef struct CCTexture_ {
|
||||||
cc_uint32 width, height;
|
cc_uint32 width, height;
|
||||||
cc_uint32 pitch, pad;
|
cc_uint32* pixels;
|
||||||
cc_uint32 pixels[];
|
|
||||||
} CCTexture;
|
} CCTexture;
|
||||||
|
|
||||||
// See Graphics_Dreamcast.c for twiddling explanation
|
// See Graphics_Dreamcast.c for twiddling explanation
|
||||||
@ -195,12 +194,12 @@ static void ConvertTexture(cc_uint32* dst, struct Bitmap* bmp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, cc_uint8 flags, cc_bool mipmaps) {
|
static GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, cc_uint8 flags, cc_bool mipmaps) {
|
||||||
int size = 16 + bmp->width * bmp->height * 4;
|
int size = bmp->width * bmp->height * 4;
|
||||||
CCTexture* tex = MmAllocateContiguousMemoryEx(size, 0, MAX_RAM_ADDR, 16, PAGE_WRITECOMBINE | PAGE_READWRITE);
|
CCTexture* tex = Mem_Alloc(1, sizeof(struct CCTexture), "GPU texture");
|
||||||
|
tex->pixels = MmAllocateContiguousMemoryEx(size, 0, MAX_RAM_ADDR, 0, PAGE_WRITECOMBINE | PAGE_READWRITE);
|
||||||
|
|
||||||
tex->width = bmp->width;
|
tex->width = bmp->width;
|
||||||
tex->height = bmp->height;
|
tex->height = bmp->height;
|
||||||
tex->pitch = bmp->width * 4;
|
|
||||||
ConvertTexture(tex->pixels, bmp);
|
ConvertTexture(tex->pixels, bmp);
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ static DWORD WINAPI ExecThread(void* param) {
|
|||||||
|
|
||||||
void Thread_Run(void** handle, Thread_StartFunc func, int stackSize, const char* name) {
|
void Thread_Run(void** handle, Thread_StartFunc func, int stackSize, const char* name) {
|
||||||
DWORD threadID;
|
DWORD threadID;
|
||||||
HANDLE thread = CreateThread(NULL, 0, ExecThread, (void*)func, CREATE_SUSPENDED, &threadID);
|
HANDLE thread = CreateThread(NULL, stackSize, ExecThread, (void*)func, CREATE_SUSPENDED, &threadID);
|
||||||
if (!thread) Logger_Abort2(GetLastError(), "Creating thread");
|
if (!thread) Logger_Abort2(GetLastError(), "Creating thread");
|
||||||
|
|
||||||
*handle = thread;
|
*handle = thread;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user