Support partial texture updates via efb copies

This commit is contained in:
mimimi085181
2015-06-13 15:51:58 +02:00
parent 3948dc77c7
commit 0ed6b5623f
12 changed files with 107 additions and 1 deletions

View File

@ -0,0 +1,10 @@
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "VideoBackends/OGL/GLExtensions/gl_common.h"
typedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
extern PFNGLCOPYIMAGESUBDATAPROC glCopyImageSubData;

View File

@ -788,6 +788,9 @@ PFNGLGETOCCLUSIONQUERYUIVNVPROC glGetOcclusionQueryuivNV;
// ARB_clip_control
PFNGLCLIPCONTROLPROC glClipControl;
// ARB_copy_image
PFNGLCOPYIMAGESUBDATAPROC glCopyImageSubData;
// Creates a GLFunc object that requires a feature
#define GLFUNC_REQUIRES(x, y) { (void**)&x, #x, y }
// Creates a GLFunc object with a different function suffix
@ -1278,6 +1281,18 @@ const GLFunc gl_function_array[] =
// ARB_clip_control
GLFUNC_REQUIRES(glClipControl, "GL_ARB_clip_control"),
// ARB_copy_image
GLFUNC_REQUIRES(glCopyImageSubData, "GL_ARB_copy_image"),
// NV_copy_image
GLFUNC_SUFFIX(glCopyImageSubData, NV, "GL_NV_copy_image !GL_ARB_copy_image"),
// OES_copy_image
GLFUNC_SUFFIX(glCopyImageSubData, OES, "GL_OES_copy_image"),
// EXT_copy_image
GLFUNC_SUFFIX(glCopyImageSubData, EXT, "GL_EXT_copy_image !GL_OES_copy_image"),
// gl_1_1
// OpenGL 1.1 is at the end due to a bug in Android's EGL stack.
// eglGetProcAddress can only return a finite amount of function pointers

View File

@ -9,6 +9,7 @@
#include "VideoBackends/OGL/GLExtensions/ARB_blend_func_extended.h"
#include "VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h"
#include "VideoBackends/OGL/GLExtensions/ARB_clip_control.h"
#include "VideoBackends/OGL/GLExtensions/ARB_copy_image.h"
#include "VideoBackends/OGL/GLExtensions/ARB_debug_output.h"
#include "VideoBackends/OGL/GLExtensions/ARB_draw_elements_base_vertex.h"
#include "VideoBackends/OGL/GLExtensions/ARB_ES2_compatibility.h"

View File

@ -469,6 +469,10 @@ Renderer::Renderer()
g_Config.backend_info.bSupportsGeometryShaders = GLExtensions::Version() >= 320;
g_Config.backend_info.bSupportsPaletteConversion = GLExtensions::Supports("GL_ARB_texture_buffer_object");
g_Config.backend_info.bSupportsClipControl = GLExtensions::Supports("GL_ARB_clip_control");
g_Config.backend_info.bSupportsCopySubImage = GLExtensions::Supports("GL_ARB_copy_image") ||
GLExtensions::Supports("GL_NV_copy_image") ||
GLExtensions::Supports("GL_EXT_copy_image") ||
GLExtensions::Supports("GL_OES_copy_image");
// Desktop OpenGL supports the binding layout if it supports 420pack
// OpenGL ES 3.1 supports it implicitly without an extension
@ -598,7 +602,8 @@ Renderer::Renderer()
g_ogl_config.bSupportsMSAA ? "" : "MSAA ",
g_ogl_config.bSupportSampleShading ? "" : "SSAA ",
g_ActiveConfig.backend_info.bSupportsGSInstancing ? "" : "GSInstancing ",
g_ActiveConfig.backend_info.bSupportsClipControl ? "" : "ClipControl "
g_ActiveConfig.backend_info.bSupportsClipControl ? "" : "ClipControl ",
g_ActiveConfig.backend_info.bSupportsCopySubImage ? "" : "CopyImageSubData "
);
s_last_multisample_mode = g_ActiveConfig.iMultisampleMode;

View File

@ -137,6 +137,14 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntryConf
return entry;
}
void TextureCache::TCacheEntry::DoPartialTextureUpdate(TCacheEntryBase* entry_, u32 x, u32 y)
{
TCacheEntry* entry = (TCacheEntry*)entry_;
glCopyImageSubData(entry->texture, GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, texture, GL_TEXTURE_2D_ARRAY, 0, x, y, 0, entry->native_width, entry->native_height, 1);
}
void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int level)
{

View File

@ -33,6 +33,8 @@ private:
TCacheEntry(const TCacheEntryConfig& config);
~TCacheEntry();
void DoPartialTextureUpdate(TCacheEntryBase* entry, u32 x, u32 y) override;
void Load(unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int level) override;