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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 1950763002: Remove abstractions around GLuint and GL constants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2189 return; 2189 return;
2190 } 2190 }
2191 // Don't allow the default framebuffer to be mutated; all current 2191 // Don't allow the default framebuffer to be mutated; all current
2192 // implementations use an FBO internally in place of the default 2192 // implementations use an FBO internally in place of the default
2193 // FBO. 2193 // FBO.
2194 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target); 2194 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target);
2195 if (!framebufferBinding || !framebufferBinding->object()) { 2195 if (!framebufferBinding || !framebufferBinding->object()) {
2196 synthesizeGLError(GL_INVALID_OPERATION, "framebufferRenderbuffer", "no f ramebuffer bound"); 2196 synthesizeGLError(GL_INVALID_OPERATION, "framebufferRenderbuffer", "no f ramebuffer bound");
2197 return; 2197 return;
2198 } 2198 }
2199 Platform3DObject bufferObject = objectOrZero(buffer); 2199 GLuint bufferObject = objectOrZero(buffer);
2200 if (isWebGL2OrHigher() && attachment == GL_DEPTH_STENCIL_ATTACHMENT) { 2200 if (isWebGL2OrHigher() && attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
2201 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN T + STENCIL_ATTACHMENT. 2201 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN T + STENCIL_ATTACHMENT.
2202 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP TH_STENCIL_ATTACHMENT in WebGL 2. 2202 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP TH_STENCIL_ATTACHMENT in WebGL 2.
2203 contextGL()->FramebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, render buffertarget, bufferObject); 2203 contextGL()->FramebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, render buffertarget, bufferObject);
2204 contextGL()->FramebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, rend erbuffertarget, bufferObject); 2204 contextGL()->FramebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, rend erbuffertarget, bufferObject);
2205 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT TACHMENT, buffer); 2205 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT TACHMENT, buffer);
2206 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_ ATTACHMENT, buffer); 2206 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_ ATTACHMENT, buffer);
2207 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_ DEPTH_ATTACHMENT, buffer); 2207 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_ DEPTH_ATTACHMENT, buffer);
2208 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_ STENCIL_ATTACHMENT, buffer); 2208 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_ STENCIL_ATTACHMENT, buffer);
2209 } else { 2209 } else {
(...skipping 13 matching lines...) Expand all
2223 return; 2223 return;
2224 } 2224 }
2225 // Don't allow the default framebuffer to be mutated; all current 2225 // Don't allow the default framebuffer to be mutated; all current
2226 // implementations use an FBO internally in place of the default 2226 // implementations use an FBO internally in place of the default
2227 // FBO. 2227 // FBO.
2228 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target); 2228 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target);
2229 if (!framebufferBinding || !framebufferBinding->object()) { 2229 if (!framebufferBinding || !framebufferBinding->object()) {
2230 synthesizeGLError(GL_INVALID_OPERATION, "framebufferTexture2D", "no fram ebuffer bound"); 2230 synthesizeGLError(GL_INVALID_OPERATION, "framebufferTexture2D", "no fram ebuffer bound");
2231 return; 2231 return;
2232 } 2232 }
2233 Platform3DObject textureObject = objectOrZero(texture); 2233 GLuint textureObject = objectOrZero(texture);
2234 if (isWebGL2OrHigher() && attachment == GL_DEPTH_STENCIL_ATTACHMENT) { 2234 if (isWebGL2OrHigher() && attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
2235 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN T + STENCIL_ATTACHMENT. 2235 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN T + STENCIL_ATTACHMENT.
2236 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP TH_STENCIL_ATTACHMENT in WebGL 2. 2236 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP TH_STENCIL_ATTACHMENT in WebGL 2.
2237 contextGL()->FramebufferTexture2D(target, GL_DEPTH_ATTACHMENT, textarget , textureObject, level); 2237 contextGL()->FramebufferTexture2D(target, GL_DEPTH_ATTACHMENT, textarget , textureObject, level);
2238 contextGL()->FramebufferTexture2D(target, GL_STENCIL_ATTACHMENT, textarg et, textureObject, level); 2238 contextGL()->FramebufferTexture2D(target, GL_STENCIL_ATTACHMENT, textarg et, textureObject, level);
2239 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT TACHMENT, textarget, texture, level, 0); 2239 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT TACHMENT, textarget, texture, level, 0);
2240 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_ ATTACHMENT, textarget, texture, level, 0); 2240 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_ ATTACHMENT, textarget, texture, level, 0);
2241 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_ DEPTH_ATTACHMENT, texture); 2241 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_ DEPTH_ATTACHMENT, texture);
2242 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_ STENCIL_ATTACHMENT, texture); 2242 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_ STENCIL_ATTACHMENT, texture);
2243 } else { 2243 } else {
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
4018 if (isFloatType(type) || isIntegerFormat(internalformat) || isSRGBFormat(int ernalformat)) 4018 if (isFloatType(type) || isIntegerFormat(internalformat) || isSRGBFormat(int ernalformat))
4019 return false; 4019 return false;
4020 return true; 4020 return true;
4021 } 4021 }
4022 4022
4023 void WebGLRenderingContextBase::texImageCanvasByGPU(TexImageByGPUType functionTy pe, WebGLTexture* texture, GLenum target, 4023 void WebGLRenderingContextBase::texImageCanvasByGPU(TexImageByGPUType functionTy pe, WebGLTexture* texture, GLenum target,
4024 GLint level, GLint internalformat, GLenum type, GLint xoffset, GLint yoffset , GLint zoffset, HTMLCanvasElement* canvas) 4024 GLint level, GLint internalformat, GLenum type, GLint xoffset, GLint yoffset , GLint zoffset, HTMLCanvasElement* canvas)
4025 { 4025 {
4026 ScopedTexture2DRestorer restorer(this); 4026 ScopedTexture2DRestorer restorer(this);
4027 4027
4028 Platform3DObject targetTexture = texture->object(); 4028 GLuint targetTexture = texture->object();
4029 GLenum targetType = type; 4029 GLenum targetType = type;
4030 GLenum targetInternalformat = internalformat; 4030 GLenum targetInternalformat = internalformat;
4031 GLint targetLevel = level; 4031 GLint targetLevel = level;
4032 bool possibleDirectCopy = false; 4032 bool possibleDirectCopy = false;
4033 if (functionType == TexImage2DByGPU) { 4033 if (functionType == TexImage2DByGPU) {
4034 possibleDirectCopy = Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat, type, level); 4034 possibleDirectCopy = Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat, type, level);
4035 } 4035 }
4036 4036
4037 // if direct copy is not possible, create a temporary texture and then copy from canvas to temporary texture to target texture. 4037 // if direct copy is not possible, create a temporary texture and then copy from canvas to temporary texture to target texture.
4038 if (!possibleDirectCopy) { 4038 if (!possibleDirectCopy) {
(...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after
6270 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6270 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6271 } 6271 }
6272 6272
6273 void WebGLRenderingContextBase::restoreUnpackParameters() 6273 void WebGLRenderingContextBase::restoreUnpackParameters()
6274 { 6274 {
6275 if (m_unpackAlignment != 1) 6275 if (m_unpackAlignment != 1)
6276 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6276 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6277 } 6277 }
6278 6278
6279 } // namespace blink 6279 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698