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,
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->resetCachedResult();
}
......
......@@ -473,8 +473,9 @@ void WebGL2RenderingContextBase::framebufferTextureLayer(GLenum target,
objectOrZero(texture), level, layer);
}
if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
// On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMENT + STENCIL_ATTACHMENT.
// We divide it here so in WebGLFramebuffer, we don't have to handle DEPTH_STENCIL_ATTACHMENT in WebGL 2.
// On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMENT +
// STENCIL_ATTACHMENT. We divide it here so in WebGLFramebuffer, we don't
// have to handle DEPTH_STENCIL_ATTACHMENT in WebGL 2.
framebufferBinding->setAttachmentForBoundFramebuffer(
target, GL_DEPTH_ATTACHMENT, textarget, texture, level, layer);
framebufferBinding->setAttachmentForBoundFramebuffer(
......@@ -505,7 +506,8 @@ ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(
// though GL_RGB and GL_RGBA are color-renderable.
case GL_RGB:
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_R8I:
case GL_R16UI:
......@@ -597,8 +599,8 @@ bool WebGL2RenderingContextBase::checkAndTranslateAttachments(
WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target);
ASSERT(framebufferBinding || drawingBuffer());
if (!framebufferBinding) {
// For the default framebuffer
// Translate GL_COLOR/GL_DEPTH/GL_STENCIL, because the default framebuffer of WebGL is not fb 0, it is an internal fbo
// For the default framebuffer, translate GL_COLOR/GL_DEPTH/GL_STENCIL.
// The default framebuffer of WebGL is not fb 0, it is an internal fbo.
for (size_t i = 0; i < attachments.size(); ++i) {
switch (attachments[i]) {
case GL_COLOR:
......@@ -806,8 +808,9 @@ void WebGL2RenderingContextBase::readPixels(GLint x,
}
long long size = buffer->getSize() - offset;
// If size is negative, or size is not large enough to store pixels, those cases
// are handled by validateReadPixelsFuncParameters to generate INVALID_OPERATION.
// If size is negative, or size is not large enough to store pixels, those
// cases are handled by validateReadPixelsFuncParameters to generate
// INVALID_OPERATION.
if (!validateReadPixelsFuncParameters(width, height, format, type, nullptr,
size))
return;
......@@ -2354,7 +2357,8 @@ void WebGL2RenderingContextBase::drawBuffers(const Vector<GLenum>& buffers) {
synthesizeGLError(GL_INVALID_OPERATION, "drawBuffers", "BACK or NONE");
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;
contextGL()->DrawBuffersEXT(1, &value);
setBackDrawBuffer(bufs[0]);
......@@ -4135,7 +4139,8 @@ ScriptValue WebGL2RenderingContextBase::getFramebufferAttachmentParameter(
// Default framebuffer (an internal fbo)
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 hasStencil = creationAttributes().stencil();
bool hasAlpha = creationAttributes().alpha();
......
......@@ -30,8 +30,9 @@ class WebGL2RenderingContextBase : public WebGLRenderingContextBase {
/* Buffer objects */
void bufferData(GLenum, DOMArrayBufferView*, GLenum, GLuint, GLuint);
void bufferSubData(GLenum, GLintptr, DOMArrayBufferView*, GLuint, GLuint);
// Have to re-declare/re-define the following buffer{Sub}Data functions from base class.
// This is because the above buffer{Sub}Data() hides the name from base class.
// Have to re-declare/re-define the following buffer{Sub}Data functions from
// 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, DOMArrayBuffer* data, GLenum usage);
void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage);
......@@ -212,8 +213,9 @@ class WebGL2RenderingContextBase : public WebGLRenderingContextBase {
DOMArrayBufferView*,
GLuint);
// Have to re-declare/re-define the following tex{Sub}Image2D functions from base class.
// This is because the above tex{Sub}Image2D() hides the name from base class.
// Have to re-declare/re-define the following tex{Sub}Image2D functions from
// 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,
......@@ -725,8 +727,9 @@ class WebGL2RenderingContextBase : public WebGLRenderingContextBase {
std::unique_ptr<WebGraphicsContext3DProvider>,
const CanvasContextCreationAttributes& requestedAttributes);
// Helper function to validate target and the attachment combination for getFramebufferAttachmentParameters.
// Generate GL error and return false if parameters are illegal.
// Helper function to validate target and the attachment combination for
// getFramebufferAttachmentParameters. Generate GL error and return false if
// parameters are illegal.
bool validateGetFramebufferAttachmentParameterFunc(const char* functionName,
GLenum target,
GLenum attachment);
......
......@@ -62,7 +62,8 @@ bool WebGLCompressedTextureASTC::supported(WebGLRenderingContextBase* context) {
}
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";
}
......
......@@ -74,8 +74,8 @@ void WebGLContextGroup::detachAndRemoveAllObjects() {
void WebGLContextGroup::loseContextGroup(
WebGLRenderingContextBase::LostContextMode mode,
WebGLRenderingContextBase::AutoRecoveryMethod autoRecoveryMethod) {
// Detach must happen before loseContextImpl, which destroys the GraphicsContext3D
// and prevents groupObjects from being properly deleted.
// Detach must happen before loseContextImpl, which destroys the
// GraphicsContext3D and prevents groupObjects from being properly deleted.
detachAndRemoveAllObjects();
for (WebGLRenderingContextBase* const context : m_contexts)
......
......@@ -74,7 +74,8 @@ void WebGLDrawBuffers::drawBuffersWEBGL(const Vector<GLenum>& buffers) {
"drawBuffersWEBGL", "BACK or NONE");
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;
scoped.context()->contextGL()->DrawBuffersEXT(1, &value);
scoped.context()->setBackDrawBuffer(bufs[0]);
......@@ -168,8 +169,8 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements(
GL_TEXTURE_2D, 0, 0);
}
if (supportsDepthStencil) {
// For ES 2.0 contexts DEPTH_STENCIL is not available natively, so we emulate it
// at the command buffer level for WebGL contexts.
// For ES 2.0 contexts DEPTH_STENCIL is not available natively, so we
// emulate it at the command buffer level for WebGL contexts.
gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
GL_TEXTURE_2D, depthStencil, 0);
if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) !=
......
......@@ -82,12 +82,14 @@ class WebGLFramebuffer final : public WebGLContextObject {
WebGLRenderbuffer*);
// If an object is attached to the currently bound framebuffer, remove it.
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);
WebGLSharedObject* getAttachmentObject(GLenum) const;
// 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.
GLenum checkDepthStencilStatus(const char** reason) const;
......@@ -126,7 +128,8 @@ class WebGLFramebuffer final : public WebGLContextObject {
// attach 'attachment' at '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);
GLuint m_object;
......
......@@ -56,7 +56,9 @@ void WebGLTimerQueryEXT::updateCachedResult(gpu::gles2::GLES2Interface* gl) {
if (!hasTarget())
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) {
m_queryResult = 0;
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