summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2016-05-24 13:45:17 +0300
committerPasi Keränen <pasi.keranen@qt.io>2016-05-24 11:43:26 +0000
commit2c76b37d553ae1cdb8a75cb6ead32b64ab2821db (patch)
tree77b249e70b7612086875c37e3368d2a418374440 /src
parent607b82287c70a2db4d35ee5ab0bef89117468b2b (diff)
Fix getting COMPRESSED_TEXTURE_FORMATS when no formats supported
If zero compressed formats were supported, execution fell through to the next case, returning invalid parameter value. Change-Id: I83d52b9cddb0cc8f7a1b65ef18bea5e36c15dfa2 Reviewed-by: Pasi Keränen <pasi.keranen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/qtcanvas3d/context3d.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/imports/qtcanvas3d/context3d.cpp b/src/imports/qtcanvas3d/context3d.cpp
index 9d79e6f..c300772 100644
--- a/src/imports/qtcanvas3d/context3d.cpp
+++ b/src/imports/qtcanvas3d/context3d.cpp
@@ -4521,22 +4521,20 @@ QJSValue CanvasContext::getParameter(glEnums pname)
case COMPRESSED_TEXTURE_FORMATS: {
syncCommand.i1 = GLint(GL_NUM_COMPRESSED_TEXTURE_FORMATS);
scheduleSyncCommand(&syncCommand);
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::ArrayBuffer> buffer(scope,
+ m_v4engine->newArrayBuffer(sizeof(int) * value));
if (value > 0) {
- QV4::Scope scope(m_v4engine);
- QV4::Scoped<QV4::ArrayBuffer> buffer(scope,
- m_v4engine->newArrayBuffer(sizeof(int) * value));
-
syncCommand.i1 = GLint(pname);
syncCommand.returnValue = buffer->data();
scheduleSyncCommand(&syncCommand);
-
- QV4::ScopedFunctionObject constructor(scope,
- m_v4engine->typedArrayCtors[
- QV4::Heap::TypedArray::UInt32Array]);
- QV4::ScopedCallData callData(scope, 1);
- callData->args[0] = buffer;
- return QJSValue(m_v4engine, constructor->construct(callData));
}
+ QV4::ScopedFunctionObject constructor(scope,
+ m_v4engine->typedArrayCtors[
+ QV4::Heap::TypedArray::UInt32Array]);
+ QV4::ScopedCallData callData(scope, 1);
+ callData->args[0] = buffer;
+ return QJSValue(m_v4engine, constructor->construct(callData));
}
case FRAMEBUFFER_BINDING: {
return m_engine->newQObject(m_currentFramebuffer);