OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file contains the GLES2Decoder class. | 5 // This file contains the GLES2Decoder class. |
6 | 6 |
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ |
8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/callback_old.h" | 13 #include "base/callback_old.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "gpu/command_buffer/common/constants.h" |
15 #include "gpu/command_buffer/service/common_decoder.h" | 16 #include "gpu/command_buffer/service/common_decoder.h" |
16 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
17 | 18 |
18 namespace gfx { | 19 namespace gfx { |
19 class GLContext; | 20 class GLContext; |
20 class GLSurface; | 21 class GLSurface; |
21 } | 22 } |
22 | 23 |
23 namespace gpu { | 24 namespace gpu { |
24 | 25 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, | 71 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, |
71 const scoped_refptr<gfx::GLContext>& context, | 72 const scoped_refptr<gfx::GLContext>& context, |
72 const gfx::Size& size, | 73 const gfx::Size& size, |
73 const DisallowedExtensions& disallowed_extensions, | 74 const DisallowedExtensions& disallowed_extensions, |
74 const char* allowed_extensions, | 75 const char* allowed_extensions, |
75 const std::vector<int32>& attribs) = 0; | 76 const std::vector<int32>& attribs) = 0; |
76 | 77 |
77 // Destroys the graphics context. | 78 // Destroys the graphics context. |
78 virtual void Destroy() = 0; | 79 virtual void Destroy() = 0; |
79 | 80 |
| 81 // Map a resource from an external context into this context. The source |
| 82 // context need not be in the same share group from the client's point of |
| 83 // view, allowing safe sharing between an "untrusted" context, like Pepper |
| 84 // and a compositor context. |
| 85 // |
| 86 // Currently only texture resources are supported. TODO(apatrick): generalize |
| 87 // this as appropriate. |
| 88 // |
| 89 // To unmap a previously mapped external resource, delete it in the |
| 90 // destination context group. This will not delete the underlying texture |
| 91 // object, just disassociate it with the id in the destination context group. |
| 92 // |
| 93 // The lifetime of the external resource is managed by the context group it |
| 94 // was originally created in. When the last context in that group is destroyed |
| 95 // the resource becomes invalid in all other context groups it is mapped into. |
| 96 virtual bool MapExternalResource(resource_type::ResourceType resource_type, |
| 97 uint32 resource_source_id, |
| 98 GLES2Decoder* source_decoder, |
| 99 uint32 resource_dest_id) = 0; |
| 100 |
80 virtual bool SetParent(GLES2Decoder* parent_decoder, | 101 virtual bool SetParent(GLES2Decoder* parent_decoder, |
81 uint32 parent_texture_id) = 0; | 102 uint32 parent_texture_id) = 0; |
82 | 103 |
83 // Resize an offscreen frame buffer. | 104 // Resize an offscreen frame buffer. |
84 virtual void ResizeOffscreenFrameBuffer(const gfx::Size& size) = 0; | 105 virtual void ResizeOffscreenFrameBuffer(const gfx::Size& size) = 0; |
85 | 106 |
86 // Force the offscreen frame buffer's size to be updated. This | 107 // Force the offscreen frame buffer's size to be updated. This |
87 // usually occurs lazily, during SwapBuffers, but on some platforms | 108 // usually occurs lazily, during SwapBuffers, but on some platforms |
88 // (Mac OS X in particular) it must be done immediately. | 109 // (Mac OS X in particular) it must be done immediately. |
89 virtual bool UpdateOffscreenFrameBufferSize() = 0; | 110 virtual bool UpdateOffscreenFrameBufferSize() = 0; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 private: | 145 private: |
125 bool debug_; | 146 bool debug_; |
126 | 147 |
127 DISALLOW_COPY_AND_ASSIGN(GLES2Decoder); | 148 DISALLOW_COPY_AND_ASSIGN(GLES2Decoder); |
128 }; | 149 }; |
129 | 150 |
130 } // namespace gles2 | 151 } // namespace gles2 |
131 } // namespace gpu | 152 } // namespace gpu |
132 | 153 |
133 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ | 154 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ |
OLD | NEW |