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

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

Issue 2500433003: support 3d texture sub-source uploads from ImageData (Closed)
Patch Set: address comment + rebase Created 4 years, 1 month 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 | « DEPS ('k') | third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/webgl/WebGL2RenderingContextBase.h" 5 #include "modules/webgl/WebGL2RenderingContextBase.h"
6 6
7 #include "bindings/modules/v8/WebGLAny.h" 7 #include "bindings/modules/v8/WebGLAny.h"
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "core/frame/ImageBitmap.h" 9 #include "core/frame/ImageBitmap.h"
10 #include "core/html/HTMLCanvasElement.h" 10 #include "core/html/HTMLCanvasElement.h"
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 GLsizei height, 1308 GLsizei height,
1309 GLint border, 1309 GLint border,
1310 GLenum format, 1310 GLenum format,
1311 GLenum type, 1311 GLenum type,
1312 ImageData* pixels) { 1312 ImageData* pixels) {
1313 DCHECK(pixels); 1313 DCHECK(pixels);
1314 IntRect sourceImageRect; 1314 IntRect sourceImageRect;
1315 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows)); 1315 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows));
1316 sourceImageRect.setSize(IntSize(width, height)); 1316 sourceImageRect.setSize(IntSize(width, height));
1317 texImageHelperImageData(TexImage2D, target, level, internalformat, 0, format, 1317 texImageHelperImageData(TexImage2D, target, level, internalformat, 0, format,
1318 type, 1, 0, 0, 0, pixels, sourceImageRect); 1318 type, 1, 0, 0, 0, pixels, sourceImageRect, 0);
1319 } 1319 }
1320 1320
1321 void WebGL2RenderingContextBase::texImage2D(GLenum target, 1321 void WebGL2RenderingContextBase::texImage2D(GLenum target,
1322 GLint level, 1322 GLint level,
1323 GLint internalformat, 1323 GLint internalformat,
1324 GLsizei width, 1324 GLsizei width,
1325 GLsizei height, 1325 GLsizei height,
1326 GLint border, 1326 GLint border,
1327 GLenum format, 1327 GLenum format,
1328 GLenum type, 1328 GLenum type,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 GLsizei width, 1467 GLsizei width,
1468 GLsizei height, 1468 GLsizei height,
1469 GLenum format, 1469 GLenum format,
1470 GLenum type, 1470 GLenum type,
1471 ImageData* pixels) { 1471 ImageData* pixels) {
1472 DCHECK(pixels); 1472 DCHECK(pixels);
1473 IntRect sourceImageRect; 1473 IntRect sourceImageRect;
1474 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows)); 1474 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows));
1475 sourceImageRect.setSize(IntSize(width, height)); 1475 sourceImageRect.setSize(IntSize(width, height));
1476 texImageHelperImageData(TexSubImage2D, target, level, 0, 0, format, type, 1, 1476 texImageHelperImageData(TexSubImage2D, target, level, 0, 0, format, type, 1,
1477 xoffset, yoffset, 0, pixels, sourceImageRect); 1477 xoffset, yoffset, 0, pixels, sourceImageRect, 0);
1478 } 1478 }
1479 1479
1480 void WebGL2RenderingContextBase::texSubImage2D(GLenum target, 1480 void WebGL2RenderingContextBase::texSubImage2D(GLenum target,
1481 GLint level, 1481 GLint level,
1482 GLint xoffset, 1482 GLint xoffset,
1483 GLint yoffset, 1483 GLint yoffset,
1484 GLsizei width, 1484 GLsizei width,
1485 GLsizei height, 1485 GLsizei height,
1486 GLenum format, 1486 GLenum format,
1487 GLenum type, 1487 GLenum type,
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 1689
1690 void WebGL2RenderingContextBase::texImage3D(GLenum target, 1690 void WebGL2RenderingContextBase::texImage3D(GLenum target,
1691 GLint level, 1691 GLint level,
1692 GLint internalformat, 1692 GLint internalformat,
1693 GLsizei width, 1693 GLsizei width,
1694 GLsizei height, 1694 GLsizei height,
1695 GLsizei depth, 1695 GLsizei depth,
1696 GLint border, 1696 GLint border,
1697 GLenum format, 1697 GLenum format,
1698 GLenum type, 1698 GLenum type,
1699 ImageData* imageData) { 1699 ImageData* pixels) {
1700 // TODO(zmo): To be implemented. 1700 DCHECK(pixels);
1701 IntRect sourceImageRect;
1702 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows));
1703 sourceImageRect.setSize(IntSize(width, height));
1704 texImageHelperImageData(TexImage3D, target, level, internalformat, 0, format,
1705 type, depth, 0, 0, 0, pixels, sourceImageRect,
1706 m_unpackImageHeight);
1701 } 1707 }
1702 1708
1703 void WebGL2RenderingContextBase::texImage3D(GLenum target, 1709 void WebGL2RenderingContextBase::texImage3D(GLenum target,
1704 GLint level, 1710 GLint level,
1705 GLint internalformat, 1711 GLint internalformat,
1706 GLsizei width, 1712 GLsizei width,
1707 GLsizei height, 1713 GLsizei height,
1708 GLsizei depth, 1714 GLsizei depth,
1709 GLint border, 1715 GLint border,
1710 GLenum format, 1716 GLenum format,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 GLint level, 1823 GLint level,
1818 GLint xoffset, 1824 GLint xoffset,
1819 GLint yoffset, 1825 GLint yoffset,
1820 GLint zoffset, 1826 GLint zoffset,
1821 GLsizei width, 1827 GLsizei width,
1822 GLsizei height, 1828 GLsizei height,
1823 GLsizei depth, 1829 GLsizei depth,
1824 GLenum format, 1830 GLenum format,
1825 GLenum type, 1831 GLenum type,
1826 ImageData* pixels) { 1832 ImageData* pixels) {
1827 // TODO(zmo): To be implemented. 1833 DCHECK(pixels);
1834 IntRect sourceImageRect;
1835 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows));
1836 sourceImageRect.setSize(IntSize(width, height));
1837 texImageHelperImageData(TexSubImage3D, target, level, 0, 0, format, type,
1838 depth, xoffset, yoffset, zoffset, pixels,
1839 sourceImageRect, m_unpackImageHeight);
1828 } 1840 }
1829 1841
1830 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, 1842 void WebGL2RenderingContextBase::texSubImage3D(GLenum target,
1831 GLint level, 1843 GLint level,
1832 GLint xoffset, 1844 GLint xoffset,
1833 GLint yoffset, 1845 GLint yoffset,
1834 GLint zoffset, 1846 GLint zoffset,
1835 GLsizei width, 1847 GLsizei width,
1836 GLsizei height, 1848 GLsizei height,
1837 GLsizei depth, 1849 GLsizei depth,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 // TODO(zmo): To be implemented. 1907 // TODO(zmo): To be implemented.
1896 } 1908 }
1897 1909
1898 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, 1910 void WebGL2RenderingContextBase::texSubImage3D(GLenum target,
1899 GLint level, 1911 GLint level,
1900 GLint xoffset, 1912 GLint xoffset,
1901 GLint yoffset, 1913 GLint yoffset,
1902 GLint zoffset, 1914 GLint zoffset,
1903 GLenum format, 1915 GLenum format,
1904 GLenum type, 1916 GLenum type,
1905 ImageData* pixels) {
1906 texImageHelperImageData(TexSubImage3D, target, level, 0, 0, format, type, 1,
1907 xoffset, yoffset, zoffset, pixels,
1908 getImageDataSize(pixels));
1909 }
1910
1911 void WebGL2RenderingContextBase::texSubImage3D(GLenum target,
1912 GLint level,
1913 GLint xoffset,
1914 GLint yoffset,
1915 GLint zoffset,
1916 GLenum format,
1917 GLenum type,
1918 HTMLCanvasElement* canvas, 1917 HTMLCanvasElement* canvas,
1919 ExceptionState& exceptionState) { 1918 ExceptionState& exceptionState) {
1920 texImageHelperHTMLCanvasElement(TexSubImage3D, target, level, 0, format, type, 1919 texImageHelperHTMLCanvasElement(TexSubImage3D, target, level, 0, format, type,
1921 xoffset, yoffset, zoffset, canvas, 1920 xoffset, yoffset, zoffset, canvas,
1922 exceptionState); 1921 exceptionState);
1923 } 1922 }
1924 1923
1925 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, 1924 void WebGL2RenderingContextBase::texSubImage3D(GLenum target,
1926 GLint level, 1925 GLint level,
1927 GLint xoffset, 1926 GLint xoffset,
(...skipping 3037 matching lines...) Expand 10 before | Expand all | Expand 10 after
4965 4964
4966 void WebGL2RenderingContextBase:: 4965 void WebGL2RenderingContextBase::
4967 DrawingBufferClientRestorePixelUnpackBufferBinding() { 4966 DrawingBufferClientRestorePixelUnpackBufferBinding() {
4968 if (!contextGL()) 4967 if (!contextGL())
4969 return; 4968 return;
4970 contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 4969 contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER,
4971 objectOrZero(m_boundPixelUnpackBuffer.get())); 4970 objectOrZero(m_boundPixelUnpackBuffer.get()));
4972 } 4971 }
4973 4972
4974 } // namespace blink 4973 } // namespace blink
OLDNEW
« no previous file with comments | « DEPS ('k') | third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698