xbmc
RenderBufferDMA.h
1 /*
2  * Copyright (C) 2017-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "cores/RetroPlayer/buffers/BaseRenderBuffer.h"
12 
13 #include <memory>
14 
15 #include "system_gl.h"
16 
17 class CEGLImage;
18 class IBufferObject;
19 
20 namespace KODI
21 {
22 namespace RETRO
23 {
24 class CRenderContext;
25 
34 {
35 public:
36  CRenderBufferDMA(CRenderContext& context, int fourcc);
37  ~CRenderBufferDMA() override;
38 
39  // implementation of IRenderBuffer via CRenderBufferSysMem
40  bool Allocate(AVPixelFormat format, unsigned int width, unsigned int height) override;
41  size_t GetFrameSize() const override;
42  uint8_t* GetMemory() override;
43  DataAccess GetMemoryAccess() const override { return DataAccess::READ_WRITE; }
44  void ReleaseMemory() override;
45 
46  // implementation of IRenderBuffer
47  bool UploadTexture() override;
48 
49  GLuint TextureID() const { return m_textureId; }
50 
51 protected:
52  // Construction parameters
53  CRenderContext& m_context;
54  const int m_fourcc = 0;
55 
56  const GLenum m_textureTarget = GL_TEXTURE_2D;
57  GLuint m_textureId = 0;
58 
59 private:
60  void CreateTexture();
61  void DeleteTexture();
62 
63  std::unique_ptr<CEGLImage> m_egl;
64  std::unique_ptr<IBufferObject> m_bo;
65 };
66 } // namespace RETRO
67 } // namespace KODI
Special IRenderBuffer implementation for use with CBufferObject.
Definition: RenderBufferDMA.h:33
Interface to describe CBufferObjects.
Definition: IBufferObject.h:39
size_t GetFrameSize() const override
Definition: RenderBufferDMA.cpp:54
Controller configuration window.
Definition: AudioDecoder.h:18
Definition: RenderContext.h:43
Definition: EGLImage.h:20
Definition: BaseRenderBuffer.h:20