1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/quads/largest_draw_quad.h"
9 #include "cc/quads/debug_border_draw_quad.h"
10 #include "cc/quads/io_surface_draw_quad.h"
11 #include "cc/quads/picture_draw_quad.h"
12 #include "cc/quads/render_pass_draw_quad.h"
13 #include "cc/quads/solid_color_draw_quad.h"
14 #include "cc/quads/stream_video_draw_quad.h"
15 #include "cc/quads/surface_draw_quad.h"
16 #include "cc/quads/texture_draw_quad.h"
17 #include "cc/quads/tile_draw_quad.h"
18 #include "cc/quads/yuv_video_draw_quad.h"
21 const size_t kLargestDrawQuadSize
=
22 sizeof(cc::RenderPassDrawQuad
) > sizeof(cc::StreamVideoDrawQuad
)
23 ? sizeof(cc::RenderPassDrawQuad
)
24 : sizeof(cc::StreamVideoDrawQuad
);
29 size_t LargestDrawQuadSize() {
30 // Currently the largest quad is either a RenderPassDrawQuad or a
31 // StreamVideoDrawQuad depends on hardware structure.
33 // Use compile assert to make sure largest is actually larger than all other
34 // type of draw quads.
35 static_assert(sizeof(DebugBorderDrawQuad
) <= kLargestDrawQuadSize
,
36 "Largest Draw Quad size needs update. DebugBorderDrawQuad is "
37 "currently largest.");
38 static_assert(sizeof(IOSurfaceDrawQuad
) <= kLargestDrawQuadSize
,
39 "Largest Draw Quad size needs update. IOSurfaceDrawQuad is "
40 "currently largest.");
41 static_assert(sizeof(PictureDrawQuad
) <= kLargestDrawQuadSize
,
42 "Largest Draw Quad size needs update. PictureDrawQuad is "
43 "currently largest.");
44 static_assert(sizeof(TextureDrawQuad
) <= kLargestDrawQuadSize
,
45 "Largest Draw Quad size needs update. TextureDrawQuad is "
46 "currently largest.");
47 static_assert(sizeof(SolidColorDrawQuad
) <= kLargestDrawQuadSize
,
48 "Largest Draw Quad size needs update. SolidColorDrawQuad is "
49 "currently largest.");
50 static_assert(sizeof(SurfaceDrawQuad
) <= kLargestDrawQuadSize
,
51 "Largest Draw Quad size needs update. SurfaceDrawQuad is "
52 "currently largest.");
53 static_assert(sizeof(TileDrawQuad
) <= kLargestDrawQuadSize
,
54 "Largest Draw Quad size needs update. TileDrawQuad is "
55 "currently largest.");
56 static_assert(sizeof(YUVVideoDrawQuad
) <= kLargestDrawQuadSize
,
57 "Largest Draw Quad size needs update. YUVVideoDrawQuad is "
58 "currently largest.");
60 return kLargestDrawQuadSize
;