[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / content / common / gpu / client / gl_helper_readback_support.h
blob266711c26b6046871252efd59c82749965b98bfe
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 #ifndef CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_
8 #include <vector>
10 #include "content/common/gpu/client/gl_helper.h"
12 namespace content {
14 class CONTENT_EXPORT GLHelperReadbackSupport {
15 public:
16 GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl);
18 ~GLHelperReadbackSupport();
20 // Checks whether the readback (Color read format and type) is supported
21 // for the requested texture format by the hardware or not.
22 // For ex: some hardwares have rgb565 readback
23 // support when binded with the frame buffer for others it may fail.
24 // Here we pass the internal textureformat as skia config.
25 bool IsReadbackConfigSupported(SkColorType texture_format);
27 // Provides the additional readback format/type pairing for a render target
28 // of a given format/type pairing
29 void GetAdditionalFormat(GLint format, GLint type, GLint *format_out,
30 GLint *type_out);
31 private:
32 enum FormatSupport { FORMAT_NOT_SUPPORTED = 0, FORMAT_SUPPORTED, };
34 struct FormatCacheEntry {
35 GLint format;
36 GLint type;
37 GLint read_format;
38 GLint read_type;
41 // This populates the format_support_table with the list of supported
42 // formats.
43 void InitializeReadbackSupport();
45 // This api is called once per format and it is done in the
46 // InitializeReadbackSupport. We should not use this any where
47 // except the InitializeReadbackSupport.Calling this at other places
48 // can distrub the state of normal gl operations.
49 void CheckForReadbackSupport(SkColorType texture_format);
51 // Helper functions for checking the supported texture formats.
52 // Avoid using this API in between texture operations, as this does some
53 // teture opertions (bind, attach) internally.
54 bool SupportsFormat(GLint format, GLint type);
56 FormatSupport format_support_table_[kLastEnum_SkColorType + 1];
58 gpu::gles2::GLES2Interface* gl_;
59 std::vector<struct FormatCacheEntry> format_cache_;
62 } // namespace content
64 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_