Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContext.cpp

Issue 150083005: Use GL_chromium_color_buffer_float extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 3295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3306 m_context->stencilOp(fail, zfail, zpass); 3306 m_context->stencilOp(fail, zfail, zpass);
3307 } 3307 }
3308 3308
3309 void WebGLRenderingContext::stencilOpSeparate(GLenum face, GLenum fail, GLenum z fail, GLenum zpass) 3309 void WebGLRenderingContext::stencilOpSeparate(GLenum face, GLenum fail, GLenum z fail, GLenum zpass)
3310 { 3310 {
3311 if (isContextLost()) 3311 if (isContextLost())
3312 return; 3312 return;
3313 m_context->stencilOpSeparate(face, fail, zfail, zpass); 3313 m_context->stencilOpSeparate(face, fail, zfail, zpass);
3314 } 3314 }
3315 3315
3316 GLenum WebGLRenderingContext::convertTexInternalFormat(GLenum internalformat, GL enum type)
3317 {
3318 // Convert to sized internal formats that are renderable with GL_CHROMIUM_co lor_buffer_float_rgb(a).
3319 if (type == GL_FLOAT && internalformat == GL_RGBA
3320 && m_contextSupport->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_ rgba"))
3321 return GL_RGBA32F_EXT;
3322 if (type == GL_FLOAT && internalformat == GL_RGB
3323 && m_contextSupport->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_ rgb"))
3324 return GL_RGB32F_EXT;
3325 return internalformat;
Ken Russell (switch to Gerrit) 2014/02/11 23:46:52 There aren't any queries whose results need to be
oetuaho-nv 2014/02/12 12:45:36 I couldn't find any other calls where conversions
3326 }
3327
3316 void WebGLRenderingContext::texImage2DBase(GLenum target, GLint level, GLenum in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels, ExceptionState& exceptionState) 3328 void WebGLRenderingContext::texImage2DBase(GLenum target, GLint level, GLenum in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels, ExceptionState& exceptionState)
3317 { 3329 {
3318 // All calling functions check isContextLost, so a duplicate check is not ne eded here. 3330 // All calling functions check isContextLost, so a duplicate check is not ne eded here.
3319 // FIXME: Handle errors. 3331 // FIXME: Handle errors.
3320 WebGLTexture* tex = validateTextureBinding("texImage2D", target, true); 3332 WebGLTexture* tex = validateTextureBinding("texImage2D", target, true);
3321 ASSERT(validateTexFuncParameters("texImage2D", NotTexSubImage2D, target, lev el, internalformat, width, height, border, format, type)); 3333 ASSERT(validateTexFuncParameters("texImage2D", NotTexSubImage2D, target, lev el, internalformat, width, height, border, format, type));
3322 ASSERT(tex); 3334 ASSERT(tex);
3323 ASSERT(!level || !WebGLTexture::isNPOT(width, height)); 3335 ASSERT(!level || !WebGLTexture::isNPOT(width, height));
3324 ASSERT(!pixels || validateSettableTexFormat("texImage2D", internalformat)); 3336 ASSERT(!pixels || validateSettableTexFormat("texImage2D", internalformat));
3325 m_context->texImage2D(target, level, internalformat, width, height, 3337 m_context->texImage2D(target, level, convertTexInternalFormat(internalformat , type), width, height, border, format, type, pixels);
3326 border, format, type, pixels);
3327 tex->setLevelInfo(target, level, internalformat, width, height, type); 3338 tex->setLevelInfo(target, level, internalformat, width, height, type);
3328 } 3339 }
3329 3340
3330 void WebGLRenderingContext::texImage2DImpl(GLenum target, GLint level, GLenum in ternalformat, GLenum format, GLenum type, Image* image, GraphicsContext3D::Image HtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& exce ptionState) 3341 void WebGLRenderingContext::texImage2DImpl(GLenum target, GLint level, GLenum in ternalformat, GLenum format, GLenum type, Image* image, GraphicsContext3D::Image HtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& exce ptionState)
3331 { 3342 {
3332 // All calling functions check isContextLost, so a duplicate check is not ne eded here. 3343 // All calling functions check isContextLost, so a duplicate check is not ne eded here.
3333 Vector<uint8_t> data; 3344 Vector<uint8_t> data;
3334 GraphicsContext3D::ImageExtractor imageExtractor(image, domSource, premultip lyAlpha, m_unpackColorspaceConversion == GL_NONE); 3345 GraphicsContext3D::ImageExtractor imageExtractor(image, domSource, premultip lyAlpha, m_unpackColorspaceConversion == GL_NONE);
3335 if (!imageExtractor.extractSucceeded()) { 3346 if (!imageExtractor.extractSucceeded()) {
3336 synthesizeGLError(GL_INVALID_VALUE, "texImage2D", "bad image data"); 3347 synthesizeGLError(GL_INVALID_VALUE, "texImage2D", "bad image data");
(...skipping 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after
5650 if (m_textureUnits[i].m_texture2DBinding 5661 if (m_textureUnits[i].m_texture2DBinding
5651 || m_textureUnits[i].m_textureCubeMapBinding) { 5662 || m_textureUnits[i].m_textureCubeMapBinding) {
5652 m_onePlusMaxNonDefaultTextureUnit = i + 1; 5663 m_onePlusMaxNonDefaultTextureUnit = i + 1;
5653 return; 5664 return;
5654 } 5665 }
5655 } 5666 }
5656 m_onePlusMaxNonDefaultTextureUnit = 0; 5667 m_onePlusMaxNonDefaultTextureUnit = 0;
5657 } 5668 }
5658 5669
5659 } // namespace WebCore 5670 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698