Lines Matching refs:GraphicsContext3D
457 GraphicsContext3D::Attributes adjustAttributes(const GraphicsContext3D::Attributes& attributes, Settings* settings)
459 GraphicsContext3D::Attributes adjustedAttributes = attributes;
469 class WebGLRenderingContextLostCallback : public GraphicsContext3D::ContextLostCallback {
479 class WebGLRenderingContextErrorMessageCallback : public GraphicsContext3D::ErrorMessageCallback {
509 GraphicsContext3D::Attributes requestedAttributes = attrs ? attrs->attributes() : GraphicsContext3D::Attributes();
515 GraphicsContext3D::Attributes attributes = adjustAttributes(requestedAttributes, settings);
517 RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attributes));
539 WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassRefPtr<GraphicsContext3D> context, GraphicsContext3D::Attributes attributes, GraphicsContext3D::Attributes requestedAttributes)
564 m_context->getIntegerv(GraphicsContext3D::MAX_VIEWPORT_DIMS, m_maxViewportDims);
617 m_unpackColorspaceConversion = GraphicsContext3D::BROWSER_DEFAULT_WEBGL;
640 m_context->getIntegerv(GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS, &numCombinedTextureImageUnits);
645 m_context->getIntegerv(GraphicsContext3D::MAX_VERTEX_ATTRIBS, &numVertexAttribs);
649 m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_maxTextureSize);
652 m_context->getIntegerv(GraphicsContext3D::MAX_CUBE_MAP_TEXTURE_SIZE, &m_maxCubeMapTextureSize);
655 m_context->getIntegerv(GraphicsContext3D::MAX_RENDERBUFFER_SIZE, &m_maxRenderbufferSize);
661 m_backDrawBuffer = GraphicsContext3D::BACK;
748 // GraphicsContext3D, otherwise shared objects may not be properly deleted.
813 m_context->disable(GraphicsContext3D::SCISSOR_TEST);
814 if (combinedClear && (mask & GraphicsContext3D::COLOR_BUFFER_BIT))
822 GC3Dbitfield clearMask = GraphicsContext3D::COLOR_BUFFER_BIT;
824 if (!combinedClear || !m_depthMask || !(mask & GraphicsContext3D::DEPTH_BUFFER_BIT))
826 clearMask |= GraphicsContext3D::DEPTH_BUFFER_BIT;
830 if (combinedClear && (mask & GraphicsContext3D::STENCIL_BUFFER_BIT))
834 clearMask |= GraphicsContext3D::STENCIL_BUFFER_BIT;
835 m_context->stencilMaskSeparate(GraphicsContext3D::FRONT, 0xFFFFFFFF);
842 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, objectOrZero(m_framebufferBinding.get()));
855 m_context->enable(GraphicsContext3D::SCISSOR_TEST);
862 m_context->stencilMaskSeparate(GraphicsContext3D::FRONT, m_stencilMask);
902 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, objectOrZero(m_framebufferBinding.get()));
917 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, objectOrZero(m_framebufferBinding.get()));
952 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, objectOrZero(m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get()));
953 m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, objectOrZero(m_renderbufferBinding.get()));
955 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, objectOrZero(m_framebufferBinding.get()));
971 case GraphicsContext3D::BYTE:
973 case GraphicsContext3D::UNSIGNED_BYTE:
975 case GraphicsContext3D::SHORT:
977 case GraphicsContext3D::UNSIGNED_SHORT:
979 case GraphicsContext3D::INT:
981 case GraphicsContext3D::UNSIGNED_INT:
983 case GraphicsContext3D::FLOAT:
994 if (texture - GraphicsContext3D::TEXTURE0 >= m_textureUnits.size()) {
995 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "activeTexture", "texture unit out of range");
998 m_activeTextureUnit = texture - GraphicsContext3D::TEXTURE0;
1010 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "attachShader", "shader attachment already has shader");
1026 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "bindAttribLocation", "reserved prefix");
1030 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bindAttribLocation", "index out of range");
1043 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "object not from this context");
1059 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "bindBuffer", "buffers can not be used with multiple targets");
1062 if (target == GraphicsContext3D::ARRAY_BUFFER)
1064 else if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER)
1067 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "bindBuffer", "invalid target");
1083 if (target != GraphicsContext3D::FRAMEBUFFER) {
1084 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "bindFramebuffer", "invalid target");
1106 if (target != GraphicsContext3D::RENDERBUFFER) {
1107 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "bindRenderbuffer", "invalid target");
1124 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "bindTexture", "textures can not be used with multiple targets");
1128 if (target == GraphicsContext3D::TEXTURE_2D) {
1135 } else if (target == GraphicsContext3D::TEXTURE_CUBE_MAP) {
1139 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "bindTexture", "invalid target");
1202 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "size < 0");
1206 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "size == 0");
1221 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "no data");
1235 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "no data");
1246 WebGLBuffer* buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContext3D::STATIC_DRAW);
1250 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferSubData", "offset < 0");
1263 WebGLBuffer* buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContext3D::STATIC_DRAW);
1267 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferSubData", "offset < 0");
1279 return GraphicsContext3D::FRAMEBUFFER_UNSUPPORTED;
1280 if (target != GraphicsContext3D::FRAMEBUFFER) {
1281 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "checkFramebufferStatus", "invalid target");
1285 return GraphicsContext3D::FRAMEBUFFER_COMPLETE;
1288 if (result != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
1300 if (mask & ~(GraphicsContext3D::COLOR_BUFFER_BIT | GraphicsContext3D::DEPTH_BUFFER_BIT | GraphicsContext3D::STENCIL_BUFFER_BIT)) {
1301 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "clear", "invalid mask");
1305 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
1306 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "clear", reason);
1376 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexImage2D", "invalid internalformat");
1380 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "border not 0");
1393 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "level > 0 not power of 2");
1397 graphicsContext3D()->compressedTexImage2D(target, level, internalformat, width, height,
1399 tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE);
1410 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexSubImage2D", "invalid format");
1421 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "compressedTexSubImage2D", "format does not match texture format");
1428 graphicsContext3D()->compressedTexSubImage2D(target, level, xoffset, yoffset,
1434 if (GraphicsContext3D::getClearBitsByFormat(format) & (GraphicsContext3D::DEPTH_BUFFER_BIT | GraphicsContext3D::STENCIL_BUFFER_BIT)) {
1435 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "format can not be set, only rendered to");
1445 if (!validateTexFuncParameters("copyTexImage2D", NotTexSubImage2D, target, level, internalformat, width, height, border, internalformat, GraphicsContext3D::UNSIGNED_BYTE))
1453 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "copyTexImage2D", "framebuffer is incompatible format");
1457 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyTexImage2D", "level > 0 not power of 2");
1461 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
1462 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "copyTexImage2D", reason);
1469 tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE);
1485 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyTexSubImage2D", "bad dimensions");
1489 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyTexSubImage2D", "rectangle out of range");
1496 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "copyTexSubImage2D", "framebuffer is incompatible format");
1500 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
1501 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "copyTexSubImage2D", reason);
1570 if (type != GraphicsContext3D::VERTEX_SHADER && type != GraphicsContext3D::FRAGMENT_SHADER) {
1571 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "createShader", "invalid shader type");
1585 case GraphicsContext3D::FRONT_AND_BACK:
1586 case GraphicsContext3D::FRONT:
1587 case GraphicsContext3D::BACK:
1590 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "cullFace", "invalid mode");
1601 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "delete", "object does not belong to this context");
1607 object->deleteObject(graphicsContext3D());
1694 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "depthRange", "zNear > zFar");
1705 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "detachShader", "shader not attached");
1709 shader->onDetached(graphicsContext3D());
1716 if (cap == GraphicsContext3D::STENCIL_TEST) {
1721 if (cap == GraphicsContext3D::SCISSOR_TEST) {
1733 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "disableVertexAttribArray", "index out of range");
1761 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no object or object deleted");
1765 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "object does not belong to this context");
1833 if (cap == GraphicsContext3D::STENCIL_TEST) {
1838 if (cap == GraphicsContext3D::SCISSOR_TEST) {
1850 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "enableVertexAttribArray", "index out of range");
1878 if (renderbuffertarget != GraphicsContext3D::RENDERBUFFER) {
1879 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "framebufferRenderbuffer", "invalid target");
1883 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "framebufferRenderbuffer", "no buffer or buffer not from this context");
1890 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "framebufferRenderbuffer", "no framebuffer bound");
1895 case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT:
1897 m_context->framebufferRenderbuffer(target, GraphicsContext3D::DEPTH_ATTACHMENT, renderbuffertarget, bufferObject);
1898 m_context->framebufferRenderbuffer(target, GraphicsContext3D::STENCIL_ATTACHMENT, renderbuffertarget, bufferObject);
1902 synthesizeGLError(GraphicsContext3D::OUT_OF_MEMORY, "framebufferRenderbuffer", "out of memory");
1905 m_context->framebufferRenderbuffer(target, GraphicsContext3D::DEPTH_ATTACHMENT, renderbuffertarget, bufferObject);
1906 m_context->framebufferRenderbuffer(target, GraphicsContext3D::STENCIL_ATTACHMENT, renderbuffertarget, objectOrZero(emulatedStencilBuffer));
1921 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "framebufferTexture2D", "level not 0");
1925 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "framebufferTexture2D", "no texture or texture not from this context");
1932 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "framebufferTexture2D", "no framebuffer bound");
1937 case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT:
1938 m_context->framebufferTexture2D(target, GraphicsContext3D::DEPTH_ATTACHMENT, textarget, textureObject, level);
1939 m_context->framebufferTexture2D(target, GraphicsContext3D::STENCIL_ATTACHMENT, textarget, textureObject, level);
1941 case GraphicsContext3D::DEPTH_ATTACHMENT:
1944 case GraphicsContext3D::STENCIL_ATTACHMENT:
1959 case GraphicsContext3D::CW:
1960 case GraphicsContext3D::CCW:
1963 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "frontFace", "invalid mode");
1977 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "generateMipmap", "level 0 not power of 2 or not all the same size");
1987 if (tex->getMinFilter() != GraphicsContext3D::NEAREST_MIPMAP_LINEAR) {
1988 m_context->texParameteri(target, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST_MIPMAP_LINEAR);
1995 m_context->texParameteri(target, GraphicsContext3D::TEXTURE_MIN_FILTER, tex->getMinFilter());
2027 GraphicsContext3D::VERTEX_SHADER,
2028 GraphicsContext3D::FRAGMENT_SHADER
2049 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "getAttribLocation", "program not linked");
2059 if (target != GraphicsContext3D::ARRAY_BUFFER && target != GraphicsContext3D::ELEMENT_ARRAY_BUFFER) {
2060 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getBufferParameter", "invalid target");
2064 if (pname != GraphicsContext3D::BUFFER_SIZE && pname != GraphicsContext3D::BUFFER_USAGE) {
2065 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getBufferParameter", "invalid parameter name");
2071 if (pname == GraphicsContext3D::BUFFER_SIZE)
2085 // GraphicsContext3D or DrawingBuffer.
2091 // The DrawingBuffer obtains its parameters from GraphicsContext3D::getContextAttributes(),
2106 return GraphicsContext3D::NO_ERROR;
2150 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "getFramebufferAttachmentParameter", "no framebuffer bound");
2156 if (pname == GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)
2157 return WebGLGetInfo(GraphicsContext3D::NONE);
2160 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name");
2167 case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
2168 return WebGLGetInfo(GraphicsContext3D::TEXTURE);
2169 case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
2171 case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
2172 case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
2179 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name for texture attachment");
2184 case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
2185 return WebGLGetInfo(GraphicsContext3D::RENDERBUFFER);
2186 case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
2189 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name for renderbuffer attachment");
2201 case GraphicsContext3D::ACTIVE_TEXTURE:
2203 case GraphicsContext3D::ALIASED_LINE_WIDTH_RANGE:
2205 case GraphicsContext3D::ALIASED_POINT_SIZE_RANGE:
2207 case GraphicsContext3D::ALPHA_BITS:
2209 case GraphicsContext3D::ARRAY_BUFFER_BINDING:
2211 case GraphicsContext3D::BLEND:
2213 case GraphicsContext3D::BLEND_COLOR:
2215 case GraphicsContext3D::BLEND_DST_ALPHA:
2217 case GraphicsContext3D::BLEND_DST_RGB:
2219 case GraphicsContext3D::BLEND_EQUATION_ALPHA:
2221 case GraphicsContext3D::BLEND_EQUATION_RGB:
2223 case GraphicsContext3D::BLEND_SRC_ALPHA:
2225 case GraphicsContext3D::BLEND_SRC_RGB:
2227 case GraphicsContext3D::BLUE_BITS:
2229 case GraphicsContext3D::COLOR_CLEAR_VALUE:
2231 case GraphicsContext3D::COLOR_WRITEMASK:
2233 case GraphicsContext3D::COMPRESSED_TEXTURE_FORMATS:
2235 case GraphicsContext3D::CULL_FACE:
2237 case GraphicsContext3D::CULL_FACE_MODE:
2239 case GraphicsContext3D::CURRENT_PROGRAM:
2241 case GraphicsContext3D::DEPTH_BITS:
2245 case GraphicsContext3D::DEPTH_CLEAR_VALUE:
2247 case GraphicsContext3D::DEPTH_FUNC:
2249 case GraphicsContext3D::DEPTH_RANGE:
2251 case GraphicsContext3D::DEPTH_TEST:
2253 case GraphicsContext3D::DEPTH_WRITEMASK:
2255 case GraphicsContext3D::DITHER:
2257 case GraphicsContext3D::ELEMENT_ARRAY_BUFFER_BINDING:
2259 case GraphicsContext3D::FRAMEBUFFER_BINDING:
2261 case GraphicsContext3D::FRONT_FACE:
2263 case GraphicsContext3D::GENERATE_MIPMAP_HINT:
2265 case GraphicsContext3D::GREEN_BITS:
2267 case GraphicsContext3D::LINE_WIDTH:
2269 case GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS:
2271 case GraphicsContext3D::MAX_CUBE_MAP_TEXTURE_SIZE:
2273 case GraphicsContext3D::MAX_FRAGMENT_UNIFORM_VECTORS:
2275 case GraphicsContext3D::MAX_RENDERBUFFER_SIZE:
2277 case GraphicsContext3D::MAX_TEXTURE_IMAGE_UNITS:
2279 case GraphicsContext3D::MAX_TEXTURE_SIZE:
2281 case GraphicsContext3D::MAX_VARYING_VECTORS:
2283 case GraphicsContext3D::MAX_VERTEX_ATTRIBS:
2285 case GraphicsContext3D::MAX_VERTEX_TEXTURE_IMAGE_UNITS:
2287 case GraphicsContext3D::MAX_VERTEX_UNIFORM_VECTORS:
2289 case GraphicsContext3D::MAX_VIEWPORT_DIMS:
2291 case GraphicsContext3D::NUM_SHADER_BINARY_FORMATS:
2294 case GraphicsContext3D::PACK_ALIGNMENT:
2296 case GraphicsContext3D::POLYGON_OFFSET_FACTOR:
2298 case GraphicsContext3D::POLYGON_OFFSET_FILL:
2300 case GraphicsContext3D::POLYGON_OFFSET_UNITS:
2302 case GraphicsContext3D::RED_BITS:
2304 case GraphicsContext3D::RENDERBUFFER_BINDING:
2306 case GraphicsContext3D::RENDERER:
2308 case GraphicsContext3D::SAMPLE_BUFFERS:
2310 case GraphicsContext3D::SAMPLE_COVERAGE_INVERT:
2312 case GraphicsContext3D::SAMPLE_COVERAGE_VALUE:
2314 case GraphicsContext3D::SAMPLES:
2316 case GraphicsContext3D::SCISSOR_BOX:
2318 case GraphicsContext3D::SCISSOR_TEST:
2320 case GraphicsContext3D::SHADING_LANGUAGE_VERSION:
2321 return WebGLGetInfo("WebGL GLSL ES 1.0 (" + m_context->getString(GraphicsContext3D::SHADING_LANGUAGE_VERSION) + ")");
2322 case GraphicsContext3D::STENCIL_BACK_FAIL:
2324 case GraphicsContext3D::STENCIL_BACK_FUNC:
2326 case GraphicsContext3D::STENCIL_BACK_PASS_DEPTH_FAIL:
2328 case GraphicsContext3D::STENCIL_BACK_PASS_DEPTH_PASS:
2330 case GraphicsContext3D::STENCIL_BACK_REF:
2332 case GraphicsContext3D::STENCIL_BACK_VALUE_MASK:
2334 case GraphicsContext3D::STENCIL_BACK_WRITEMASK:
2336 case GraphicsContext3D::STENCIL_BITS:
2340 case GraphicsContext3D::STENCIL_CLEAR_VALUE:
2342 case GraphicsContext3D::STENCIL_FAIL:
2344 case GraphicsContext3D::STENCIL_FUNC:
2346 case GraphicsContext3D::STENCIL_PASS_DEPTH_FAIL:
2348 case GraphicsContext3D::STENCIL_PASS_DEPTH_PASS:
2350 case GraphicsContext3D::STENCIL_REF:
2352 case GraphicsContext3D::STENCIL_TEST:
2354 case GraphicsContext3D::STENCIL_VALUE_MASK:
2356 case GraphicsContext3D::STENCIL_WRITEMASK:
2358 case GraphicsContext3D::SUBPIXEL_BITS:
2360 case GraphicsContext3D::TEXTURE_BINDING_2D:
2362 case GraphicsContext3D::TEXTURE_BINDING_CUBE_MAP:
2364 case GraphicsContext3D::UNPACK_ALIGNMENT:
2366 case GraphicsContext3D::UNPACK_FLIP_Y_WEBGL:
2368 case GraphicsContext3D::UNPACK_PREMULTIPLY_ALPHA_WEBGL:
2370 case GraphicsContext3D::UNPACK_COLORSPACE_CONVERSION_WEBGL:
2372 case GraphicsContext3D::VENDOR:
2374 case GraphicsContext3D::VERSION:
2375 return WebGLGetInfo("WebGL 1.0 (" + m_context->getString(GraphicsContext3D::VERSION) + ")");
2376 case GraphicsContext3D::VIEWPORT:
2381 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getParameter", "invalid parameter name, OES_standard_derivatives not enabled");
2385 return WebGLGetInfo(m_context->getString(GraphicsContext3D::RENDERER));
2386 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getParameter", "invalid parameter name, WEBGL_debug_renderer_info not enabled");
2390 return WebGLGetInfo(m_context->getString(GraphicsContext3D::VENDOR));
2391 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getParameter", "invalid parameter name, WEBGL_debug_renderer_info not enabled");
2399 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getParameter", "invalid parameter name, OES_vertex_array_object not enabled");
2404 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getParameter", "invalid parameter name, EXT_texture_filter_anisotropic not enabled");
2409 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getParameter", "invalid parameter name, WEBGL_draw_buffers not enabled");
2414 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getParameter", "invalid parameter name, WEBGL_draw_buffers not enabled");
2420 GC3Dint value = GraphicsContext3D::NONE;
2427 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getParameter", "invalid parameter name");
2439 case GraphicsContext3D::DELETE_STATUS:
2441 case GraphicsContext3D::VALIDATE_STATUS:
2444 case GraphicsContext3D::LINK_STATUS:
2446 case GraphicsContext3D::ATTACHED_SHADERS:
2447 case GraphicsContext3D::ACTIVE_ATTRIBUTES:
2448 case GraphicsContext3D::ACTIVE_UNIFORMS:
2452 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getProgramParameter", "invalid parameter name");
2470 if (target != GraphicsContext3D::RENDERBUFFER) {
2471 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getRenderbufferParameter", "invalid target");
2475 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "getRenderbufferParameter", "no renderbuffer bound");
2481 case GraphicsContext3D::RENDERBUFFER_WIDTH:
2482 case GraphicsContext3D::RENDERBUFFER_HEIGHT:
2483 case GraphicsContext3D::RENDERBUFFER_RED_SIZE:
2484 case GraphicsContext3D::RENDERBUFFER_GREEN_SIZE:
2485 case GraphicsContext3D::RENDERBUFFER_BLUE_SIZE:
2486 case GraphicsContext3D::RENDERBUFFER_ALPHA_SIZE:
2487 case GraphicsContext3D::RENDERBUFFER_DEPTH_SIZE:
2490 case GraphicsContext3D::RENDERBUFFER_STENCIL_SIZE:
2499 case GraphicsContext3D::RENDERBUFFER_INTERNAL_FORMAT:
2502 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getRenderbufferParameter", "invalid parameter name");
2513 case GraphicsContext3D::DELETE_STATUS:
2515 case GraphicsContext3D::COMPILE_STATUS:
2518 case GraphicsContext3D::SHADER_TYPE:
2522 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getShaderParameter", "invalid parameter name");
2541 case GraphicsContext3D::VERTEX_SHADER:
2542 case GraphicsContext3D::FRAGMENT_SHADER:
2545 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getShaderPrecisionFormat", "invalid shader type");
2549 case GraphicsContext3D::LOW_FLOAT:
2550 case GraphicsContext3D::MEDIUM_FLOAT:
2551 case GraphicsContext3D
2552 case GraphicsContext3D::LOW_INT:
2553 case GraphicsContext3D::MEDIUM_INT:
2554 case GraphicsContext3D::HIGH_INT:
2557 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getShaderPrecisionFormat", "invalid precision type");
2604 case GraphicsContext3D::TEXTURE_MAG_FILTER:
2605 case GraphicsContext3D::TEXTURE_MIN_FILTER:
2606 case GraphicsContext3D::TEXTURE_WRAP_S:
2607 case GraphicsContext3D::TEXTURE_WRAP_T:
2615 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getTexParameter", "invalid parameter name, EXT_texture_filter_anisotropic not enabled");
2618 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getTexParameter", "invalid parameter name");
2628 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "getUniform", "no uniformlocation or not valid for this program");
2635 m_context->getProgramiv(objectOrZero(program), GraphicsContext3D::ACTIVE_UNIFORMS, &activeUniforms);
2658 case GraphicsContext3D::BOOL:
2659 baseType = GraphicsContext3D::BOOL;
2662 case GraphicsContext3D::BOOL_VEC2:
2663 baseType = GraphicsContext3D::BOOL;
2666 case GraphicsContext3D::BOOL_VEC3:
2667 baseType = GraphicsContext3D::BOOL;
2670 case GraphicsContext3D::BOOL_VEC4:
2671 baseType = GraphicsContext3D::BOOL;
2674 case GraphicsContext3D::INT:
2675 baseType = GraphicsContext3D::INT;
2678 case GraphicsContext3D::INT_VEC2:
2679 baseType = GraphicsContext3D::INT;
2682 case GraphicsContext3D::INT_VEC3:
2683 baseType = GraphicsContext3D::INT;
2686 case GraphicsContext3D::INT_VEC4:
2687 baseType = GraphicsContext3D::INT;
2690 case GraphicsContext3D::FLOAT:
2691 baseType = GraphicsContext3D::FLOAT;
2694 case GraphicsContext3D::FLOAT_VEC2:
2695 baseType = GraphicsContext3D::FLOAT;
2698 case GraphicsContext3D::FLOAT_VEC3:
2699 baseType = GraphicsContext3D::FLOAT;
2702 case GraphicsContext3D::FLOAT_VEC4:
2703 baseType = GraphicsContext3D::FLOAT;
2706 case GraphicsContext3D::FLOAT_MAT2:
2707 baseType = GraphicsContext3D::FLOAT;
2710 case GraphicsContext3D::FLOAT_MAT3:
2711 baseType = GraphicsContext3D::FLOAT;
2714 case GraphicsContext3D::FLOAT_MAT4:
2715 baseType = GraphicsContext3D::FLOAT;
2718 case GraphicsContext3D::SAMPLER_2D:
2719 case GraphicsContext3D::SAMPLER_CUBE:
2720 baseType = GraphicsContext3D::INT;
2725 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "getUniform", "unhandled type");
2729 case GraphicsContext3D::FLOAT: {
2736 case GraphicsContext3D::INT: {
2743 case GraphicsContext3D::BOOL: {
2761 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "getUniform", "unknown error");
2776 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "getUniformLocation", "program not linked");
2790 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "getVertexAttrib", "index out of range");
2799 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
2803 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_ENABLED:
2805 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_NORMALIZED:
2807 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_SIZE:
2809 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_STRIDE:
2811 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_TYPE:
2813 case GraphicsContext3D::CURRENT_VERTEX_ATTRIB:
2816 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getVertexAttrib", "invalid parameter name");
2825 if (pname != GraphicsContext3D::VERTEX_ATTRIB_ARRAY_POINTER) {
2826 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getVertexAttribOffset", "invalid parameter name");
2839 case GraphicsContext3D::GENERATE_MIPMAP_HINT:
2848 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "hint", "invalid target");
2874 if (cap == GraphicsContext3D::STENCIL_TEST)
2949 case GraphicsContext3D::UNPACK_FLIP_Y_WEBGL:
2952 case GraphicsContext3D::UNPACK_PREMULTIPLY_ALPHA_WEBGL:
2955 case GraphicsContext3D::UNPACK_COLORSPACE_CONVERSION_WEBGL:
2956 if (param == GraphicsContext3D::BROWSER_DEFAULT_WEBGL || param == GraphicsContext3D::NONE)
2959 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "pixelStorei", "invalid parameter for UNPACK_COLORSPACE_CONVERSION_WEBGL");
2963 case GraphicsContext3D::PACK_ALIGNMENT:
2964 case GraphicsContext3D::UNPACK_ALIGNMENT:
2966 if (pname == GraphicsContext3D::PACK_ALIGNMENT)
2968 else // GraphicsContext3D::UNPACK_ALIGNMENT:
2972 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "pixelStorei", "invalid parameter for alignment");
2977 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "pixelStorei", "invalid parameter name");
2998 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "readPixels", "no destination ArrayBufferView");
3002 case GraphicsContext3D::ALPHA:
3003 case GraphicsContext3D::RGB:
3004 case GraphicsContext3D::RGBA:
3007 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "readPixels", "invalid format");
3011 case GraphicsContext3D::UNSIGNED_BYTE:
3012 case GraphicsContext3D::UNSIGNED_SHORT_5_6_5:
3013 case GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4:
3014 case GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1:
3017 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "readPixels", "invalid type");
3020 if (format != GraphicsContext3D::RGBA || type != GraphicsContext3D::UNSIGNED_BYTE) {
3021 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "readPixels", "format not RGBA or type not UNSIGNED_BYTE");
3026 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "readPixels", "ArrayBufferView not Uint8Array");
3030 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
3031 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "readPixels", reason);
3038 if (error != GraphicsContext3D::NO_ERROR) {
3043 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "readPixels", "ArrayBufferView not large enough for dimensions");
3075 if (target != GraphicsContext3D::RENDERBUFFER) {
3076 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "renderbufferStorage", "invalid target");
3080 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "renderbufferStorage", "no bound renderbuffer");
3086 case GraphicsContext3D::DEPTH_COMPONENT16:
3087 case GraphicsContext3D::RGBA4:
3088 case GraphicsContext3D::RGB5_A1:
3089 case GraphicsContext3D::RGB565:
3090 case GraphicsContext3D::STENCIL_INDEX8:
3096 case GraphicsContext3D::DEPTH_STENCIL:
3102 synthesizeGLError(GraphicsContext3D::OUT_OF_MEMORY, "renderbufferStorage", "out of memory");
3105 m_context->renderbufferStorage(target, GraphicsContext3D::DEPTH_COMPONENT16, width, height);
3107 m_context->renderbufferStorage(target, GraphicsContext3D::STENCIL_INDEX8, width, height);
3110 emulatedStencilBuffer->setInternalFormat(GraphicsContext3D::STENCIL_INDEX8);
3116 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "renderbufferStorage", "invalid internalformat");
3169 case GraphicsContext3D::FRONT_AND_BACK:
3175 case GraphicsContext3D::FRONT:
3179 case GraphicsContext3D::BACK:
3184 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "stencilFuncSeparate", "invalid face");
3204 case GraphicsContext3D::FRONT_AND_BACK:
3208 case GraphicsContext3D::FRONT:
3211 case GraphicsContext3D::BACK:
3215 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "stencilMaskSeparate", "invalid face");
3249 void WebGLRenderingContext::texImage2DImpl(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, Image* image, GraphicsContext3D::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& es)
3253 GraphicsContext3D::ImageExtractor imageExtractor(image, domSource, premultiplyAlpha, m_unpackColorspaceConversion == GraphicsContext3D::NONE);
3255 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "bad image data");
3258 GraphicsContext3D::DataFormat sourceDataFormat = imageExtractor.imageSourceFormat();
3259 GraphicsContext3D::AlphaOp alphaOp = imageExtractor.imageAlphaOp();
3263 if (type == GraphicsContext3D::UNSIGNED_BYTE && sourceDataFormat == GraphicsContext3D::DataFormatRGBA8 && format == GraphicsContext3D::RGBA && alphaOp == GraphicsContext3D::AlphaDoNothing && !flipY)
3267 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "packImage error");
3273 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
3276 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
3290 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "level > 0 not power of 2");
3306 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "bad dimensions");
3310 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "dimensions out of range");
3314 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type and format do not match texture");
3343 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
3346 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
3358 if (!m_unpackFlipY && !m_unpackPremultiplyAlpha && format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE)
3362 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "bad image data");
3367 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
3370 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
3382 texImage2DImpl(target, level, internalformat, format, type, imageForRender, GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
3394 if (GraphicsContext3D::TEXTURE_2D == target && texture) {
3406 texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(), GraphicsContext3D::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
3414 synthesizeGLError(GraphicsContext3D::OUT_OF_MEMORY, "texImage2D", "out of memory");
3433 if (GraphicsContext3D::TEXTURE_2D == target && texture) {
3444 texImage2DImpl(target, level, internalformat, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
3455 case GraphicsContext3D::TEXTURE_MIN_FILTER:
3456 case GraphicsContext3D::TEXTURE_MAG_FILTER:
3458 case GraphicsContext3D::TEXTURE_WRAP_S:
3459 case GraphicsContext3D::TEXTURE_WRAP_T:
3460 if ((isFloat && paramf != GraphicsContext3D::CLAMP_TO_EDGE && paramf != GraphicsContext3D::MIRRORED_REPEAT && paramf != GraphicsContext3D::REPEAT)
3461 || (!isFloat && parami != GraphicsContext3D::CLAMP_TO_EDGE && parami != GraphicsContext3D::MIRRORED_REPEAT && parami != GraphicsContext3D::REPEAT)) {
3462 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "texParameter", "invalid parameter");
3468 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "texParameter", "invalid parameter, EXT_texture_filter_anisotropic not enabled");
3473 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "texParameter", "invalid parameter name");
3516 void WebGLRenderingContext::texSubImage2DImpl(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, Image* image, GraphicsContext3D::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& es)
3520 GraphicsContext3D::ImageExtractor imageExtractor(image, domSource, premultiplyAlpha, m_unpackColorspaceConversion == GraphicsContext3D::NONE);
3522 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "bad image");
3525 GraphicsContext3D::DataFormat sourceDataFormat = imageExtractor.imageSourceFormat();
3526 GraphicsContext3D::AlphaOp alphaOp = imageExtractor.imageAlphaOp();
3530 if (type == GraphicsContext3D::UNSIGNED_BYTE && sourceDataFormat == GraphicsContext3D::DataFormatRGBA8 && format == GraphicsContext3D::RGBA && alphaOp == GraphicsContext3D::AlphaDoNothing && !flipY)
3534 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "bad image data");
3540 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
3543 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
3567 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
3570 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
3583 if (format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE && !m_unpackFlipY && !m_unpackPremultiplyAlpha)
3587 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "bad image data");
3592 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
3595 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
3607 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRender, GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
3621 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(), GraphicsContext3D::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
3634 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
3643 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform1f", "location not for current program");
3672 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform1i", "location not for current program");
3701 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform2f", "location not for current program");
3730 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform2i", "location not for current program");
3759 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform3f", "location not for current program");
3788 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform3i", "location not for current program");
3817 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform4f", "location not for current program");
3846 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform4i", "location not for current program");
3919 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "useProgram", "program not valid");
3924 m_currentProgram->onDetached(graphicsContext3D());
4004 case GraphicsContext3D::BYTE:
4005 case GraphicsContext3D::UNSIGNED_BYTE:
4006 case GraphicsContext3D::SHORT:
4007 case GraphicsContext3D::UNSIGNED_SHORT:
4008 case GraphicsContext3D::FLOAT:
4011 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "vertexAttribPointer", "invalid type");
4015 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "vertexAttribPointer", "index out of range");
4019 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "vertexAttribPointer", "bad size, stride or offset");
4023 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "vertexAttribPointer", "no bound ARRAY_BUFFER");
4029 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "vertexAttribPointer", "invalid type");
4033 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "vertexAttribPointer", "stride or offset not valid for type");
4048 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "vertexAttribDivisorANGLE", "index out of range");
4068 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "loseContext", "context already lost");
4110 synthesizeGLError(GraphicsContext3D::CONTEXT_LOST_WEBGL, "loseContext", "context lost", display);
4124 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "restoreContext", "context not lost");
4130 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "restoreContext", "context restoration not allowed");
4196 if (pname != GraphicsContext3D::COLOR_WRITEMASK) {
4240 case GraphicsContext3D::ALIASED_POINT_SIZE_RANGE:
4241 case GraphicsContext3D::ALIASED_LINE_WIDTH_RANGE:
4242 case GraphicsContext3D::DEPTH_RANGE:
4245 case GraphicsContext3D::BLEND_COLOR:
4246 case GraphicsContext3D::COLOR_CLEAR_VALUE:
4262 case GraphicsContext3D::MAX_VIEWPORT_DIMS:
4265 case GraphicsContext3D::SCISSOR_BOX:
4266 case GraphicsContext3D::VIEWPORT:
4305 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, objectOrZero(tex2D));
4307 m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, objectOrZero(texCubeMap));
4319 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_blackTexture2D->object());
4320 m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, 1, 1,
4321 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
4322 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
4324 m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, m_blackTextureCubeMap->object());
4325 m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X, 0, GraphicsContext3D::RGBA, 1, 1,
4326 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
4327 m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GraphicsContext3D::RGBA, 1, 1,
4328 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
4329 m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GraphicsContext3D::RGBA, 1, 1,
4330 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
4331 m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GraphicsContext3D::RGBA, 1, 1,
4332 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
4333 m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GraphicsContext3D::RGBA, 1, 1,
4334 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
4335 m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GraphicsContext3D::RGBA, 1, 1,
4336 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
4337 m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, 0);
4343 unsigned need = GraphicsContext3D::getChannelBitsByFormat(texInternalFormat);
4344 unsigned have = GraphicsContext3D::getChannelBitsByFormat(colorBufferFormat);
4353 return GraphicsContext3D::RGBA;
4354 return GraphicsContext3D::RGB;
4375 case GraphicsContext3D::TEXTURE_2D:
4378 case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X:
4379 case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X:
4380 case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Y:
4381 case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y:
4382 case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z:
4383 case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z:
4385 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture target");
4390 case GraphicsContext3D::TEXTURE_CUBE_MAP:
4392 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture target");
4398 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture target");
4402 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "no texture");
4410 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "location length > 256");
4419 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "size < 0");
4429 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "string not ASCII");
4439 case GraphicsContext3D::ALPHA:
4440 case GraphicsContext3D::LUMINANCE:
4441 case GraphicsContext3D::LUMINANCE_ALPHA:
4442 case GraphicsContext3D::RGB:
4443 case GraphicsContext3D::RGBA:
4445 case GraphicsContext3D::DEPTH_STENCIL:
4446 case GraphicsContext3D::DEPTH_COMPONENT:
4449 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "depth texture formats not enabled");
4452 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture format");
4457 case GraphicsContext3D::UNSIGNED_BYTE:
4458 case GraphicsContext3D::UNSIGNED_SHORT_5_6_5:
4459 case GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4:
4460 case GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1:
4462 case GraphicsContext3D::FLOAT:
4465 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture type");
4467 case GraphicsContext3D::HALF_FLOAT_OES:
4470 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture type");
4472 case GraphicsContext3D::UNSIGNED_INT:
4473 case GraphicsContext3D::UNSIGNED_INT_24_8:
4474 case GraphicsContext3D::UNSIGNED_SHORT:
4477 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture type");
4480 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture type");
4486 case GraphicsContext3D::ALPHA:
4487 case GraphicsContext3D::LUMINANCE:
4488 case GraphicsContext3D::LUMINANCE_ALPHA:
4489 if (type != GraphicsContext3D::UNSIGNED_BYTE
4490 && type != GraphicsContext3D::FLOAT
4491 && type != GraphicsContext3D::HALF_FLOAT_OES) {
4492 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "invalid type for format");
4496 case GraphicsContext3D::RGB:
4497 if (type != GraphicsContext3D::UNSIGNED_BYTE
4498 && type != GraphicsContext3D::UNSIGNED_SHORT_5_6_5
4499 && type != GraphicsContext3D::FLOAT
4500 && type != GraphicsContext3D::HALF_FLOAT_OES) {
4501 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "invalid type for RGB format");
4505 case GraphicsContext3D::RGBA:
4506 if (type != GraphicsContext3D::UNSIGNED_BYTE
4507 && type != GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4
4508 && type != GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1
4509 && type != GraphicsContext3D::FLOAT
4510 && type != GraphicsContext3D::HALF_FLOAT_OES) {
4511 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "invalid type for RGBA format");
4515 case GraphicsContext3D::DEPTH_COMPONENT:
4517 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid format. DEPTH_COMPONENT not enabled");
4520 if (type != GraphicsContext3D::UNSIGNED_SHORT
4521 && type != GraphicsContext3D::UNSIGNED_INT) {
4522 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "invalid type for DEPTH_COMPONENT format");
4526 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "level must be 0 for DEPTH_COMPONENT format");
4530 case GraphicsContext3D::DEPTH_STENCIL:
4532 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid format. DEPTH_STENCIL not enabled");
4535 if (type != GraphicsContext3D::UNSIGNED_INT_24_8) {
4536 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "invalid type for DEPTH_STENCIL format");
4540 synthesizeGLError(GraphicsContext3D
4554 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "level < 0");
4558 case GraphicsContext3D::TEXTURE_2D:
4560 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "level out of range");
4564 case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X:
4565 case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X:
4566 case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Y:
4567 case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y:
4568 case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z:
4569 case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z:
4571 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "level out of range");
4595 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height < 0");
4600 case GraphicsContext3D::TEXTURE_2D:
4602 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height out of range");
4606 case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X:
4607 case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X:
4608 case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Y:
4609 case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y:
4610 case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z:
4611 case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z:
4613 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width != height for cube map");
4619 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height out of range for cube map");
4624 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid target");
4629 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "format != internalformat");
4634 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "border != 0");
4651 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no pixels");
4661 case GraphicsContext3D::UNSIGNED_BYTE:
4663 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type UNSIGNED_BYTE but ArrayBufferView not Uint8Array");
4667 case GraphicsContext3D::UNSIGNED_SHORT_5_6_5:
4668 case GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4:
4669 case GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1:
4671 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type UNSIGNED_SHORT but ArrayBufferView not Uint16Array");
4675 case GraphicsContext3D::FLOAT: // OES_texture_float
4677 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type FLOAT but ArrayBufferView not Float32Array");
4681 case GraphicsContext3D::HALF_FLOAT_OES: // OES_texture_half_float
4685 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type HALF_FLOAT_OES but ArrayBufferView is not NULL");
4695 if (error != GraphicsContext3D::NO_ERROR) {
4703 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "ArrayBufferView not big enough for request with UNPACK_ALIGNMENT > 1");
4707 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "ArrayBufferView not big enough for request");
4723 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no pixels");
4727 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height < 0");
4781 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid format");
4786 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "length of ArrayBufferView is not correct for dimensions");
4805 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "width or height invalid for level");
4819 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "xoffset or yoffset < 0");
4831 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "xoffset or yoffset not multiple of 4");
4836 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "dimensions out of range");
4849 case GraphicsContext3D::POINTS:
4850 case GraphicsContext3D::LINE_STRIP:
4851 case GraphicsContext3D::LINE_LOOP:
4852 case GraphicsContext3D::LINES:
4853 case GraphicsContext3D::TRIANGLE_STRIP:
4854 case GraphicsContext3D::TRIANGLE_FAN:
4855 case GraphicsContext3D::TRIANGLES:
4858 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid draw mode");
4866 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "front and back stencils settings do not match");
4875 case GraphicsContext3D::NEVER:
4876 case GraphicsContext3D::LESS:
4877 case GraphicsContext3D::LEQUAL:
4878 case GraphicsContext3D::GREATER:
4879 case GraphicsContext3D::GEQUAL:
4880 case GraphicsContext3D::EQUAL:
4881 case GraphicsContext3D::NOTEQUAL:
4882 case GraphicsContext3D::ALWAYS:
4885 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid function");
4916 if (target != GraphicsContext3D::FRAMEBUFFER) {
4917 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid target");
4921 case GraphicsContext3D::COLOR_ATTACHMENT0:
4922 case GraphicsContext3D::DEPTH_ATTACHMENT:
4923 case GraphicsContext3D::STENCIL_ATTACHMENT:
4924 case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT:
4928 && attachment > GraphicsContext3D::COLOR_ATTACHMENT0
4929 && attachment < static_cast<GC3Denum>(GraphicsContext3D::COLOR_ATTACHMENT0 + getMaxColorAttachments()))
4931 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid attachment");
4940 case GraphicsContext3D::FUNC_ADD:
4941 case GraphicsContext3D::FUNC_SUBTRACT:
4942 case GraphicsContext3D::FUNC_REVERSE_SUBTRACT:
4945 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid mode");
4952 if (((src == GraphicsContext3D::CONSTANT_COLOR || src == GraphicsContext3D::ONE_MINUS_CONSTANT_COLOR)
4953 && (dst == GraphicsContext3D::CONSTANT_ALPHA || dst == GraphicsContext3D::ONE_MINUS_CONSTANT_ALPHA))
4954 || ((dst == GraphicsContext3D::CONSTANT_COLOR || dst == GraphicsContext3D::ONE_MINUS_CONSTANT_COLOR)
4955 && (src == GraphicsContext3D::CONSTANT_ALPHA || src == GraphicsContext3D::ONE_MINUS_CONSTANT_ALPHA))) {
4956 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "incompatible src and dst");
4965 case GraphicsContext3D::BLEND:
4966 case GraphicsContext3D::CULL_FACE:
4967 case GraphicsContext3D::DEPTH_TEST:
4968 case GraphicsContext3D::DITHER:
4969 case GraphicsContext3D::POLYGON_OFFSET_FILL:
4970 case GraphicsContext3D::SAMPLE_ALPHA_TO_COVERAGE:
4971 case GraphicsContext3D::SAMPLE_COVERAGE:
4972 case GraphicsContext3D::SCISSOR_TEST:
4973 case GraphicsContext3D::STENCIL_TEST:
4976 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid capability");
4984 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
4993 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
5007 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
5018 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "location is not from current program");
5022 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
5026 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "transpose not FALSE");
5030 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "invalid size");
5040 case GraphicsContext3D::ELEMENT_ARRAY_BUFFER:
5043 case GraphicsContext3D::ARRAY_BUFFER:
5047 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid target");
5051 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "no buffer");
5055 case GraphicsContext3D::STREAM_DRAW:
5056 case GraphicsContext3D::STATIC_DRAW:
5057 case GraphicsContext3D::DYNAMIC_DRAW:
5060 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid usage");
5067 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no image");
5072 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "invalid image");
5085 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no canvas");
5098 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no video");
5117 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "first or count < 0");
5127 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attribs not setup correctly");
5132 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
5133 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason);
5149 case GraphicsContext3D::UNSIGNED_BYTE:
5150 case GraphicsContext3D::UNSIGNED_SHORT:
5152 case GraphicsContext3D::UNSIGNED_INT:
5155 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid type");
5158 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid type");
5163 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "count or offset < 0");
5173 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "no ELEMENT_ARRAY_BUFFER bound");
5178 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attribs not setup correctly");
5183 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
5184 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason);
5195 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "primcount < 0");
5206 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "at least one enabled attribute must have a divisor of 0");
5215 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "index out of range");
5245 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
5256 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
5260 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "invalid size");
5264 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "index out of range");
5326 RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(m_attributes));
5333 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "", "error restoring context");
5339 // Construct a new drawing buffer with the new GraphicsContext3D.
5407 case GraphicsContext3D::INVALID_ENUM:
5409 case GraphicsContext3D::INVALID_VALUE:
5411 case GraphicsContext3D
5413 case GraphicsContext3D::OUT_OF_MEMORY:
5415 case GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION:
5417 case GraphicsContext3D::CONTEXT_LOST_WEBGL:
5461 enableOrDisable(GraphicsContext3D::STENCIL_TEST,
5509 bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_framebufferBinding.get());
5514 bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get());