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

Unified Diff: cc/quads/largest_draw_quad.h

Issue 698053002: Choose Largest DrawQuad Type No Longer Depended on Compiler Flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/quads/largest_draw_quad.h
diff --git a/cc/quads/largest_draw_quad.h b/cc/quads/largest_draw_quad.h
index d14906afad80976b744777cbfa877d0754395720..b5ee8dd50393da8bcb41df524749d580c6276019 100644
--- a/cc/quads/largest_draw_quad.h
+++ b/cc/quads/largest_draw_quad.h
@@ -5,15 +5,27 @@
#ifndef CC_QUADS_LARGEST_DRAW_QUAD_H_
#define CC_QUADS_LARGEST_DRAW_QUAD_H_
+#include "cc/quads/render_pass_draw_quad.h"
danakj 2014/11/03 18:14:21 including this includes GL headers which was break
weiliangc 2014/11/03 18:42:46 Have to include for sizeof(). I don't think it can
jbroman 2014/11/03 18:44:27 I'm curious how this broke the build before; do yo
danakj 2014/11/03 18:50:36 It was a matter of include files including include
danakj 2014/11/03 18:50:36 Ya, it would mean a function returning a size inst
+#include "cc/quads/stream_video_draw_quad.h"
+
namespace cc {
-class StreamVideoDrawQuad;
-class RenderPassDrawQuad;
-#if defined(ARCH_CPU_64_BITS)
-typedef RenderPassDrawQuad kLargestDrawQuad;
-#else
-typedef StreamVideoDrawQuad kLargestDrawQuad;
-#endif
+// The largest quad is either a RenderPassDrawQuad or a StreamVideoDrawQuad
+// depends on hardware structure, so use a template to determine which is
+// larger.
danakj 2014/11/03 18:14:21 TODO to use std::conditional when we can do that :
+template <bool RenderPassDrawQuadLarger>
danakj 2014/11/03 18:14:21 render_pass_draw_quad_is_larger
+struct LargerQuadOfEitherRenderPassOrStreamVideo {
+ typedef RenderPassDrawQuad Type;
danakj 2014/11/03 18:14:21 using Type = RenderPassDrawQuad
jbroman 2014/11/03 18:28:25 If you don't mind drive-by... Since you only ever
+};
+
+template <>
+struct LargerQuadOfEitherRenderPassOrStreamVideo<false> {
+ typedef StreamVideoDrawQuad Type;
danakj 2014/11/03 18:14:21 using Type = StreamVideoDrawQuad
+};
+
+typedef LargerQuadOfEitherRenderPassOrStreamVideo<(
danakj 2014/11/03 18:14:21 using kLargestDrawQuad = ...
+ sizeof(RenderPassDrawQuad) > sizeof(StreamVideoDrawQuad))>::Type
+ kLargestDrawQuad;
} // namespace cc
« 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