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

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

Issue 2520043004: Fix semantics of uploading HTML sources to 3D textures. (Closed)
Patch Set: Created 4 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 | third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp » ('j') | 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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 subRect.height() < 0) { 1060 subRect.height() < 0) {
1061 synthesizeGLError(GL_INVALID_OPERATION, functionName, 1061 synthesizeGLError(GL_INVALID_OPERATION, functionName,
1062 "source sub-rectangle specified via pixel unpack " 1062 "source sub-rectangle specified via pixel unpack "
1063 "parameters is invalid"); 1063 "parameters is invalid");
1064 return false; 1064 return false;
1065 } 1065 }
1066 1066
1067 if (functionID == TexImage3D || functionID == TexSubImage3D) { 1067 if (functionID == TexImage3D || functionID == TexSubImage3D) {
1068 DCHECK_GE(unpackImageHeight, 0); 1068 DCHECK_GE(unpackImageHeight, 0);
1069 1069
1070 // Verify that the image data can cover the required depth. 1070 if (depth < 1) {
1071 WTF::CheckedNumeric<GLint> maxDepthSupported = 1; 1071 synthesizeGLError(GL_INVALID_OPERATION, functionName,
1072 if (unpackImageHeight) { 1072 "Can't define a 3D texture with depth < 1");
1073 maxDepthSupported = subRect.height(); 1073 return false;
1074 maxDepthSupported /= unpackImageHeight;
1075 } 1074 }
1076 1075
1077 if (!maxDepthSupported.IsValid() || 1076 // According to the WebGL 2.0 spec, specifying depth > 1 means
1078 maxDepthSupported.ValueOrDie() < depth) { 1077 // to select multiple rectangles stacked vertically.
1078 WTF::CheckedNumeric<GLint> maxYAccessed;
1079 if (unpackImageHeight) {
1080 maxYAccessed = unpackImageHeight;
1081 } else {
1082 maxYAccessed = subRect.height();
1083 }
1084 maxYAccessed *= depth - 1;
1085 maxYAccessed += subRect.height();
1086 maxYAccessed += subRect.y();
1087
1088 if (!maxYAccessed.IsValid()) {
1089 synthesizeGLError(GL_INVALID_OPERATION, functionName,
1090 "Out-of-range parameters passed for 3D texture "
1091 "upload");
1092 return false;
1093 }
1094
1095 if (maxYAccessed.ValueOrDie() > imageHeight) {
1079 synthesizeGLError(GL_INVALID_OPERATION, functionName, 1096 synthesizeGLError(GL_INVALID_OPERATION, functionName,
1080 "Not enough data supplied to upload to a 3D texture " 1097 "Not enough data supplied to upload to a 3D texture "
1081 "with depth > 1"); 1098 "with depth > 1");
1082 return false; 1099 return false;
1083 } 1100 }
1084 } else { 1101 } else {
1085 DCHECK_EQ(depth, 1); 1102 DCHECK_EQ(depth, 1);
1086 DCHECK_EQ(unpackImageHeight, 0); 1103 DCHECK_EQ(unpackImageHeight, 0);
1087 } 1104 }
1088 return true; 1105 return true;
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 context, 1668 context,
1652 context->is3d(), 1669 context->is3d(),
1653 context.is3d()); 1670 context.is3d());
1654 1671
1655 } // namespace blink 1672 } // namespace blink
1656 1673
1657 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( 1674 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(
1658 blink::WebGLRenderingContextBase::TextureUnitState); 1675 blink::WebGLRenderingContextBase::TextureUnitState);
1659 1676
1660 #endif // WebGLRenderingContextBase_h 1677 #endif // WebGLRenderingContextBase_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698