2013-04-17 23:29:41 -04:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2013-01-31 23:11:53 +01:00
|
|
|
|
2014-02-10 13:54:46 -05:00
|
|
|
#pragma once
|
2013-01-31 23:11:53 +01:00
|
|
|
|
2014-01-23 00:47:49 +01:00
|
|
|
#include <utility>
|
2013-01-31 23:11:53 +01:00
|
|
|
#include "VideoCommon.h"
|
|
|
|
#include "FramebufferManager.h"
|
2013-02-01 15:15:25 +01:00
|
|
|
#include "GLUtil.h"
|
2013-01-31 23:11:53 +01:00
|
|
|
|
|
|
|
namespace OGL
|
|
|
|
{
|
|
|
|
|
|
|
|
class StreamBuffer {
|
|
|
|
|
|
|
|
public:
|
2014-01-23 00:47:49 +01:00
|
|
|
static StreamBuffer* Create(u32 type, size_t size);
|
|
|
|
virtual ~StreamBuffer();
|
|
|
|
|
|
|
|
/* This mapping function will return a pair of:
|
|
|
|
* - the pointer to the mapped buffer
|
|
|
|
* - the offset into the real gpu buffer (always multiple of stride)
|
|
|
|
* On mapping, the maximum of size for allocation has to be set.
|
|
|
|
* The size really pushed into this fifo only has to be known on Unmapping.
|
|
|
|
* Mapping invalidates the current buffer content,
|
|
|
|
* so it isn't allowed to access the old content any more.
|
|
|
|
*/
|
|
|
|
virtual std::pair<u8*, size_t> Map(size_t size, u32 stride = 0) = 0;
|
|
|
|
virtual void Unmap(size_t used_size) = 0;
|
|
|
|
|
|
|
|
const u32 m_buffer;
|
|
|
|
|
|
|
|
protected:
|
2014-01-09 18:52:05 +01:00
|
|
|
StreamBuffer(u32 type, size_t size);
|
2014-01-23 00:47:49 +01:00
|
|
|
void CreateFences();
|
2013-08-29 21:03:48 +02:00
|
|
|
void DeleteFences();
|
2014-01-23 00:47:49 +01:00
|
|
|
void AllocMemory(size_t size);
|
|
|
|
void Align(u32 stride);
|
2013-10-29 01:23:17 -04:00
|
|
|
|
2014-01-23 00:47:49 +01:00
|
|
|
const u32 m_buffertype;
|
|
|
|
const size_t m_size;
|
|
|
|
|
2013-01-31 23:11:53 +01:00
|
|
|
size_t m_iterator;
|
2013-02-01 16:43:08 +01:00
|
|
|
size_t m_used_iterator;
|
|
|
|
size_t m_free_iterator;
|
2014-01-23 00:47:49 +01:00
|
|
|
|
|
|
|
private:
|
2013-02-01 15:15:25 +01:00
|
|
|
GLsync *fences;
|
2013-01-31 23:11:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|