mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
Rewrite ColorBufferToRDRAM
This commit is contained in:
parent
aa2131e8f6
commit
5ba4588752
|
@ -265,8 +265,6 @@
|
|||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\3DMath.cpp" />
|
||||
<ClCompile Include="..\..\src\BufferCopy\ColorBufferToRDRAM.cpp" />
|
||||
<ClCompile Include="..\..\src\BufferCopy\ColorBufferToRDRAM_BufferStorageExt.cpp" />
|
||||
<ClCompile Include="..\..\src\BufferCopy\ColorBufferToRDRAM_GL.cpp" />
|
||||
<ClCompile Include="..\..\src\BufferCopy\DepthBufferToRDRAM.cpp" />
|
||||
<ClCompile Include="..\..\src\BufferCopy\RDRAMtoColorBuffer.cpp" />
|
||||
<ClCompile Include="..\..\src\Combiner.cpp" />
|
||||
|
@ -406,8 +404,6 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\3DMath.h" />
|
||||
<ClInclude Include="..\..\src\BufferCopy\ColorBufferToRDRAM.h" />
|
||||
<ClInclude Include="..\..\src\BufferCopy\ColorBufferToRDRAM_BufferStorageExt.h" />
|
||||
<ClInclude Include="..\..\src\BufferCopy\ColorBufferToRDRAM_GL.h" />
|
||||
<ClInclude Include="..\..\src\BufferCopy\DepthBufferToRDRAM.h" />
|
||||
<ClInclude Include="..\..\src\BufferCopy\PBOBinder.h" />
|
||||
<ClInclude Include="..\..\src\BufferCopy\RDRAMtoColorBuffer.h" />
|
||||
|
|
|
@ -221,9 +221,6 @@
|
|||
<ClCompile Include="..\..\src\BufferCopy\RDRAMtoColorBuffer.cpp">
|
||||
<Filter>Source Files\BufferCopy</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\BufferCopy\ColorBufferToRDRAM_GL.cpp">
|
||||
<Filter>Source Files\BufferCopy</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\TextureFilterHandler.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -248,9 +245,6 @@
|
|||
<ClCompile Include="..\..\src\Log.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\BufferCopy\ColorBufferToRDRAM_BufferStorageExt.cpp">
|
||||
<Filter>Source Files\BufferCopy</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\F3DSETA.cpp">
|
||||
<Filter>Source Files\uCodes</Filter>
|
||||
</ClCompile>
|
||||
|
@ -520,12 +514,6 @@
|
|||
<ClInclude Include="..\..\src\common\GLFunctions.h">
|
||||
<Filter>Header Files\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\BufferCopy\ColorBufferToRDRAM_BufferStorageExt.h">
|
||||
<Filter>Header Files\BufferCopy</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\BufferCopy\ColorBufferToRDRAM_GL.h">
|
||||
<Filter>Header Files\BufferCopy</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\F3DSETA.h">
|
||||
<Filter>Header Files\uCodes</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include <N64.h>
|
||||
#include <VI.h>
|
||||
#include "Log.h"
|
||||
|
||||
/*
|
||||
#ifndef GLES2
|
||||
#include "ColorBufferToRDRAM_GL.h"
|
||||
#include "ColorBufferToRDRAM_BufferStorageExt.h"
|
||||
|
@ -17,8 +19,11 @@
|
|||
#else
|
||||
#include "ColorBufferToRDRAMStub.h"
|
||||
#endif
|
||||
*/
|
||||
|
||||
#include <Graphics/Context.h>
|
||||
#include <Graphics/Parameters.h>
|
||||
#include <Graphics/ColorBufferReader.h>
|
||||
#include <DisplayWindow.h>
|
||||
|
||||
using namespace graphics;
|
||||
|
@ -43,27 +48,22 @@ ColorBufferToRDRAM::~ColorBufferToRDRAM()
|
|||
|
||||
void ColorBufferToRDRAM::init()
|
||||
{
|
||||
// generate a framebuffer
|
||||
// glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
// glGenFramebuffers(1, &m_FBO);
|
||||
|
||||
m_FBO = gfxContext.createFramebuffer();
|
||||
_init();
|
||||
}
|
||||
|
||||
void ColorBufferToRDRAM::destroy() {
|
||||
_destroyFBTexure();
|
||||
|
||||
// glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
if (m_FBO.isNotNull()) {
|
||||
gfxContext.deleteFramebuffer(m_FBO);
|
||||
// glDeleteFramebuffers(1, &m_FBO);
|
||||
m_FBO.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void ColorBufferToRDRAM::_initFBTexture(void)
|
||||
{
|
||||
const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats();
|
||||
|
||||
m_pTexture = textureCache().addFrameBufferTexture(false);
|
||||
m_pTexture->format = G_IM_FMT_RGBA;
|
||||
m_pTexture->clampS = 1;
|
||||
|
@ -77,11 +77,10 @@ void ColorBufferToRDRAM::_initFBTexture(void)
|
|||
//cause slowdowns in the glReadPixels call, at least on Android
|
||||
m_pTexture->realWidth = _getRealWidth(m_lastBufferWidth);
|
||||
m_pTexture->realHeight = m_lastBufferHeight;
|
||||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * 4;
|
||||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * fbTexFormat.colorFormatBytes;
|
||||
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
|
||||
|
||||
{
|
||||
const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats();
|
||||
Context::InitTextureParams params;
|
||||
params.handle = m_pTexture->name;
|
||||
params.width = m_pTexture->realWidth;
|
||||
|
@ -111,17 +110,17 @@ void ColorBufferToRDRAM::_initFBTexture(void)
|
|||
}
|
||||
|
||||
// check if everything is OK
|
||||
assert(checkFBO());
|
||||
assert(!gfxContext.isFramebufferError());
|
||||
|
||||
gfxContext.bindFramebuffer(graphics::bufferTarget::DRAW_FRAMEBUFFER, graphics::ObjectHandle());
|
||||
// glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
||||
_initBuffers();
|
||||
m_bufferReader.reset(gfxContext.createColorBufferReader(m_pTexture));
|
||||
}
|
||||
|
||||
void ColorBufferToRDRAM::_destroyFBTexure(void)
|
||||
{
|
||||
_destroyBuffers();
|
||||
m_bufferReader.reset();
|
||||
|
||||
if (m_pTexture != nullptr) {
|
||||
textureCache().removeFrameBufferTexture(m_pTexture);
|
||||
|
@ -161,7 +160,6 @@ bool ColorBufferToRDRAM::_prepareCopy(u32 _startAddress)
|
|||
m_lastBufferWidth = pBuffer->m_width;
|
||||
m_lastBufferHeight = pBuffer->m_height;
|
||||
_initFBTexture();
|
||||
m_pixelData.resize(m_pTexture->realWidth * m_pTexture->realHeight * gfxContext.getFramebufferTextureFormats().colorFormatBytes);
|
||||
}
|
||||
|
||||
m_pCurFrameBuffer = pBuffer;
|
||||
|
@ -261,29 +259,29 @@ void ColorBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress, bool _sync)
|
|||
numPixels = (_endAddress - _startAddress) >> (m_pCurFrameBuffer->m_size - 1);
|
||||
}
|
||||
|
||||
const GLsizei width = m_pCurFrameBuffer->m_width;
|
||||
const GLint x0 = 0;
|
||||
const GLint y0 = max_height - (_endAddress - m_pCurFrameBuffer->m_startAddress) / stride;
|
||||
const GLint y1 = max_height - (_startAddress - m_pCurFrameBuffer->m_startAddress) / stride;
|
||||
const GLsizei height = std::min(max_height, 1u + y1 - y0);
|
||||
const u32 width = m_pCurFrameBuffer->m_width;
|
||||
const s32 x0 = 0;
|
||||
const s32 y0 = max_height - (_endAddress - m_pCurFrameBuffer->m_startAddress) / stride;
|
||||
const u32 y1 = max_height - (_startAddress - m_pCurFrameBuffer->m_startAddress) / stride;
|
||||
const u32 height = std::min(max_height, 1u + y1 - y0);
|
||||
|
||||
const bool pixelsRead = _readPixels(x0, y0, width, height, m_pCurFrameBuffer->m_size, _sync);
|
||||
const u8* pPixels = m_bufferReader->readPixels(x0, y0, width, height, m_pCurFrameBuffer->m_size, _sync);
|
||||
frameBufferList().setCurrentDrawBuffer();
|
||||
if (!pixelsRead)
|
||||
if (pPixels == nullptr)
|
||||
return;
|
||||
|
||||
if (m_pCurFrameBuffer->m_size == G_IM_SIZ_32b) {
|
||||
u32 *ptr_src = (u32*)m_pixelData.data();
|
||||
u32 *ptr_src = (u32*)pPixels;
|
||||
u32 *ptr_dst = (u32*)(RDRAM + _startAddress);
|
||||
writeToRdram<u32, u32>(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoRGBA32, 0, 0, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size);
|
||||
}
|
||||
else if (m_pCurFrameBuffer->m_size == G_IM_SIZ_16b) {
|
||||
u32 *ptr_src = (u32*)m_pixelData.data();
|
||||
u32 *ptr_src = (u32*)pPixels;
|
||||
u16 *ptr_dst = (u16*)(RDRAM + _startAddress);
|
||||
writeToRdram<u32, u16>(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoRGBA16, 0, 1, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size);
|
||||
}
|
||||
else if (m_pCurFrameBuffer->m_size == G_IM_SIZ_8b) {
|
||||
u8 *ptr_src = (u8*)m_pixelData.data();
|
||||
u8 *ptr_src = (u8*)pPixels;
|
||||
u8 *ptr_dst = RDRAM + _startAddress;
|
||||
writeToRdram<u8, u8>(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoR8, 0, 3, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size);
|
||||
}
|
||||
|
@ -292,7 +290,7 @@ void ColorBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress, bool _sync)
|
|||
m_pCurFrameBuffer->copyRdram();
|
||||
m_pCurFrameBuffer->m_cleared = false;
|
||||
|
||||
_cleanUp();
|
||||
m_bufferReader->cleanUp();
|
||||
|
||||
gDP.changed |= CHANGED_SCISSOR;
|
||||
}
|
||||
|
@ -326,6 +324,10 @@ void ColorBufferToRDRAM::copyChunkToRDRAM(u32 _address)
|
|||
|
||||
ColorBufferToRDRAM & ColorBufferToRDRAM::get()
|
||||
{
|
||||
static ColorBufferToRDRAM cbCopy;
|
||||
return cbCopy;
|
||||
|
||||
/*
|
||||
#ifndef GLES2
|
||||
|
||||
static bool supportsBufferStorage = OGLVideo::isExtensionSupported("GL_EXT_buffer_storage") ||
|
||||
|
@ -346,6 +348,7 @@ ColorBufferToRDRAM & ColorBufferToRDRAM::get()
|
|||
static ColorBufferToRDRAMStub cbCopy;
|
||||
return cbCopy;
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void copyWhiteToRDRAM(FrameBuffer * _pBuffer)
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
#ifndef ColorBufferToRDRAM_H
|
||||
#define ColorBufferToRDRAM_H
|
||||
|
||||
#include <OpenGL.h>
|
||||
#include <memory>
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <Graphics/ObjectHandle.h>
|
||||
|
||||
namespace graphics {
|
||||
class ColorBufferReader;
|
||||
}
|
||||
|
||||
struct CachedTexture;
|
||||
struct FrameBuffer;
|
||||
|
||||
|
@ -20,20 +24,12 @@ public:
|
|||
|
||||
static ColorBufferToRDRAM & get();
|
||||
|
||||
protected:
|
||||
private:
|
||||
ColorBufferToRDRAM();
|
||||
ColorBufferToRDRAM(const ColorBufferToRDRAM &);
|
||||
virtual ~ColorBufferToRDRAM();
|
||||
|
||||
CachedTexture * m_pTexture;
|
||||
std::vector<u8> m_pixelData;
|
||||
|
||||
private:
|
||||
virtual void _init() = 0;
|
||||
virtual void _initBuffers(void) = 0;
|
||||
virtual void _destroyBuffers(void) = 0;
|
||||
virtual bool _readPixels(s32 _x0, s32 _y0, u32 _width, u32 _height, u32 _size, bool _sync) = 0;
|
||||
virtual void _cleanUp() = 0;
|
||||
|
||||
union RGBA {
|
||||
struct {
|
||||
|
@ -66,6 +62,7 @@ private:
|
|||
u32 m_lastBufferHeight;
|
||||
|
||||
std::array<u32, 3> m_allowedRealWidths;
|
||||
std::unique_ptr<graphics::ColorBufferReader> m_bufferReader;
|
||||
};
|
||||
|
||||
void copyWhiteToRDRAM(FrameBuffer * _pBuffer);
|
||||
|
|
|
@ -369,12 +369,12 @@ CachedTexture * FrameBuffer::_getSubTexture(u32 _t)
|
|||
if (!_initSubTexture(_t))
|
||||
return m_pTexture;
|
||||
|
||||
GLint x0 = (GLint)(m_pTexture->offsetS * m_scaleX);
|
||||
GLint y0 = (GLint)(m_pTexture->offsetT * m_scaleY) - m_pSubTexture->realHeight;
|
||||
GLint copyWidth = m_pSubTexture->realWidth;
|
||||
s32 x0 = (s32)(m_pTexture->offsetS * m_scaleX);
|
||||
s32 y0 = (s32)(m_pTexture->offsetT * m_scaleY) - m_pSubTexture->realHeight;
|
||||
s32 copyWidth = m_pSubTexture->realWidth;
|
||||
if (x0 + copyWidth > m_pTexture->realWidth)
|
||||
copyWidth = m_pTexture->realWidth - x0;
|
||||
GLint copyHeight = m_pSubTexture->realHeight;
|
||||
s32 copyHeight = m_pSubTexture->realHeight;
|
||||
if (y0 + copyHeight > m_pTexture->realHeight)
|
||||
copyHeight = m_pTexture->realHeight - y0;
|
||||
|
||||
|
@ -783,7 +783,7 @@ void FrameBufferList::attachDepthBuffer()
|
|||
if (goodDepthBufferTexture) {
|
||||
#endif // USE_DEPTH_RENDERBUFFER
|
||||
m_pCurrent->m_pDepthBuffer = pDepthBuffer;
|
||||
pDepthBuffer->setDepthAttachment(m_pCurrent->m_FBO, GL_DRAW_FRAMEBUFFER);
|
||||
pDepthBuffer->setDepthAttachment(m_pCurrent->m_FBO, bufferTarget::DRAW_FRAMEBUFFER);
|
||||
if (Context::imageTextures && config.frameBufferEmulation.N64DepthCompare != 0)
|
||||
pDepthBuffer->bindDepthImageTexture();
|
||||
} else
|
||||
|
@ -834,12 +834,12 @@ void FrameBufferList::renderBuffer(u32 _address)
|
|||
|
||||
DisplayWindow & wnd = dwnd();
|
||||
GraphicsDrawer & drawer = wnd.getDrawer();
|
||||
GLint srcY0, srcY1, dstY0, dstY1;
|
||||
GLint X0, X1, Xwidth;
|
||||
GLint Xoffset = 0;
|
||||
GLint Xdivot = 0;
|
||||
GLint srcPartHeight = 0;
|
||||
GLint dstPartHeight = 0;
|
||||
s32 srcY0, srcY1, dstY0, dstY1;
|
||||
s32 X0, X1, Xwidth;
|
||||
s32 Xoffset = 0;
|
||||
s32 Xdivot = 0;
|
||||
s32 srcPartHeight = 0;
|
||||
s32 dstPartHeight = 0;
|
||||
|
||||
const f32 yScale = _FIXED2FLOAT(_SHIFTR(*REG.VI_Y_SCALE, 0, 12), 10);
|
||||
s32 vEnd = _SHIFTR(*REG.VI_V_START, 0, 10);
|
||||
|
@ -882,14 +882,14 @@ void FrameBufferList::renderBuffer(u32 _address)
|
|||
|
||||
if (srcY0 + vCurrentHeight > vFullHeight) {
|
||||
dstPartHeight = srcY0;
|
||||
srcY0 = (GLint)(srcY0*yScale);
|
||||
srcY0 = (s32)(srcY0*yScale);
|
||||
srcPartHeight = srcY0;
|
||||
srcY1 = VI.real_height;
|
||||
dstY1 = dstY0 + vCurrentHeight - dstPartHeight;
|
||||
} else {
|
||||
dstY0 += srcY0;
|
||||
dstY1 = dstY0 + vCurrentHeight;
|
||||
srcY0 = (GLint)(srcY0*yScale);
|
||||
srcY0 = (s32)(srcY0*yScale);
|
||||
srcY1 = srcY0 + VI.real_height;
|
||||
}
|
||||
PostProcessor & postProcessor = PostProcessor::get();
|
||||
|
@ -907,29 +907,29 @@ void FrameBufferList::renderBuffer(u32 _address)
|
|||
const s32 h0 = (isPAL ? 128 : 108);
|
||||
const s32 hx0 = max(0, hStart - h0);
|
||||
const s32 hx1 = max(0, h0 + 640 - hEnd);
|
||||
X0 = (GLint)((hx0 * viScaleX + Xoffset) * dstScaleX);
|
||||
Xwidth = (GLint)((min((f32)VI.width, (hEnd - hStart)*viScaleX - Xoffset - Xdivot)) * srcScaleX);
|
||||
X1 = wnd.getWidth() - (GLint)((hx1*viScaleX + Xdivot) * dstScaleX);
|
||||
X0 = (s32)((hx0 * viScaleX + Xoffset) * dstScaleX);
|
||||
Xwidth = (s32)((min((f32)VI.width, (hEnd - hStart)*viScaleX - Xoffset - Xdivot)) * srcScaleX);
|
||||
X1 = wnd.getWidth() - (s32)((hx1*viScaleX + Xdivot) * dstScaleX);
|
||||
|
||||
const f32 srcScaleY = pFilteredBuffer->m_scaleY;
|
||||
CachedTexture * pBufferTexture = pFilteredBuffer->m_pTexture;
|
||||
const GLint hCrop = config.video.cropMode == Config::cmDisable ? 0 : GLint(config.video.cropWidth * srcScaleX);
|
||||
const GLint vCrop = config.video.cropMode == Config::cmDisable ? 0 : GLint(config.video.cropHeight * srcScaleY);
|
||||
GLint srcCoord[4] = { hCrop,
|
||||
vCrop + (GLint)(srcY0*srcScaleY),
|
||||
const s32 hCrop = config.video.cropMode == Config::cmDisable ? 0 : s32(config.video.cropWidth * srcScaleX);
|
||||
const s32 vCrop = config.video.cropMode == Config::cmDisable ? 0 : s32(config.video.cropHeight * srcScaleY);
|
||||
s32 srcCoord[4] = { hCrop,
|
||||
vCrop + (s32)(srcY0*srcScaleY),
|
||||
Xwidth - hCrop,
|
||||
min((GLint)(srcY1*srcScaleY), (GLint)pBufferTexture->realHeight) - vCrop };
|
||||
min((s32)(srcY1*srcScaleY), (s32)pBufferTexture->realHeight) - vCrop };
|
||||
if (srcCoord[2] > pBufferTexture->realWidth || srcCoord[3] > pBufferTexture->realHeight) {
|
||||
removeBuffer(pBuffer->m_startAddress);
|
||||
return;
|
||||
}
|
||||
|
||||
const GLint hOffset = (wnd.getScreenWidth() - wnd.getWidth()) / 2;
|
||||
const GLint vOffset = (wnd.getScreenHeight() - wnd.getHeight()) / 2 + wnd.getHeightOffset();
|
||||
GLint dstCoord[4] = { X0 + hOffset,
|
||||
vOffset + (GLint)(dstY0*dstScaleY),
|
||||
const s32 hOffset = (wnd.getScreenWidth() - wnd.getWidth()) / 2;
|
||||
const s32 vOffset = (wnd.getScreenHeight() - wnd.getHeight()) / 2 + wnd.getHeightOffset();
|
||||
s32 dstCoord[4] = { X0 + hOffset,
|
||||
vOffset + (s32)(dstY0*dstScaleY),
|
||||
hOffset + X1,
|
||||
vOffset + (GLint)(dstY1*dstScaleY) };
|
||||
vOffset + (s32)(dstY1*dstScaleY) };
|
||||
#if 0 //def GLESX
|
||||
// TODO fix me
|
||||
if (render.getRenderer() == OGLRender::glrAdreno)
|
||||
|
@ -944,7 +944,7 @@ void FrameBufferList::renderBuffer(u32 _address)
|
|||
drawer.clearColorBuffer(clearColor);
|
||||
|
||||
|
||||
GLenum filter = GL_LINEAR;
|
||||
Parameter filter = textureParameters::FILTER_LINEAR;
|
||||
ObjectHandle readBuffer;
|
||||
|
||||
if (pFilteredBuffer->m_pTexture->frameBufferTexture == CachedTexture::fbMultiSample) {
|
||||
|
@ -957,7 +957,7 @@ void FrameBufferList::renderBuffer(u32 _address)
|
|||
} else {
|
||||
// glBindFramebuffer(GL_READ_FRAMEBUFFER, pFilteredBuffer->m_FBO);
|
||||
readBuffer = ObjectHandle(pFilteredBuffer->m_FBO);
|
||||
filter = GL_NEAREST;
|
||||
filter = textureParameters::FILTER_NEAREST;
|
||||
}
|
||||
} else {
|
||||
readBuffer = ObjectHandle(pFilteredBuffer->m_FBO);
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
|
||||
virtual ~ColorBufferReader() {}
|
||||
|
||||
virtual void init() = 0;
|
||||
// virtual void init() = 0;
|
||||
// virtual void initBuffers() = 0;
|
||||
// virtual void destroyBuffers() = 0;
|
||||
virtual u8 * readPixels(s32 _x0, s32 _y0, u32 _width, u32 _height, u32 _size, bool _sync) = 0;
|
||||
|
|
|
@ -187,6 +187,11 @@ PixelReadBuffer * Context::createPixelReadBuffer(size_t _sizeInBytes)
|
|||
return m_impl->createPixelReadBuffer(_sizeInBytes);
|
||||
}
|
||||
|
||||
ColorBufferReader * Context::createColorBufferReader(CachedTexture * _pTexture)
|
||||
{
|
||||
return m_impl->createColorBufferReader(_pTexture);
|
||||
}
|
||||
|
||||
/*---------------Shaders-------------*/
|
||||
|
||||
CombinerProgram * Context::createCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key)
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#define GRAPHICS_CONTEXT
|
||||
|
||||
struct CachedTexture;
|
||||
|
||||
namespace graphics {
|
||||
|
||||
enum class SpecialFeatures {
|
||||
|
@ -25,6 +27,7 @@ namespace graphics {
|
|||
};
|
||||
|
||||
class ContextImpl;
|
||||
class ColorBufferReader;
|
||||
|
||||
class Context
|
||||
{
|
||||
|
@ -190,6 +193,8 @@ namespace graphics {
|
|||
|
||||
PixelReadBuffer * createPixelReadBuffer(size_t _sizeInBytes);
|
||||
|
||||
ColorBufferReader * createColorBufferReader(CachedTexture * _pTexture);
|
||||
|
||||
/*---------------Shaders-------------*/
|
||||
|
||||
CombinerProgram * createCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key);
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace graphics {
|
|||
virtual bool blitFramebuffers(const Context::BlitFramebuffersParams & _params) = 0;
|
||||
virtual PixelWriteBuffer * createPixelWriteBuffer(size_t _sizeInBytes) = 0;
|
||||
virtual PixelReadBuffer * createPixelReadBuffer(size_t _sizeInBytes) = 0;
|
||||
virtual ColorBufferReader * createColorBufferReader(CachedTexture * _pTexture) = 0;
|
||||
virtual CombinerProgram * createCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key) = 0;
|
||||
virtual bool saveShadersStorage(const Combiners & _combiners) = 0;
|
||||
virtual bool loadShadersStorage(Combiners & _combiners) = 0;
|
||||
|
|
|
@ -19,9 +19,6 @@ ColorBufferReaderWithPixelBuffer::~ColorBufferReaderWithPixelBuffer()
|
|||
}
|
||||
|
||||
|
||||
void ColorBufferReaderWithPixelBuffer::init() {
|
||||
}
|
||||
|
||||
void ColorBufferReaderWithPixelBuffer::destroyBuffers()
|
||||
{
|
||||
glDeleteBuffers(_numPBO, m_PBO);
|
||||
|
|
|
@ -12,7 +12,6 @@ public:
|
|||
CachedBindBuffer * _bindBuffer);
|
||||
~ColorBufferReaderWithPixelBuffer();
|
||||
|
||||
void init() override;
|
||||
u8 * readPixels(s32 _x0, s32 _y0, u32 _width, u32 _height, u32 _size, bool _sync) override;
|
||||
void cleanUp() override;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "opengl_ContextImpl.h"
|
||||
#include "opengl_UnbufferedDrawer.h"
|
||||
#include "opengl_DummyTextDrawer.h"
|
||||
#include "opengl_ColorBufferReaderWithPixelBuffer.h"
|
||||
#include "opengl_Utils.h"
|
||||
#include "GLSL/glsl_CombinerProgramBuilder.h"
|
||||
#include "GLSL/glsl_SpecialShadersFactory.h"
|
||||
|
@ -263,6 +264,11 @@ graphics::PixelReadBuffer * ContextImpl::createPixelReadBuffer(size_t _sizeInByt
|
|||
return m_createPixelReadBuffer->createPixelReadBuffer(_sizeInBytes);
|
||||
}
|
||||
|
||||
graphics::ColorBufferReader * ContextImpl::createColorBufferReader(CachedTexture * _pTexture)
|
||||
{
|
||||
return new ColorBufferReaderWithPixelBuffer(_pTexture, m_cachedFunctions->getCachedBindBuffer());
|
||||
}
|
||||
|
||||
/*---------------Shaders-------------*/
|
||||
|
||||
graphics::CombinerProgram * ContextImpl::createCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key)
|
||||
|
|
|
@ -87,10 +87,14 @@ namespace opengl {
|
|||
|
||||
bool blitFramebuffers(const graphics::Context::BlitFramebuffersParams & _params) override;
|
||||
|
||||
/*---------------Pixelbuffer-------------*/
|
||||
|
||||
graphics::PixelWriteBuffer * createPixelWriteBuffer(size_t _sizeInBytes) override;
|
||||
|
||||
graphics::PixelReadBuffer * createPixelReadBuffer(size_t _sizeInBytes) override;
|
||||
|
||||
graphics::ColorBufferReader * createColorBufferReader(CachedTexture * _pTexture) override;
|
||||
|
||||
/*---------------Shaders-------------*/
|
||||
|
||||
graphics::CombinerProgram * createCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key) override;
|
||||
|
|
Loading…
Reference in New Issue
Block a user