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

Unified Diff: gpu/command_buffer/common/gles2_cmd_utils.cc

Issue 12017032: Add calls to EnsureGPUMemoryAvailable into GLES2DecoderImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/common/gles2_cmd_utils.cc
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc
index f2513a9267a5152bbb62c86c2cf470cabf9c7698..e0b55793e949c17e27977a32761c5f3768c3e93d 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -445,6 +445,23 @@ bool GLES2Util::ComputeImageDataSizes(
return true;
}
+bool GLES2Util::ComputeEstimatedRenderbufferSize(
+ int width, int height, int samples, int internal_format, uint32* size) {
+ uint32 temp = 0;
+ if (!SafeMultiplyUint32(width, height, &temp)) {
+ return false;
+ }
+ if (!SafeMultiplyUint32(temp, samples, &temp)) {
+ return false;
+ }
+ if (!SafeMultiplyUint32(
+ temp, GLES2Util::RenderbufferBytesPerPixel(internal_format), &temp)) {
+ return false;
+ }
+ *size = temp;
+ return true;
+}
+
size_t GLES2Util::RenderbufferBytesPerPixel(int format) {
switch (format) {
case GL_STENCIL_INDEX8:

Powered by Google App Engine
This is Rietveld 408576698