mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-25 00:12:44 +00:00
[client] opengl: clean up failed configuration
This commit is contained in:
@@ -933,7 +933,7 @@ static enum ConfigStatus configure(struct Inst * this)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
DEBUG_ERROR("Unknown/unsupported compression type");
|
DEBUG_ERROR("Unknown/unsupported compression type");
|
||||||
return CONFIG_STATUS_ERROR;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate the texture size in bytes
|
// calculate the texture size in bytes
|
||||||
@@ -943,10 +943,7 @@ static enum ConfigStatus configure(struct Inst * this)
|
|||||||
|
|
||||||
g_gl_dynProcs.glGenBuffers(BUFFER_COUNT, this->vboID);
|
g_gl_dynProcs.glGenBuffers(BUFFER_COUNT, this->vboID);
|
||||||
if (check_gl_error("glGenBuffers"))
|
if (check_gl_error("glGenBuffers"))
|
||||||
{
|
goto fail;
|
||||||
LG_UNLOCK(this->formatLock);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this->hasBuffers = true;
|
this->hasBuffers = true;
|
||||||
|
|
||||||
if (this->amdPinnedMemSupport)
|
if (this->amdPinnedMemSupport)
|
||||||
@@ -959,7 +956,7 @@ static enum ConfigStatus configure(struct Inst * this)
|
|||||||
if (!this->texPixels[i])
|
if (!this->texPixels[i])
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to allocate memory for texture");
|
DEBUG_ERROR("Failed to allocate memory for texture");
|
||||||
return CONFIG_STATUS_ERROR;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(this->texPixels[i], 0, this->texSize);
|
memset(this->texPixels[i], 0, this->texSize);
|
||||||
@@ -967,10 +964,7 @@ static enum ConfigStatus configure(struct Inst * this)
|
|||||||
g_gl_dynProcs.glBindBuffer(
|
g_gl_dynProcs.glBindBuffer(
|
||||||
GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, this->vboID[i]);
|
GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, this->vboID[i]);
|
||||||
if (check_gl_error("glBindBuffer"))
|
if (check_gl_error("glBindBuffer"))
|
||||||
{
|
goto fail;
|
||||||
LG_UNLOCK(this->formatLock);
|
|
||||||
return CONFIG_STATUS_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_gl_dynProcs.glBufferData(
|
g_gl_dynProcs.glBufferData(
|
||||||
GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD,
|
GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD,
|
||||||
@@ -980,10 +974,7 @@ static enum ConfigStatus configure(struct Inst * this)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (check_gl_error("glBufferData"))
|
if (check_gl_error("glBufferData"))
|
||||||
{
|
goto fail;
|
||||||
LG_UNLOCK(this->formatLock);
|
|
||||||
return CONFIG_STATUS_ERROR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
g_gl_dynProcs.glBindBuffer(GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, 0);
|
g_gl_dynProcs.glBindBuffer(GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, 0);
|
||||||
}
|
}
|
||||||
@@ -993,10 +984,7 @@ static enum ConfigStatus configure(struct Inst * this)
|
|||||||
{
|
{
|
||||||
g_gl_dynProcs.glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->vboID[i]);
|
g_gl_dynProcs.glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->vboID[i]);
|
||||||
if (check_gl_error("glBindBuffer"))
|
if (check_gl_error("glBindBuffer"))
|
||||||
{
|
goto fail;
|
||||||
LG_UNLOCK(this->formatLock);
|
|
||||||
return CONFIG_STATUS_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_gl_dynProcs.glBufferData(
|
g_gl_dynProcs.glBufferData(
|
||||||
GL_PIXEL_UNPACK_BUFFER,
|
GL_PIXEL_UNPACK_BUFFER,
|
||||||
@@ -1005,10 +993,7 @@ static enum ConfigStatus configure(struct Inst * this)
|
|||||||
GL_STREAM_DRAW
|
GL_STREAM_DRAW
|
||||||
);
|
);
|
||||||
if (check_gl_error("glBufferData"))
|
if (check_gl_error("glBufferData"))
|
||||||
{
|
goto fail;
|
||||||
LG_UNLOCK(this->formatLock);
|
|
||||||
return CONFIG_STATUS_ERROR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
g_gl_dynProcs.glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
g_gl_dynProcs.glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
}
|
}
|
||||||
@@ -1016,10 +1001,7 @@ static enum ConfigStatus configure(struct Inst * this)
|
|||||||
// create the frame textures
|
// create the frame textures
|
||||||
glGenTextures(BUFFER_COUNT, this->frames);
|
glGenTextures(BUFFER_COUNT, this->frames);
|
||||||
if (check_gl_error("glGenTextures"))
|
if (check_gl_error("glGenTextures"))
|
||||||
{
|
goto fail;
|
||||||
LG_UNLOCK(this->formatLock);
|
|
||||||
return CONFIG_STATUS_ERROR;
|
|
||||||
}
|
|
||||||
this->hasFrames = true;
|
this->hasFrames = true;
|
||||||
|
|
||||||
for(int i = 0; i < BUFFER_COUNT; ++i)
|
for(int i = 0; i < BUFFER_COUNT; ++i)
|
||||||
@@ -1027,10 +1009,7 @@ static enum ConfigStatus configure(struct Inst * this)
|
|||||||
// bind and create the new texture
|
// bind and create the new texture
|
||||||
glBindTexture(GL_TEXTURE_2D, this->frames[i]);
|
glBindTexture(GL_TEXTURE_2D, this->frames[i]);
|
||||||
if (check_gl_error("glBindTexture"))
|
if (check_gl_error("glBindTexture"))
|
||||||
{
|
goto fail;
|
||||||
LG_UNLOCK(this->formatLock);
|
|
||||||
return CONFIG_STATUS_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
glTexImage2D(
|
glTexImage2D(
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
@@ -1044,10 +1023,7 @@ static enum ConfigStatus configure(struct Inst * this)
|
|||||||
(void*)0
|
(void*)0
|
||||||
);
|
);
|
||||||
if (check_gl_error("glTexImage2D"))
|
if (check_gl_error("glTexImage2D"))
|
||||||
{
|
goto fail;
|
||||||
LG_UNLOCK(this->formatLock);
|
|
||||||
return CONFIG_STATUS_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// configure the texture
|
// configure the texture
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S , GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S , GL_CLAMP_TO_EDGE);
|
||||||
@@ -1079,6 +1055,11 @@ static enum ConfigStatus configure(struct Inst * this)
|
|||||||
|
|
||||||
LG_UNLOCK(this->formatLock);
|
LG_UNLOCK(this->formatLock);
|
||||||
return CONFIG_STATUS_OK;
|
return CONFIG_STATUS_OK;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
deconfigure(this);
|
||||||
|
LG_UNLOCK(this->formatLock);
|
||||||
|
return CONFIG_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deconfigure(struct Inst * this)
|
static void deconfigure(struct Inst * this)
|
||||||
|
|||||||
Reference in New Issue
Block a user