OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #ifndef MEDIA_GPU_COMMAND_BUFFER_HELPER_H_ |
| 6 #define MEDIA_GPU_COMMAND_BUFFER_HELPER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <memory> |
| 11 |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/optional.h" |
| 14 #include "media/gpu/media_gpu_export.h" |
| 15 #include "ui/gl/gl_bindings.h" |
| 16 |
| 17 namespace gpu { |
| 18 class GpuCommandBufferStub; |
| 19 struct Mailbox; |
| 20 struct SyncToken; |
| 21 namespace gles2 { |
| 22 class TextureRef; |
| 23 } // namespace gles2 |
| 24 } // namespace gpu |
| 25 |
| 26 namespace media { |
| 27 |
| 28 // Utility methods to simplify working with a gpu::GpuCommandBufferStub from |
| 29 // inside VDAs. |
| 30 class MEDIA_GPU_EXPORT CommandBufferHelper { |
| 31 public: |
| 32 static std::unique_ptr<CommandBufferHelper> Create( |
| 33 gpu::GpuCommandBufferStub* stub); |
| 34 |
| 35 virtual ~CommandBufferHelper() {} |
| 36 |
| 37 // TODO(sandersd): Provide scoped version? |
| 38 virtual bool MakeContextCurrent() = 0; |
| 39 |
| 40 // Creates a texture and configures it as a video frame (linear filtering, |
| 41 // clamp to edge, no mipmaps). The context must be current. |
| 42 // |
| 43 // See glTexImage2D() for parameter definitions. |
| 44 // |
| 45 // Returns nullptr on failure. |
| 46 virtual scoped_refptr<gpu::gles2::TextureRef> CreateTexture( |
| 47 GLenum target, |
| 48 GLenum internal_format, |
| 49 GLsizei width, |
| 50 GLsizei height, |
| 51 GLenum format, |
| 52 GLenum type) = 0; |
| 53 |
| 54 // Creates a sync token that has already been verified and released. |
| 55 virtual base::Optional<gpu::SyncToken> CreateSyncToken() = 0; |
| 56 |
| 57 // Creates a mailbox for a texture. |
| 58 virtual base::Optional<gpu::Mailbox> CreateMailbox( |
| 59 gpu::gles2::TextureRef* texture_ref) = 0; |
| 60 }; |
| 61 |
| 62 } // namespace media |
| 63 |
| 64 #endif // MEDIA_GPU_COMMAND_BUFFER_HELPER_H_ |
OLD | NEW |