JSWebGL2RenderingContextCustom.cpp [plain text]
#include "config.h"
#if ENABLE(WEBGL) && ENABLE(WEBGL2)
#include "JSWebGL2RenderingContext.h"
#include "NotImplemented.h"
#include <heap/HeapInlines.h>
#include <runtime/Error.h>
using namespace JSC;
namespace WebCore {
static JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, const WebGLGetInfo& info)
{
switch (info.getType()) {
case WebGLGetInfo::kTypeBool:
return jsBoolean(info.getBool());
case WebGLGetInfo::kTypeBoolArray: {
MarkedArgumentBuffer list;
for (auto& value : info.getBoolArray())
list.append(jsBoolean(value));
return constructArray(state, 0, globalObject, list);
}
case WebGLGetInfo::kTypeFloat:
return jsNumber(info.getFloat());
case WebGLGetInfo::kTypeInt:
return jsNumber(info.getInt());
case WebGLGetInfo::kTypeNull:
return jsNull();
case WebGLGetInfo::kTypeString:
return jsStringWithCache(state, info.getString());
case WebGLGetInfo::kTypeUnsignedInt:
return jsNumber(info.getUnsignedInt());
case WebGLGetInfo::kTypeInt64:
return jsNumber(info.getInt64());
default:
notImplemented();
return jsUndefined();
}
}
void JSWebGL2RenderingContext::visitAdditionalChildren(SlotVisitor& visitor)
{
visitor.addOpaqueRoot(&wrapped());
}
JSValue JSWebGL2RenderingContext::getInternalformatParameter(ExecState&)
{
return jsUndefined();
}
JSValue JSWebGL2RenderingContext::getQueryParameter(ExecState&)
{
return jsUndefined();
}
JSValue JSWebGL2RenderingContext::getSamplerParameter(ExecState&)
{
return jsUndefined();
}
JSValue JSWebGL2RenderingContext::getSyncParameter(ExecState&)
{
return jsUndefined();
}
JSValue JSWebGL2RenderingContext::getIndexedParameter(ExecState& state)
{
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
if (state.argumentCount() < 2)
return throwException(&state, scope, createNotEnoughArgumentsError(&state));
unsigned pname = state.uncheckedArgument(0).toInt32(&state);
RETURN_IF_EXCEPTION(scope, JSValue());
unsigned index = state.uncheckedArgument(1).toInt32(&state);
RETURN_IF_EXCEPTION(scope, JSValue());
return toJS(&state, globalObject(), wrapped().getIndexedParameter(pname, index));
}
JSValue JSWebGL2RenderingContext::getActiveUniformBlockParameter(ExecState&)
{
return jsUndefined();
}
JSValue JSWebGL2RenderingContext::getActiveUniformBlockName(ExecState&)
{
return jsUndefined();
}
}
#endif // ENABLE(WEBGL)