wined3d: Add a setting for the render target locking method.
This commit is contained in:
parent
f8ca32b3fb
commit
739d565c59
|
@ -727,7 +727,28 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED
|
||||||
* (char *)pLockedRect->pBits + (pLockedRect->Pitch * (j-This->lockedRect.top)));
|
* (char *)pLockedRect->pBits + (pLockedRect->Pitch * (j-This->lockedRect.top)));
|
||||||
*****************************************/
|
*****************************************/
|
||||||
if (!notInContext) { /* Only read the buffer if it's in the current context */
|
if (!notInContext) { /* Only read the buffer if it's in the current context */
|
||||||
|
switch(wined3d_settings.rendertargetlock_mode) {
|
||||||
|
case RTL_AUTO:
|
||||||
|
case RTL_READDRAW:
|
||||||
|
case RTL_READTEX:
|
||||||
read_from_framebuffer(This, &This->lockedRect, pLockedRect->pBits, pLockedRect->Pitch);
|
read_from_framebuffer(This, &This->lockedRect, pLockedRect->pBits, pLockedRect->Pitch);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RTL_TEXDRAW:
|
||||||
|
case RTL_TEXTEX:
|
||||||
|
ERR("Reading from render target with a texture isn't implemented yet\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RTL_DISABLE:
|
||||||
|
{
|
||||||
|
static BOOL warned = FALSE;
|
||||||
|
if(!warned) {
|
||||||
|
ERR("Application tries to lock the render target, but render target locking is disabled\n");
|
||||||
|
warned = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
TRACE("Resetting buffer\n");
|
TRACE("Resetting buffer\n");
|
||||||
|
|
||||||
|
@ -1071,7 +1092,28 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
switch(wined3d_settings.rendertargetlock_mode) {
|
||||||
|
case RTL_AUTO:
|
||||||
|
case RTL_READDRAW:
|
||||||
|
case RTL_TEXDRAW:
|
||||||
flush_to_framebuffer_drawpixels(This);
|
flush_to_framebuffer_drawpixels(This);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RTL_READTEX:
|
||||||
|
case RTL_TEXTEX:
|
||||||
|
ERR("Writing to the render target with textures is not implemented yet\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RTL_DISABLE:
|
||||||
|
{
|
||||||
|
static BOOL warned = FALSE;
|
||||||
|
if(!warned) {
|
||||||
|
ERR("The application tries to write to the render target, but render target locking is disabled\n");
|
||||||
|
warned = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(implSwapChain->backBuffer && implSwapChain->backBuffer[0]) {
|
if(implSwapChain->backBuffer && implSwapChain->backBuffer[0]) {
|
||||||
glDrawBuffer(GL_BACK);
|
glDrawBuffer(GL_BACK);
|
||||||
|
|
|
@ -37,7 +37,8 @@ wined3d_settings_t wined3d_settings =
|
||||||
VS_HW, /* Hardware by default */
|
VS_HW, /* Hardware by default */
|
||||||
PS_NONE, /* Disabled by default */
|
PS_NONE, /* Disabled by default */
|
||||||
VBO_HW, /* Hardware by default */
|
VBO_HW, /* Hardware by default */
|
||||||
FALSE /* Use of GLSL disabled by default */
|
FALSE, /* Use of GLSL disabled by default */
|
||||||
|
RTL_AUTO /* Automatically determine best locking method */
|
||||||
};
|
};
|
||||||
|
|
||||||
WineD3DGlobalStatistics *wineD3DGlobalStatistics = NULL;
|
WineD3DGlobalStatistics *wineD3DGlobalStatistics = NULL;
|
||||||
|
@ -196,6 +197,34 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
||||||
}
|
}
|
||||||
/* There will be a couple of other choices for nonpow2, they are: TextureRecrangle and OpenGL 2 */
|
/* There will be a couple of other choices for nonpow2, they are: TextureRecrangle and OpenGL 2 */
|
||||||
}
|
}
|
||||||
|
if ( !get_config_key( hkey, appkey, "RenderTargetLockMode", buffer, size) )
|
||||||
|
{
|
||||||
|
if (!strcmp(buffer,"disabled"))
|
||||||
|
{
|
||||||
|
TRACE("Disabling render target locking\n");
|
||||||
|
wined3d_settings.rendertargetlock_mode = RTL_DISABLE;
|
||||||
|
}
|
||||||
|
else if (!strcmp(buffer,"readdraw"))
|
||||||
|
{
|
||||||
|
TRACE("Using glReadPixels for render target reading and glDrawPixels for writing\n");
|
||||||
|
wined3d_settings.rendertargetlock_mode = RTL_READDRAW;
|
||||||
|
}
|
||||||
|
else if (!strcmp(buffer,"readtex"))
|
||||||
|
{
|
||||||
|
TRACE("Using glReadPixels for render target reading and textures for writing\n");
|
||||||
|
wined3d_settings.rendertargetlock_mode = RTL_READTEX;
|
||||||
|
}
|
||||||
|
else if (!strcmp(buffer,"texdraw"))
|
||||||
|
{
|
||||||
|
TRACE("Using textures for render target reading and glDrawPixels for writing\n");
|
||||||
|
wined3d_settings.rendertargetlock_mode = RTL_TEXDRAW;
|
||||||
|
}
|
||||||
|
else if (!strcmp(buffer,"textex"))
|
||||||
|
{
|
||||||
|
TRACE("Reading render targets via textures and writing via textures\n");
|
||||||
|
wined3d_settings.rendertargetlock_mode = RTL_TEXTEX;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (wined3d_settings.vs_mode == VS_HW)
|
if (wined3d_settings.vs_mode == VS_HW)
|
||||||
TRACE("Allow HW vertex shaders\n");
|
TRACE("Allow HW vertex shaders\n");
|
||||||
|
|
|
@ -138,6 +138,13 @@ static WINED3DGLTYPE const glTypeLookup[D3DDECLTYPE_UNUSED] = {
|
||||||
#define SHADER_GLSL 2
|
#define SHADER_GLSL 2
|
||||||
#define SHADER_NONE 3
|
#define SHADER_NONE 3
|
||||||
|
|
||||||
|
#define RTL_DISABLE -1
|
||||||
|
#define RTL_AUTO 0
|
||||||
|
#define RTL_READDRAW 1
|
||||||
|
#define RTL_READTEX 2
|
||||||
|
#define RTL_TEXDRAW 3
|
||||||
|
#define RTL_TEXTEX 4
|
||||||
|
|
||||||
typedef struct wined3d_settings_s {
|
typedef struct wined3d_settings_s {
|
||||||
/* vertex and pixel shader modes */
|
/* vertex and pixel shader modes */
|
||||||
int vs_mode;
|
int vs_mode;
|
||||||
|
@ -151,6 +158,7 @@ typedef struct wined3d_settings_s {
|
||||||
int ps_selected_mode;
|
int ps_selected_mode;
|
||||||
/* nonpower 2 function */
|
/* nonpower 2 function */
|
||||||
int nonpower2_mode;
|
int nonpower2_mode;
|
||||||
|
int rendertargetlock_mode;
|
||||||
} wined3d_settings_t;
|
} wined3d_settings_t;
|
||||||
|
|
||||||
extern wined3d_settings_t wined3d_settings;
|
extern wined3d_settings_t wined3d_settings;
|
||||||
|
|
Loading…
Reference in New Issue