mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-08-03 10:47:39 -04:00
Merge pull request #1402 from shinovon/7
Check glGetError after glBufferData
This commit is contained in:
commit
6f6eba3d2c
@ -106,3 +106,5 @@ typedef cc_uintptr GLpointer;
|
||||
#define GL_COMPILE_STATUS 0x8B81
|
||||
#define GL_LINK_STATUS 0x8B82
|
||||
#define GL_INFO_LOG_LENGTH 0x8B84
|
||||
|
||||
#define GL_OUT_OF_MEMORY 0x0505
|
||||
|
@ -39,6 +39,8 @@ extern cc_string Game_Mppass;
|
||||
|
||||
#if defined CC_BUILD_N64 || defined CC_BUILD_PS1 || defined CC_BUILD_SATURN
|
||||
#define DEFAULT_VIEWDIST 20
|
||||
#elif defined CC_BUILD_SYMBIAN
|
||||
#define DEFAULT_VIEWDIST 64
|
||||
#elif defined CC_BUILD_NDS
|
||||
#define DEFAULT_VIEWDIST 192
|
||||
#else
|
||||
|
@ -146,8 +146,13 @@ void* Gfx_LockVb(GfxResourceID vb, VertexFormat fmt, int count) {
|
||||
return FastAllocTempMem(count * strideSizes[fmt]);
|
||||
}
|
||||
|
||||
void Gfx_UnlockVb(GfxResourceID vb) {
|
||||
static cc_bool UnlockVb(GfxResourceID vb) {
|
||||
_glBufferData(GL_ARRAY_BUFFER, tmpSize, tmpData, GL_STATIC_DRAW);
|
||||
#if defined CC_BUILD_SYMBIAN
|
||||
return _glGetError() != GL_OUT_OF_MEMORY;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,8 +91,9 @@ void* Gfx_LockVb(GfxResourceID vb, VertexFormat fmt, int count) {
|
||||
return FastAllocTempMem(count * strideSizes[fmt]);
|
||||
}
|
||||
|
||||
void Gfx_UnlockVb(GfxResourceID vb) {
|
||||
static cc_bool UnlockVb(GfxResourceID vb) {
|
||||
UpdateDisplayList(ptr_to_uint(vb), tmpData, tmpFormat, tmpCount);
|
||||
return true;
|
||||
}
|
||||
|
||||
GfxResourceID Gfx_CreateVb2(void* vertices, VertexFormat fmt, int count) {
|
||||
|
@ -118,8 +118,13 @@ void* Gfx_LockVb(GfxResourceID vb, VertexFormat fmt, int count) {
|
||||
return FastAllocTempMem(count * strideSizes[fmt]);
|
||||
}
|
||||
|
||||
void Gfx_UnlockVb(GfxResourceID vb) {
|
||||
static cc_bool UnlockVb(GfxResourceID vb) {
|
||||
glBufferData(GL_ARRAY_BUFFER, tmpSize, tmpData, GL_STATIC_DRAW);
|
||||
#if defined CC_BUILD_SYMBIAN
|
||||
return glGetError() != GL_OUT_OF_MEMORY;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -419,3 +419,13 @@ void Gfx_SetScissor(int x, int y, int w, int h) {
|
||||
|
||||
_glScissor(x, Game.Height - h - y, w, h);
|
||||
}
|
||||
|
||||
static cc_bool UnlockVb(GfxResourceID vb);
|
||||
|
||||
void Gfx_UnlockVb(GfxResourceID vb) {
|
||||
for (;;) {
|
||||
if (UnlockVb(vb)) return;
|
||||
|
||||
if (!Game_ReduceVRAM()) Process_Abort("Out of video memory! (updating static VB)");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user