mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
TextureCache::TCacheEntry::FromRenderTarget as vbo
Signed-off-by: Ryan Houdek <Sonicadvance1@gmail.com>
This commit is contained in:
@ -57,6 +57,7 @@ namespace OGL
|
|||||||
{
|
{
|
||||||
|
|
||||||
static u32 s_TempFramebuffer = 0;
|
static u32 s_TempFramebuffer = 0;
|
||||||
|
static GLuint s_VBO = 0;
|
||||||
|
|
||||||
static const GLint c_MinLinearFilter[8] = {
|
static const GLint c_MinLinearFilter[8] = {
|
||||||
GL_NEAREST,
|
GL_NEAREST,
|
||||||
@ -306,18 +307,19 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
|||||||
TargetRectangle targetSource = g_renderer->ConvertEFBRectangle(srcRect);
|
TargetRectangle targetSource = g_renderer->ConvertEFBRectangle(srcRect);
|
||||||
|
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
GLfloat tex1[] = {
|
GLfloat vertices[] = {
|
||||||
|
-1.f, 1.f,
|
||||||
(GLfloat)targetSource.left, (GLfloat)targetSource.bottom,
|
(GLfloat)targetSource.left, (GLfloat)targetSource.bottom,
|
||||||
|
-1.f, -1.f,
|
||||||
(GLfloat)targetSource.left, (GLfloat)targetSource.top,
|
(GLfloat)targetSource.left, (GLfloat)targetSource.top,
|
||||||
|
1.f, -1.f,
|
||||||
(GLfloat)targetSource.right, (GLfloat)targetSource.top,
|
(GLfloat)targetSource.right, (GLfloat)targetSource.top,
|
||||||
|
1.f, 1.f,
|
||||||
(GLfloat)targetSource.right, (GLfloat)targetSource.bottom
|
(GLfloat)targetSource.right, (GLfloat)targetSource.bottom
|
||||||
};
|
};
|
||||||
GLfloat vtx1[] = {
|
|
||||||
-1.f, 1.f,
|
glBindBuffer(GL_ARRAY_BUFFER, s_VBO);
|
||||||
-1.f, -1.f,
|
glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
||||||
1.f, -1.f,
|
|
||||||
1.f, 1.f
|
|
||||||
};
|
|
||||||
|
|
||||||
// disable all pointer, TODO: use VAO
|
// disable all pointer, TODO: use VAO
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
@ -335,10 +337,13 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
|||||||
}
|
}
|
||||||
|
|
||||||
glClientActiveTexture(GL_TEXTURE0);
|
glClientActiveTexture(GL_TEXTURE0);
|
||||||
glTexCoordPointer(2, GL_FLOAT, 0, tex1);
|
glTexCoordPointer(2, GL_FLOAT, sizeof(GLfloat)*4, (GLfloat*)NULL + 2);
|
||||||
glVertexPointer(2, GL_FLOAT, 0, vtx1);
|
glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*4, 0);
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
|
||||||
|
// TODO: this should be removed if we use vbo everywhere
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
// Unbind texture from temporary framebuffer
|
// Unbind texture from temporary framebuffer
|
||||||
@ -415,8 +420,16 @@ void TextureCache::TCacheEntry::SetTextureParameters(const TexMode0 &newmode, co
|
|||||||
(float)(1 << g_ActiveConfig.iMaxAnisotropy));
|
(float)(1 << g_ActiveConfig.iMaxAnisotropy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextureCache::TextureCache()
|
||||||
|
{
|
||||||
|
glGenBuffers(1, &s_VBO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TextureCache::~TextureCache()
|
TextureCache::~TextureCache()
|
||||||
{
|
{
|
||||||
|
glDeleteBuffers(1, &s_VBO);
|
||||||
|
|
||||||
if (s_TempFramebuffer)
|
if (s_TempFramebuffer)
|
||||||
{
|
{
|
||||||
glDeleteFramebuffersEXT(1, (GLuint*)&s_TempFramebuffer);
|
glDeleteFramebuffersEXT(1, (GLuint*)&s_TempFramebuffer);
|
||||||
|
@ -32,6 +32,7 @@ namespace OGL
|
|||||||
class TextureCache : public ::TextureCache
|
class TextureCache : public ::TextureCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
TextureCache();
|
||||||
static void DisableStage(unsigned int stage);
|
static void DisableStage(unsigned int stage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user