| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ | 5 #ifndef CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ |
| 6 #define CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ | 6 #define CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 virtual void bindBuffer(WebKit::WGC3Denum target, WebKit::WebGLId buffer); | 121 virtual void bindBuffer(WebKit::WGC3Denum target, WebKit::WebGLId buffer); |
| 122 virtual void bufferData(WebKit::WGC3Denum target, | 122 virtual void bufferData(WebKit::WGC3Denum target, |
| 123 WebKit::WGC3Dsizeiptr size, | 123 WebKit::WGC3Dsizeiptr size, |
| 124 const void* data, | 124 const void* data, |
| 125 WebKit::WGC3Denum usage); | 125 WebKit::WGC3Denum usage); |
| 126 virtual void* mapBufferCHROMIUM(WebKit::WGC3Denum target, | 126 virtual void* mapBufferCHROMIUM(WebKit::WGC3Denum target, |
| 127 WebKit::WGC3Denum access); | 127 WebKit::WGC3Denum access); |
| 128 virtual WebKit::WGC3Dboolean unmapBufferCHROMIUM(WebKit::WGC3Denum target); | 128 virtual WebKit::WGC3Dboolean unmapBufferCHROMIUM(WebKit::WGC3Denum target); |
| 129 | 129 |
| 130 virtual void bindTexImage2DCHROMIUM(WebKit::WGC3Denum target, |
| 131 WebKit::WGC3Dint image_id); |
| 132 virtual WebKit::WGC3Duint createImageCHROMIUM( |
| 133 WebKit::WGC3Dsizei width, |
| 134 WebKit::WGC3Dsizei height, |
| 135 WebKit::WGC3Denum internalformat); |
| 136 virtual void destroyImageCHROMIUM(WebKit::WGC3Duint image_id); |
| 137 virtual void getImageParameterivCHROMIUM( |
| 138 WebKit::WGC3Duint image_id, |
| 139 WebKit::WGC3Denum pname, |
| 140 WebKit::WGC3Dint* params); |
| 141 virtual void* mapImageCHROMIUM( |
| 142 WebKit::WGC3Duint image_id, |
| 143 WebKit::WGC3Denum access); |
| 144 virtual void unmapImageCHROMIUM(WebKit::WGC3Duint image_id); |
| 145 |
| 130 // When set, MakeCurrent() will fail after this many times. | 146 // When set, MakeCurrent() will fail after this many times. |
| 131 void set_times_make_current_succeeds(int times) { | 147 void set_times_make_current_succeeds(int times) { |
| 132 times_make_current_succeeds_ = times; | 148 times_make_current_succeeds_ = times; |
| 133 } | 149 } |
| 134 void set_times_bind_texture_succeeds(int times) { | 150 void set_times_bind_texture_succeeds(int times) { |
| 135 times_bind_texture_succeeds_ = times; | 151 times_bind_texture_succeeds_ = times; |
| 136 } | 152 } |
| 137 void set_times_end_query_succeeds(int times) { | 153 void set_times_end_query_succeeds(int times) { |
| 138 times_end_query_succeeds_ = times; | 154 times_end_query_succeeds_ = times; |
| 139 } | 155 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 159 shared_contexts_.push_back(context3d); | 175 shared_contexts_.push_back(context3d); |
| 160 } | 176 } |
| 161 | 177 |
| 162 void set_max_texture_size(int size) { max_texture_size_ = size; } | 178 void set_max_texture_size(int size) { max_texture_size_ = size; } |
| 163 | 179 |
| 164 static const WebKit::WebGLId kExternalTextureId; | 180 static const WebKit::WebGLId kExternalTextureId; |
| 165 virtual WebKit::WebGLId NextTextureId(); | 181 virtual WebKit::WebGLId NextTextureId(); |
| 166 | 182 |
| 167 virtual WebKit::WebGLId NextBufferId(); | 183 virtual WebKit::WebGLId NextBufferId(); |
| 168 | 184 |
| 185 virtual WebKit::WebGLId NextImageId(); |
| 186 |
| 169 protected: | 187 protected: |
| 170 TestWebGraphicsContext3D(); | 188 TestWebGraphicsContext3D(); |
| 171 TestWebGraphicsContext3D( | 189 TestWebGraphicsContext3D( |
| 172 const WebKit::WebGraphicsContext3D::Attributes& attributes); | 190 const WebKit::WebGraphicsContext3D::Attributes& attributes); |
| 173 | 191 |
| 174 void CallAllSyncPointCallbacks(); | 192 void CallAllSyncPointCallbacks(); |
| 175 void SwapBuffersComplete(); | 193 void SwapBuffersComplete(); |
| 176 | 194 |
| 177 unsigned context_id_; | 195 unsigned context_id_; |
| 178 unsigned next_buffer_id_; | 196 unsigned next_buffer_id_; |
| 197 unsigned next_image_id_; |
| 179 unsigned next_texture_id_; | 198 unsigned next_texture_id_; |
| 180 Attributes attributes_; | 199 Attributes attributes_; |
| 181 bool have_extension_io_surface_; | 200 bool have_extension_io_surface_; |
| 182 bool have_extension_egl_image_; | 201 bool have_extension_egl_image_; |
| 183 int times_make_current_succeeds_; | 202 int times_make_current_succeeds_; |
| 184 int times_bind_texture_succeeds_; | 203 int times_bind_texture_succeeds_; |
| 185 int times_end_query_succeeds_; | 204 int times_end_query_succeeds_; |
| 186 bool context_lost_; | 205 bool context_lost_; |
| 187 WebGraphicsContextLostCallback* context_lost_callback_; | 206 WebGraphicsContextLostCallback* context_lost_callback_; |
| 188 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* swap_buffers_callback_; | 207 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* swap_buffers_callback_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 199 ~Buffer(); | 218 ~Buffer(); |
| 200 | 219 |
| 201 WebKit::WGC3Denum target; | 220 WebKit::WGC3Denum target; |
| 202 scoped_ptr<uint8[]> pixels; | 221 scoped_ptr<uint8[]> pixels; |
| 203 | 222 |
| 204 private: | 223 private: |
| 205 DISALLOW_COPY_AND_ASSIGN(Buffer); | 224 DISALLOW_COPY_AND_ASSIGN(Buffer); |
| 206 }; | 225 }; |
| 207 ScopedPtrHashMap<unsigned, Buffer> buffers_; | 226 ScopedPtrHashMap<unsigned, Buffer> buffers_; |
| 208 unsigned bound_buffer_; | 227 unsigned bound_buffer_; |
| 228 struct Image { |
| 229 Image(); |
| 230 ~Image(); |
| 231 |
| 232 scoped_ptr<uint8[]> pixels; |
| 233 |
| 234 private: |
| 235 DISALLOW_COPY_AND_ASSIGN(Image); |
| 236 }; |
| 237 ScopedPtrHashMap<unsigned, Image> images_; |
| 209 base::WeakPtrFactory<TestWebGraphicsContext3D> weak_ptr_factory_; | 238 base::WeakPtrFactory<TestWebGraphicsContext3D> weak_ptr_factory_; |
| 210 }; | 239 }; |
| 211 | 240 |
| 212 } // namespace cc | 241 } // namespace cc |
| 213 | 242 |
| 214 #endif // CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ | 243 #endif // CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ |
| OLD | NEW |