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

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

Issue 1489253003: Format argument of CompressedTexSubImage2D should match format of texture being modified (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 WebGLTexture* tex = validateTextureBinding("compressedTexSubImage2D", target , true); 1907 WebGLTexture* tex = validateTextureBinding("compressedTexSubImage2D", target , true);
1908 if (!tex) 1908 if (!tex)
1909 return; 1909 return;
1910 1910
1911 if (!validateTexFuncLevel("compressedTexSubImage2D", target, level)) 1911 if (!validateTexFuncLevel("compressedTexSubImage2D", target, level))
1912 return; 1912 return;
1913 if (!validateCompressedTexFormat(format)) { 1913 if (!validateCompressedTexFormat(format)) {
1914 synthesizeGLError(GL_INVALID_ENUM, "compressedTexSubImage2D", "invalid f ormat"); 1914 synthesizeGLError(GL_INVALID_ENUM, "compressedTexSubImage2D", "invalid f ormat");
1915 return; 1915 return;
1916 } 1916 }
1917 if (format != tex->getInternalFormat(target, level)) {
1918 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexSubImage2D", "form at does not match texture format");
1919 return;
1920 }
1917 if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height, format, data)) 1921 if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height, format, data))
1918 return; 1922 return;
1919 1923
1920 if (!isWebGL2OrHigher() && format != tex->getInternalFormat(target, level)) {
1921 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexSubImage2D", "form at does not match texture format");
1922 return;
1923 }
1924
1925 if (!validateCompressedTexSubDimensions("compressedTexSubImage2D", target, l evel, xoffset, yoffset, width, height, format, tex)) 1924 if (!validateCompressedTexSubDimensions("compressedTexSubImage2D", target, l evel, xoffset, yoffset, width, height, format, tex))
1926 return; 1925 return;
1927 1926
1928 webContext()->compressedTexSubImage2D(target, level, xoffset, yoffset, 1927 webContext()->compressedTexSubImage2D(target, level, xoffset, yoffset,
1929 width, height, format, data->byteLength(), data->baseAddress()); 1928 width, height, format, data->byteLength(), data->baseAddress());
1930 } 1929 }
1931 1930
1932 bool WebGLRenderingContextBase::validateSettableTexFormat(const char* functionNa me, GLenum format) 1931 bool WebGLRenderingContextBase::validateSettableTexFormat(const char* functionNa me, GLenum format)
1933 { 1932 {
1934 if (isWebGL2OrHigher()) 1933 if (isWebGL2OrHigher())
(...skipping 5021 matching lines...) Expand 10 before | Expand all | Expand 10 after
6956 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); 6955 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1);
6957 } 6956 }
6958 6957
6959 void WebGLRenderingContextBase::restoreUnpackParameters() 6958 void WebGLRenderingContextBase::restoreUnpackParameters()
6960 { 6959 {
6961 if (m_unpackAlignment != 1) 6960 if (m_unpackAlignment != 1)
6962 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6961 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6963 } 6962 }
6964 6963
6965 } // namespace blink 6964 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698