Changeset 76603 in webkit
- Timestamp:
- Jan 25, 2011 9:47:30 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76601 r76603 1 2011-01-24 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Kenneth Russell. 4 5 Style cleanup for WebGLRenderingContext 6 https://bugs.webkit.org/show_bug.cgi?id=52352 7 8 * html/canvas/WebGLBuffer.cpp: 9 * html/canvas/WebGLBuffer.h: 10 * html/canvas/WebGLObject.cpp: 11 * html/canvas/WebGLProgram.cpp: 12 * html/canvas/WebGLRenderbuffer.cpp: 13 * html/canvas/WebGLRenderingContext.cpp: 14 (WebCore::WebGLRenderingContext::create): 15 (WebCore::WebGLRenderingContext::blendFunc): 16 (WebCore::WebGLRenderingContext::createShader): 17 (WebCore::WebGLRenderingContext::deleteBuffer): 18 (WebCore::WebGLRenderingContext::deleteShader): 19 (WebCore::WebGLRenderingContext::deleteTexture): 20 (WebCore::WebGLRenderingContext::disableVertexAttribArray): 21 (WebCore::WebGLRenderingContext::validateIndexArrayPrecise): 22 (WebCore::WebGLRenderingContext::validateRenderingState): 23 (WebCore::WebGLRenderingContext::enableVertexAttribArray): 24 (WebCore::WebGLRenderingContext::getUniform): 25 (WebCore::WebGLRenderingContext::detachAndRemoveAllObjects): 26 * html/canvas/WebGLRenderingContext.h: 27 * html/canvas/WebGLShader.cpp: 28 * html/canvas/WebGLTexture.cpp: 29 * html/canvas/WebGLUniformLocation.cpp: 30 * html/canvas/WebGLUniformLocation.h: 31 1 32 2011-01-24 Chris Marrin <cmarrin@apple.com> 2 33 -
trunk/Source/WebCore/html/canvas/WebGLBuffer.cpp
r76600 r76603 35 35 36 36 namespace WebCore { 37 37 38 38 PassRefPtr<WebGLBuffer> WebGLBuffer::create(WebGLRenderingContext* ctx) 39 39 { -
trunk/Source/WebCore/html/canvas/WebGLBuffer.h
r75741 r76603 43 43 44 44 bool associateBufferData(GC3Dsizeiptr size); 45 bool associateBufferData(ArrayBuffer* array);46 bool associateBufferData(ArrayBufferView* array);47 bool associateBufferSubData(GC3Dintptr offset, ArrayBuffer* array);48 bool associateBufferSubData(GC3Dintptr offset, ArrayBufferView* array);45 bool associateBufferData(ArrayBuffer*); 46 bool associateBufferData(ArrayBufferView*); 47 bool associateBufferSubData(GC3Dintptr offset, ArrayBuffer*); 48 bool associateBufferSubData(GC3Dintptr offset, ArrayBufferView*); 49 49 50 50 GC3Dsizeiptr byteLength() const; -
trunk/Source/WebCore/html/canvas/WebGLObject.cpp
r76600 r76603 33 33 34 34 namespace WebCore { 35 35 36 36 WebGLObject::WebGLObject(WebGLRenderingContext* context) 37 37 : m_object(0) -
trunk/Source/WebCore/html/canvas/WebGLProgram.cpp
r76600 r76603 33 33 34 34 namespace WebCore { 35 35 36 36 PassRefPtr<WebGLProgram> WebGLProgram::create(WebGLRenderingContext* ctx) 37 37 { -
trunk/Source/WebCore/html/canvas/WebGLRenderbuffer.cpp
r76600 r76603 33 33 34 34 namespace WebCore { 35 35 36 36 PassRefPtr<WebGLRenderbuffer> WebGLRenderbuffer::create(WebGLRenderingContext* ctx) 37 37 { -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r76601 r76603 352 352 return 0; 353 353 } 354 354 355 355 return new WebGLRenderingContext(canvas, context, attributes); 356 356 } … … 576 576 } 577 577 578 579 578 void WebGLRenderingContext::bindFramebuffer(GC3Denum target, WebGLFramebuffer* buffer, ExceptionCode& ec) 580 579 { … … 616 615 cleanupAfterGraphicsCall(false); 617 616 } 618 619 617 620 618 void WebGLRenderingContext::bindTexture(GC3Denum target, WebGLTexture* texture, ExceptionCode& ec) … … 685 683 m_context->blendFunc(sfactor, dfactor); 686 684 cleanupAfterGraphicsCall(false); 687 } 685 } 688 686 689 687 void WebGLRenderingContext::blendFuncSeparate(GC3Denum srcRGB, GC3Denum dstRGB, GC3Denum srcAlpha, GC3Denum dstAlpha) … … 990 988 return o; 991 989 } 992 990 993 991 PassRefPtr<WebGLFramebuffer> WebGLRenderingContext::createFramebuffer() 994 992 { … … 1036 1034 return 0; 1037 1035 } 1038 1036 1039 1037 RefPtr<WebGLShader> o = WebGLShader::create(this, type); 1040 1038 addObject(o.get()); … … 1054 1052 if (isContextLost() || !buffer) 1055 1053 return; 1056 1054 1057 1055 buffer->deleteObject(); 1058 1056 … … 1112 1110 if (isContextLost() || !shader) 1113 1111 return; 1114 1112 1115 1113 shader->deleteObject(); 1116 1114 } … … 1120 1118 if (isContextLost() || !texture) 1121 1119 return; 1122 1120 1123 1121 texture->deleteObject(); 1124 1122 if (m_framebufferBinding) … … 1168 1166 } 1169 1167 1170 1171 1168 void WebGLRenderingContext::disable(GC3Denum cap) 1172 1169 { … … 1186 1183 return; 1187 1184 } 1188 1185 1189 1186 if (index < m_vertexAttribState.size()) 1190 1187 m_vertexAttribState[index].enabled = false; … … 1309 1306 ++p; 1310 1307 } 1311 } 1312 1308 } 1309 1313 1310 // Then set the last index in the index array and make sure it is valid. 1314 1311 numElementsRequired = lastIndex + 1; … … 1354 1351 } 1355 1352 } 1356 1353 1357 1354 if (smallestNumElements == INT_MAX) 1358 1355 smallestNumElements = 0; 1359 1356 1360 1357 return numElementsRequired <= smallestNumElements; 1361 1358 } … … 1513 1510 return; 1514 1511 } 1515 1512 1516 1513 if (index >= m_vertexAttribState.size()) 1517 1514 m_vertexAttribState.resize(index + 1); 1518 1515 1519 1516 m_vertexAttribState[index].enabled = true; 1520 1517 1521 1518 m_context->enableVertexAttribArray(index); 1522 1519 cleanupAfterGraphicsCall(false); … … 1530 1527 cleanupAfterGraphicsCall(true); 1531 1528 } 1532 1533 1529 1534 1530 void WebGLRenderingContext::flush() … … 2244 2240 } 2245 2241 GC3Dint location = uniformLocation->location(); 2246 2242 2247 2243 WebGLStateRestorer(this, false); 2248 2244 // FIXME: make this more efficient using WebGLUniformLocation and caching types in it … … 3749 3745 for (HashSet<RefPtr<WebGLObject> >::iterator it = m_canvasObjects.begin(); it != pend; ++it) 3750 3746 (*it)->detachContext(); 3751 3747 3752 3748 m_canvasObjects.clear(); 3753 3749 } -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h
r76601 r76603 70 70 virtual bool paintsIntoCanvasBuffer() const; 71 71 72 void activeTexture(GC3Denum texture, ExceptionCode& ec);73 void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode& ec);74 void bindAttribLocation(WebGLProgram*, GC3Duint index, const String& name, ExceptionCode& ec);75 void bindBuffer(GC3Denum target, WebGLBuffer*, ExceptionCode& ec);76 void bindFramebuffer(GC3Denum target, WebGLFramebuffer*, ExceptionCode& ec);77 void bindRenderbuffer(GC3Denum target, WebGLRenderbuffer*, ExceptionCode& ec);78 void bindTexture(GC3Denum target, WebGLTexture*, ExceptionCode& ec);72 void activeTexture(GC3Denum texture, ExceptionCode&); 73 void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode&); 74 void bindAttribLocation(WebGLProgram*, GC3Duint index, const String& name, ExceptionCode&); 75 void bindBuffer(GC3Denum target, WebGLBuffer*, ExceptionCode&); 76 void bindFramebuffer(GC3Denum target, WebGLFramebuffer*, ExceptionCode&); 77 void bindRenderbuffer(GC3Denum target, WebGLRenderbuffer*, ExceptionCode&); 78 void bindTexture(GC3Denum target, WebGLTexture*, ExceptionCode&); 79 79 void blendColor(GC3Dfloat red, GC3Dfloat green, GC3Dfloat blue, GC3Dfloat alpha); 80 80 void blendEquation(GC3Denum mode); … … 95 95 void clearStencil(GC3Dint); 96 96 void colorMask(GC3Dboolean red, GC3Dboolean green, GC3Dboolean blue, GC3Dboolean alpha); 97 void compileShader(WebGLShader*, ExceptionCode& ec);97 void compileShader(WebGLShader*, ExceptionCode&); 98 98 99 99 // void compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Dsizei imageSize, const void* data); … … 132 132 void finish(); 133 133 void flush(); 134 void framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, WebGLRenderbuffer*, ExceptionCode& ec);135 void framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, WebGLTexture*, GC3Dint level, ExceptionCode& ec);134 void framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, WebGLRenderbuffer*, ExceptionCode&); 135 void framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, WebGLTexture*, GC3Dint level, ExceptionCode&); 136 136 void frontFace(GC3Denum mode); 137 137 void generateMipmap(GC3Denum target); … … 148 148 WebGLGetInfo getParameter(GC3Denum pname, ExceptionCode&); 149 149 WebGLGetInfo getProgramParameter(WebGLProgram*, GC3Denum pname, ExceptionCode&); 150 String getProgramInfoLog(WebGLProgram*, ExceptionCode& ec);150 String getProgramInfoLog(WebGLProgram*, ExceptionCode&); 151 151 WebGLGetInfo getRenderbufferParameter(GC3Denum target, GC3Denum pname, ExceptionCode&); 152 WebGLGetInfo getShaderParameter(WebGLShader*, GC3Denum pname, ExceptionCode& ec);153 String getShaderInfoLog(WebGLShader*, ExceptionCode& ec);152 WebGLGetInfo getShaderParameter(WebGLShader*, GC3Denum pname, ExceptionCode&); 153 String getShaderInfoLog(WebGLShader*, ExceptionCode&); 154 154 155 155 // TBD … … 193 193 void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, 194 194 GC3Dsizei width, GC3Dsizei height, GC3Dint border, 195 GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode&);195 GC3Denum format, GC3Denum type, ArrayBufferView*, ExceptionCode&); 196 196 void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, 197 GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionCode&);197 GC3Denum format, GC3Denum type, ImageData*, ExceptionCode&); 198 198 void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, 199 GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionCode&);199 GC3Denum format, GC3Denum type, HTMLImageElement*, ExceptionCode&); 200 200 void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, 201 GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionCode&);201 GC3Denum format, GC3Denum type, HTMLCanvasElement*, ExceptionCode&); 202 202 void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, 203 GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionCode&);203 GC3Denum format, GC3Denum type, HTMLVideoElement*, ExceptionCode&); 204 204 205 205 void texParameterf(GC3Denum target, GC3Denum pname, GC3Dfloat param); … … 208 208 void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, 209 209 GC3Dsizei width, GC3Dsizei height, 210 GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode&);210 GC3Denum format, GC3Denum type, ArrayBufferView*, ExceptionCode&); 211 211 void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, 212 GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionCode&);212 GC3Denum format, GC3Denum type, ImageData*, ExceptionCode&); 213 213 void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, 214 GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionCode&);214 GC3Denum format, GC3Denum type, HTMLImageElement*, ExceptionCode&); 215 215 void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, 216 GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionCode&);216 GC3Denum format, GC3Denum type, HTMLCanvasElement*, ExceptionCode&); 217 217 void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, 218 GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionCode&);218 GC3Denum format, GC3Denum type, HTMLVideoElement*, ExceptionCode&); 219 219 220 220 void uniform1f(const WebGLUniformLocation* location, GC3Dfloat x, ExceptionCode&); … … 335 335 bool validateRenderingState(int numElements); 336 336 337 bool validateWebGLObject(WebGLObject* object);338 339 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement* video);337 bool validateWebGLObject(WebGLObject*); 338 339 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*); 340 340 341 341 RefPtr<GraphicsContext3D> m_context; … … 458 458 459 459 // Helpers for getParameter and others 460 WebGLGetInfo getBooleanParameter(GC3Denum pname);461 WebGLGetInfo getBooleanArrayParameter(GC3Denum pname);462 WebGLGetInfo getFloatParameter(GC3Denum pname);463 WebGLGetInfo getIntParameter(GC3Denum pname);464 WebGLGetInfo getUnsignedIntParameter(GC3Denum pname);465 WebGLGetInfo getWebGLFloatArrayParameter(GC3Denum pname);466 WebGLGetInfo getWebGLIntArrayParameter(GC3Denum pname);460 WebGLGetInfo getBooleanParameter(GC3Denum); 461 WebGLGetInfo getBooleanArrayParameter(GC3Denum); 462 WebGLGetInfo getFloatParameter(GC3Denum); 463 WebGLGetInfo getIntParameter(GC3Denum); 464 WebGLGetInfo getUnsignedIntParameter(GC3Denum); 465 WebGLGetInfo getWebGLFloatArrayParameter(GC3Denum); 466 WebGLGetInfo getWebGLIntArrayParameter(GC3Denum); 467 467 468 468 void texImage2DBase(GC3Denum target, GC3Dint level, GC3Denum internalformat, … … 470 470 GC3Denum format, GC3Denum type, void* pixels, ExceptionCode&); 471 471 void texImage2DImpl(GC3Denum target, GC3Dint level, GC3Denum internalformat, 472 GC3Denum format, GC3Denum type, Image* image,472 GC3Denum format, GC3Denum type, Image*, 473 473 bool flipY, bool premultiplyAlpha, ExceptionCode&); 474 474 void texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, … … 547 547 // Helper function to print warnings to console. Currently 548 548 // used only to warn about use of obsolete functions. 549 void printWarningToConsole(const String& message);549 void printWarningToConsole(const String&); 550 550 551 551 // Helper function to validate input parameters for framebuffer functions. … … 563 563 564 564 // Helper function to validate input parameters for uniform functions. 565 bool validateUniformParameters(const WebGLUniformLocation* location, Float32Array* v, GC3Dsizei mod);566 bool validateUniformParameters(const WebGLUniformLocation* location, Int32Array* v, GC3Dsizei mod);567 bool validateUniformParameters(const WebGLUniformLocation* location, void* v, GC3Dsizei size, GC3Dsizei mod);568 bool validateUniformMatrixParameters(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, GC3Dsizei mod);569 bool validateUniformMatrixParameters(const WebGLUniformLocation* location, GC3Dboolean transpose, void* v, GC3Dsizei size, GC3Dsizei mod);565 bool validateUniformParameters(const WebGLUniformLocation*, Float32Array*, GC3Dsizei mod); 566 bool validateUniformParameters(const WebGLUniformLocation*, Int32Array*, GC3Dsizei mod); 567 bool validateUniformParameters(const WebGLUniformLocation*, void*, GC3Dsizei size, GC3Dsizei mod); 568 bool validateUniformMatrixParameters(const WebGLUniformLocation*, GC3Dboolean transpose, Float32Array*, GC3Dsizei mod); 569 bool validateUniformMatrixParameters(const WebGLUniformLocation*, GC3Dboolean transpose, void*, GC3Dsizei size, GC3Dsizei mod); 570 570 571 571 // Helper function to validate parameters for bufferData. … … 574 574 575 575 // Helper functions for vertexAttribNf{v}. 576 void vertexAttribfImpl(GC3Duint index, GC3Dsizei expectedSize, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2, GC3Dfloat v3);577 void vertexAttribfvImpl(GC3Duint index, Float32Array* v, GC3Dsizei expectedSize);578 void vertexAttribfvImpl(GC3Duint index, GC3Dfloat* v, GC3Dsizei size, GC3Dsizei expectedSize);576 void vertexAttribfImpl(GC3Duint index, GC3Dsizei expectedSize, GC3Dfloat, GC3Dfloat, GC3Dfloat, GC3Dfloat); 577 void vertexAttribfvImpl(GC3Duint index, Float32Array*, GC3Dsizei expectedSize); 578 void vertexAttribfvImpl(GC3Duint index, GC3Dfloat*, GC3Dsizei size, GC3Dsizei expectedSize); 579 579 580 580 // Helpers for simulating vertexAttrib0 -
trunk/Source/WebCore/html/canvas/WebGLShader.cpp
r76600 r76603 33 33 34 34 namespace WebCore { 35 35 36 36 PassRefPtr<WebGLShader> WebGLShader::create(WebGLRenderingContext* ctx, GC3Denum type) 37 37 { -
trunk/Source/WebCore/html/canvas/WebGLTexture.cpp
r76600 r76603 34 34 35 35 namespace WebCore { 36 36 37 37 PassRefPtr<WebGLTexture> WebGLTexture::create(WebGLRenderingContext* ctx) 38 38 { -
trunk/Source/WebCore/html/canvas/WebGLUniformLocation.cpp
r76600 r76603 32 32 33 33 namespace WebCore { 34 34 35 35 PassRefPtr<WebGLUniformLocation> WebGLUniformLocation::create(WebGLProgram* program, GC3Dint location) 36 36 { -
trunk/Source/WebCore/html/canvas/WebGLUniformLocation.h
r75741 r76603 40 40 virtual ~WebGLUniformLocation() { } 41 41 42 static PassRefPtr<WebGLUniformLocation> create(WebGLProgram* program, GC3Dint location);42 static PassRefPtr<WebGLUniformLocation> create(WebGLProgram*, GC3Dint location); 43 43 44 44 WebGLProgram* program() const; … … 47 47 48 48 protected: 49 WebGLUniformLocation(WebGLProgram* program, GC3Dint location);49 WebGLUniformLocation(WebGLProgram*, GC3Dint location); 50 50 51 51 private:
Note: See TracChangeset
for help on using the changeset viewer.