36 lines
1.0 KiB
C++
36 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "../frames/InputFrameMailbox.h"
|
|
#include "GLExtensions.h"
|
|
|
|
#include <cstdint>
|
|
|
|
class InputFrameTexture
|
|
{
|
|
public:
|
|
InputFrameTexture() = default;
|
|
InputFrameTexture(const InputFrameTexture&) = delete;
|
|
InputFrameTexture& operator=(const InputFrameTexture&) = delete;
|
|
~InputFrameTexture();
|
|
|
|
GLuint PollAndUpload(InputFrameMailbox* mailbox);
|
|
GLuint Texture() const { return mTexture; }
|
|
uint64_t UploadedFrames() const { return mUploadedFrames; }
|
|
uint64_t UploadMisses() const { return mUploadMisses; }
|
|
double LastUploadMilliseconds() const { return mLastUploadMilliseconds; }
|
|
bool LastFrameFormatSupported() const { return mLastFrameFormatSupported; }
|
|
void ShutdownGl();
|
|
|
|
private:
|
|
bool EnsureTexture(const InputFrame& frame);
|
|
void UploadBgra8FrameFlippedVertically(const InputFrame& frame);
|
|
|
|
GLuint mTexture = 0;
|
|
unsigned mWidth = 0;
|
|
unsigned mHeight = 0;
|
|
uint64_t mUploadedFrames = 0;
|
|
uint64_t mUploadMisses = 0;
|
|
double mLastUploadMilliseconds = 0.0;
|
|
bool mLastFrameFormatSupported = true;
|
|
};
|