Commit 6e2439b1 authored by thakis's avatar thakis Committed by Commit bot

reflow comments in modules/webgl

BUG=563793
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2389203002
Cr-Commit-Position: refs/heads/master@{#422803}
parent 41b43609
...@@ -143,7 +143,8 @@ void EXTDisjointTimerQuery::queryCounterEXT(WebGLTimerQueryEXT* query, ...@@ -143,7 +143,8 @@ void EXTDisjointTimerQuery::queryCounterEXT(WebGLTimerQueryEXT* query,
return; return;
} }
// Timestamps are disabled in WebGL due to lack of driver support on multiple platforms, so we don't actually perform a GL call // Timestamps are disabled in WebGL due to lack of driver support on multiple
// platforms, so we don't actually perform a GL call.
query->setTarget(target); query->setTarget(target);
query->resetCachedResult(); query->resetCachedResult();
} }
......
...@@ -473,8 +473,9 @@ void WebGL2RenderingContextBase::framebufferTextureLayer(GLenum target, ...@@ -473,8 +473,9 @@ void WebGL2RenderingContextBase::framebufferTextureLayer(GLenum target,
objectOrZero(texture), level, layer); objectOrZero(texture), level, layer);
} }
if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
// On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMENT + STENCIL_ATTACHMENT. // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMENT +
// We divide it here so in WebGLFramebuffer, we don't have to handle DEPTH_STENCIL_ATTACHMENT in WebGL 2. // STENCIL_ATTACHMENT. We divide it here so in WebGLFramebuffer, we don't
// have to handle DEPTH_STENCIL_ATTACHMENT in WebGL 2.
framebufferBinding->setAttachmentForBoundFramebuffer( framebufferBinding->setAttachmentForBoundFramebuffer(
target, GL_DEPTH_ATTACHMENT, textarget, texture, level, layer); target, GL_DEPTH_ATTACHMENT, textarget, texture, level, layer);
framebufferBinding->setAttachmentForBoundFramebuffer( framebufferBinding->setAttachmentForBoundFramebuffer(
...@@ -505,7 +506,8 @@ ScriptValue WebGL2RenderingContextBase::getInternalformatParameter( ...@@ -505,7 +506,8 @@ ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(
// though GL_RGB and GL_RGBA are color-renderable. // though GL_RGB and GL_RGBA are color-renderable.
case GL_RGB: case GL_RGB:
case GL_RGBA: case GL_RGBA:
// Multisampling is not supported for signed and unsigned integer internal formats. // Multisampling is not supported for signed and unsigned integer internal
// formats.
case GL_R8UI: case GL_R8UI:
case GL_R8I: case GL_R8I:
case GL_R16UI: case GL_R16UI:
...@@ -597,8 +599,8 @@ bool WebGL2RenderingContextBase::checkAndTranslateAttachments( ...@@ -597,8 +599,8 @@ bool WebGL2RenderingContextBase::checkAndTranslateAttachments(
WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target); WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target);
ASSERT(framebufferBinding || drawingBuffer()); ASSERT(framebufferBinding || drawingBuffer());
if (!framebufferBinding) { if (!framebufferBinding) {
// For the default framebuffer // For the default framebuffer, translate GL_COLOR/GL_DEPTH/GL_STENCIL.
// Translate GL_COLOR/GL_DEPTH/GL_STENCIL, because the default framebuffer of WebGL is not fb 0, it is an internal fbo // The default framebuffer of WebGL is not fb 0, it is an internal fbo.
for (size_t i = 0; i < attachments.size(); ++i) { for (size_t i = 0; i < attachments.size(); ++i) {
switch (attachments[i]) { switch (attachments[i]) {
case GL_COLOR: case GL_COLOR:
...@@ -806,8 +808,9 @@ void WebGL2RenderingContextBase::readPixels(GLint x, ...@@ -806,8 +808,9 @@ void WebGL2RenderingContextBase::readPixels(GLint x,
} }
long long size = buffer->getSize() - offset; long long size = buffer->getSize() - offset;
// If size is negative, or size is not large enough to store pixels, those cases // If size is negative, or size is not large enough to store pixels, those
// are handled by validateReadPixelsFuncParameters to generate INVALID_OPERATION. // cases are handled by validateReadPixelsFuncParameters to generate
// INVALID_OPERATION.
if (!validateReadPixelsFuncParameters(width, height, format, type, nullptr, if (!validateReadPixelsFuncParameters(width, height, format, type, nullptr,
size)) size))
return; return;
...@@ -2354,7 +2357,8 @@ void WebGL2RenderingContextBase::drawBuffers(const Vector<GLenum>& buffers) { ...@@ -2354,7 +2357,8 @@ void WebGL2RenderingContextBase::drawBuffers(const Vector<GLenum>& buffers) {
synthesizeGLError(GL_INVALID_OPERATION, "drawBuffers", "BACK or NONE"); synthesizeGLError(GL_INVALID_OPERATION, "drawBuffers", "BACK or NONE");
return; return;
} }
// Because the backbuffer is simulated on all current WebKit ports, we need to change BACK to COLOR_ATTACHMENT0. // Because the backbuffer is simulated on all current WebKit ports, we need
// to change BACK to COLOR_ATTACHMENT0.
GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE; GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE;
contextGL()->DrawBuffersEXT(1, &value); contextGL()->DrawBuffersEXT(1, &value);
setBackDrawBuffer(bufs[0]); setBackDrawBuffer(bufs[0]);
...@@ -4135,7 +4139,8 @@ ScriptValue WebGL2RenderingContextBase::getFramebufferAttachmentParameter( ...@@ -4135,7 +4139,8 @@ ScriptValue WebGL2RenderingContextBase::getFramebufferAttachmentParameter(
// Default framebuffer (an internal fbo) // Default framebuffer (an internal fbo)
if (!framebufferBinding) { if (!framebufferBinding) {
// We can use creationAttributes() because in WebGL 2, they are required to be honored. // We can use creationAttributes() because in WebGL 2, they are required to
// be honored.
bool hasDepth = creationAttributes().depth(); bool hasDepth = creationAttributes().depth();
bool hasStencil = creationAttributes().stencil(); bool hasStencil = creationAttributes().stencil();
bool hasAlpha = creationAttributes().alpha(); bool hasAlpha = creationAttributes().alpha();
......
...@@ -30,8 +30,9 @@ class WebGL2RenderingContextBase : public WebGLRenderingContextBase { ...@@ -30,8 +30,9 @@ class WebGL2RenderingContextBase : public WebGLRenderingContextBase {
/* Buffer objects */ /* Buffer objects */
void bufferData(GLenum, DOMArrayBufferView*, GLenum, GLuint, GLuint); void bufferData(GLenum, DOMArrayBufferView*, GLenum, GLuint, GLuint);
void bufferSubData(GLenum, GLintptr, DOMArrayBufferView*, GLuint, GLuint); void bufferSubData(GLenum, GLintptr, DOMArrayBufferView*, GLuint, GLuint);
// Have to re-declare/re-define the following buffer{Sub}Data functions from base class. // Have to re-declare/re-define the following buffer{Sub}Data functions from
// This is because the above buffer{Sub}Data() hides the name from base class. // base class. This is because the above buffer{Sub}Data() hides the name
// from base class.
void bufferData(GLenum target, long long size, GLenum usage); void bufferData(GLenum target, long long size, GLenum usage);
void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage); void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage);
void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage); void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage);
...@@ -212,8 +213,9 @@ class WebGL2RenderingContextBase : public WebGLRenderingContextBase { ...@@ -212,8 +213,9 @@ class WebGL2RenderingContextBase : public WebGLRenderingContextBase {
DOMArrayBufferView*, DOMArrayBufferView*,
GLuint); GLuint);
// Have to re-declare/re-define the following tex{Sub}Image2D functions from base class. // Have to re-declare/re-define the following tex{Sub}Image2D functions from
// This is because the above tex{Sub}Image2D() hides the name from base class. // base class. This is because the above tex{Sub}Image2D() hides the name
// from base class.
void texImage2D(GLenum, GLint, GLint, GLenum, GLenum, ImageData*); void texImage2D(GLenum, GLint, GLint, GLenum, GLenum, ImageData*);
void texImage2D(GLenum, void texImage2D(GLenum,
GLint, GLint,
...@@ -725,8 +727,9 @@ class WebGL2RenderingContextBase : public WebGLRenderingContextBase { ...@@ -725,8 +727,9 @@ class WebGL2RenderingContextBase : public WebGLRenderingContextBase {
std::unique_ptr<WebGraphicsContext3DProvider>, std::unique_ptr<WebGraphicsContext3DProvider>,
const CanvasContextCreationAttributes& requestedAttributes); const CanvasContextCreationAttributes& requestedAttributes);
// Helper function to validate target and the attachment combination for getFramebufferAttachmentParameters. // Helper function to validate target and the attachment combination for
// Generate GL error and return false if parameters are illegal. // getFramebufferAttachmentParameters. Generate GL error and return false if
// parameters are illegal.
bool validateGetFramebufferAttachmentParameterFunc(const char* functionName, bool validateGetFramebufferAttachmentParameterFunc(const char* functionName,
GLenum target, GLenum target,
GLenum attachment); GLenum attachment);
......
...@@ -62,7 +62,8 @@ bool WebGLCompressedTextureASTC::supported(WebGLRenderingContextBase* context) { ...@@ -62,7 +62,8 @@ bool WebGLCompressedTextureASTC::supported(WebGLRenderingContextBase* context) {
} }
const char* WebGLCompressedTextureASTC::extensionName() { const char* WebGLCompressedTextureASTC::extensionName() {
// TODO(cyzero.kim): implement extension for GL_KHR_texture_compression_astc_hdr. // TODO(cyzero.kim): implement extension for
// GL_KHR_texture_compression_astc_hdr.
return "WEBGL_compressed_texture_astc"; return "WEBGL_compressed_texture_astc";
} }
......
...@@ -74,8 +74,8 @@ void WebGLContextGroup::detachAndRemoveAllObjects() { ...@@ -74,8 +74,8 @@ void WebGLContextGroup::detachAndRemoveAllObjects() {
void WebGLContextGroup::loseContextGroup( void WebGLContextGroup::loseContextGroup(
WebGLRenderingContextBase::LostContextMode mode, WebGLRenderingContextBase::LostContextMode mode,
WebGLRenderingContextBase::AutoRecoveryMethod autoRecoveryMethod) { WebGLRenderingContextBase::AutoRecoveryMethod autoRecoveryMethod) {
// Detach must happen before loseContextImpl, which destroys the GraphicsContext3D // Detach must happen before loseContextImpl, which destroys the
// and prevents groupObjects from being properly deleted. // GraphicsContext3D and prevents groupObjects from being properly deleted.
detachAndRemoveAllObjects(); detachAndRemoveAllObjects();
for (WebGLRenderingContextBase* const context : m_contexts) for (WebGLRenderingContextBase* const context : m_contexts)
......
...@@ -74,7 +74,8 @@ void WebGLDrawBuffers::drawBuffersWEBGL(const Vector<GLenum>& buffers) { ...@@ -74,7 +74,8 @@ void WebGLDrawBuffers::drawBuffersWEBGL(const Vector<GLenum>& buffers) {
"drawBuffersWEBGL", "BACK or NONE"); "drawBuffersWEBGL", "BACK or NONE");
return; return;
} }
// Because the backbuffer is simulated on all current WebKit ports, we need to change BACK to COLOR_ATTACHMENT0. // Because the backbuffer is simulated on all current WebKit ports, we need
// to change BACK to COLOR_ATTACHMENT0.
GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE; GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE;
scoped.context()->contextGL()->DrawBuffersEXT(1, &value); scoped.context()->contextGL()->DrawBuffersEXT(1, &value);
scoped.context()->setBackDrawBuffer(bufs[0]); scoped.context()->setBackDrawBuffer(bufs[0]);
...@@ -168,8 +169,8 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements( ...@@ -168,8 +169,8 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements(
GL_TEXTURE_2D, 0, 0); GL_TEXTURE_2D, 0, 0);
} }
if (supportsDepthStencil) { if (supportsDepthStencil) {
// For ES 2.0 contexts DEPTH_STENCIL is not available natively, so we emulate it // For ES 2.0 contexts DEPTH_STENCIL is not available natively, so we
// at the command buffer level for WebGL contexts. // emulate it at the command buffer level for WebGL contexts.
gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
GL_TEXTURE_2D, depthStencil, 0); GL_TEXTURE_2D, depthStencil, 0);
if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) !=
......
...@@ -82,12 +82,14 @@ class WebGLFramebuffer final : public WebGLContextObject { ...@@ -82,12 +82,14 @@ class WebGLFramebuffer final : public WebGLContextObject {
WebGLRenderbuffer*); WebGLRenderbuffer*);
// If an object is attached to the currently bound framebuffer, remove it. // If an object is attached to the currently bound framebuffer, remove it.
void removeAttachmentFromBoundFramebuffer(GLenum target, WebGLSharedObject*); void removeAttachmentFromBoundFramebuffer(GLenum target, WebGLSharedObject*);
// If a given attachment point for the currently bound framebuffer is not null, remove the attached object. // If a given attachment point for the currently bound framebuffer is not
// null, remove the attached object.
void removeAttachmentFromBoundFramebuffer(GLenum target, GLenum attachment); void removeAttachmentFromBoundFramebuffer(GLenum target, GLenum attachment);
WebGLSharedObject* getAttachmentObject(GLenum) const; WebGLSharedObject* getAttachmentObject(GLenum) const;
// WebGL 1 specific: // WebGL 1 specific:
// 1) can't allow depth_stencil for depth/stencil attachments, and vice versa. // 1) can't allow depth_stencil for depth/stencil attachments, and vice
// versa.
// 2) no conflicting DEPTH/STENCIL/DEPTH_STENCIL attachments. // 2) no conflicting DEPTH/STENCIL/DEPTH_STENCIL attachments.
GLenum checkDepthStencilStatus(const char** reason) const; GLenum checkDepthStencilStatus(const char** reason) const;
...@@ -126,7 +128,8 @@ class WebGLFramebuffer final : public WebGLContextObject { ...@@ -126,7 +128,8 @@ class WebGLFramebuffer final : public WebGLContextObject {
// attach 'attachment' at 'attachmentPoint'. // attach 'attachment' at 'attachmentPoint'.
void attach(GLenum target, GLenum attachment, GLenum attachmentPoint); void attach(GLenum target, GLenum attachment, GLenum attachmentPoint);
// Check if a new drawBuffers call should be issued. This is called when we add or remove an attachment. // Check if a new drawBuffers call should be issued. This is called when we
// add or remove an attachment.
void drawBuffersIfNecessary(bool force); void drawBuffersIfNecessary(bool force);
GLuint m_object; GLuint m_object;
......
...@@ -56,7 +56,9 @@ void WebGLTimerQueryEXT::updateCachedResult(gpu::gles2::GLES2Interface* gl) { ...@@ -56,7 +56,9 @@ void WebGLTimerQueryEXT::updateCachedResult(gpu::gles2::GLES2Interface* gl) {
if (!hasTarget()) if (!hasTarget())
return; return;
// If this is a timestamp query, set the result to 0 and make it available as we don't support timestamps in WebGL due to very poor driver support for them // If this is a timestamp query, set the result to 0 and make it available as
// we don't support timestamps in WebGL due to very poor driver support for
// them.
if (m_target == GL_TIMESTAMP_EXT) { if (m_target == GL_TIMESTAMP_EXT) {
m_queryResult = 0; m_queryResult = 0;
m_queryResultAvailable = true; m_queryResultAvailable = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment