Module: wine
Branch: master
Commit: 94cd8656ea123420b31826231a6d8b8ae3347ad5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=94cd8656ea123420b31826231…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Thu Jun 25 10:24:56 2009 +0200
wined3d: Make context_resource_released() responsible for activating a different GL context.
In case lastActiveRenderTarget is destroyed.
---
dlls/wined3d/context.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 35 ++---------------------------------
2 files changed, 49 insertions(+), 33 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 81bddb1..5b3cecb 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -426,6 +426,53 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource
{
case WINED3DRTYPE_SURFACE:
{
+ if ((IWineD3DSurface *)resource == This->lastActiveRenderTarget)
+ {
+ IWineD3DSwapChainImpl *swapchain;
+
+ TRACE("Last active render target destroyed.\n");
+
+ /* Find a replacement surface for the currently active back
+ * buffer. The context manager does not do NULL checks, so
+ * switch to a valid target as long as the currently set
+ * surface is still valid. Use the surface of the implicit
+ * swpchain. If that is the same as the destroyed surface the
+ * device is destroyed and the lastActiveRenderTarget member
+ * shouldn't matter. */
+ swapchain = This->swapchains ? (IWineD3DSwapChainImpl *)This->swapchains[0] : NULL;
+ if (swapchain)
+ {
+ if (swapchain->backBuffer && swapchain->backBuffer[0] != (IWineD3DSurface *)resource)
+ {
+ TRACE("Activating primary back buffer.\n");
+ ActivateContext(This, swapchain->backBuffer[0], CTXUSAGE_RESOURCELOAD);
+ }
+ else if (!swapchain->backBuffer && swapchain->frontBuffer != (IWineD3DSurface *)resource)
+ {
+ /* Single buffering environment */
+ TRACE("Activating primary front buffer.\n");
+
+ ActivateContext(This, swapchain->frontBuffer, CTXUSAGE_RESOURCELOAD);
+ }
+ else
+ {
+ /* Implicit render target destroyed, that means the
+ * device is being destroyed whatever we set here, it
+ * shouldn't matter. */
+ TRACE("Device is being destroyed, setting lastActiveRenderTarget to 0xdeadbabe.\n");
+
+ This->lastActiveRenderTarget = (IWineD3DSurface *) 0xdeadbabe;
+ }
+ }
+ else
+ {
+ WARN("Render target set, but swapchain does not exist!\n");
+
+ /* May happen during ddraw uninitialization. */
+ This->lastActiveRenderTarget = (IWineD3DSurface *)0xdeadcafe;
+ }
+ }
+
for (i = 0; i < This->numContexts; ++i)
{
WineD3DContext *context = This->contexts[i];
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 48d49a8..3ad0625 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -7327,39 +7327,8 @@ void device_resource_released(IWineD3DDeviceImpl *This, IWineD3DResource *resour
case WINED3DRTYPE_SURFACE: {
unsigned int i;
- /* Cleanup any FBO attachments if d3d is enabled */
- if(This->d3d_initialized) {
- if((IWineD3DSurface *)resource == This->lastActiveRenderTarget) {
- IWineD3DSwapChainImpl *swapchain = This->swapchains ? (IWineD3DSwapChainImpl *) This->swapchains[0] : NULL;
-
- TRACE("Last active render target destroyed\n");
- /* Find a replacement surface for the currently active back buffer. The context manager does not do NULL
- * checks, so switch to a valid target as long as the currently set surface is still valid. Use the
- * surface of the implicit swpchain. If that is the same as the destroyed surface the device is destroyed
- * and the lastActiveRenderTarget member shouldn't matter
- */
- if(swapchain) {
- if(swapchain->backBuffer && swapchain->backBuffer[0] != (IWineD3DSurface *)resource) {
- TRACE("Activating primary back buffer\n");
- ActivateContext(This, swapchain->backBuffer[0], CTXUSAGE_RESOURCELOAD);
- } else if(!swapchain->backBuffer && swapchain->frontBuffer != (IWineD3DSurface *)resource) {
- /* Single buffering environment */
- TRACE("Activating primary front buffer\n");
- ActivateContext(This, swapchain->frontBuffer, CTXUSAGE_RESOURCELOAD);
- } else {
- TRACE("Device is being destroyed, setting lastActiveRenderTarget = 0xdeadbabe\n");
- /* Implicit render target destroyed, that means the device is being destroyed
- * whatever we set here, it shouldn't matter
- */
- This->lastActiveRenderTarget = (IWineD3DSurface *) 0xdeadbabe;
- }
- } else {
- /* May happen during ddraw uninitialization */
- TRACE("Render target set, but swapchain does not exist!\n");
- This->lastActiveRenderTarget = (IWineD3DSurface *) 0xdeadcafe;
- }
- }
-
+ if (This->d3d_initialized)
+ {
for (i = 0; i < GL_LIMITS(buffers); ++i) {
if (This->render_targets[i] == (IWineD3DSurface *)resource) {
This->render_targets[i] = NULL;
Module: wine
Branch: master
Commit: 964f4b0157d0d0a5530c214b859c56728d9f588c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=964f4b0157d0d0a5530c214b8…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Thu Jun 25 10:24:55 2009 +0200
wined3d: Make sure we have an active GL context in buffer_PreLoad().
---
dlls/wined3d/buffer.c | 7 +++----
dlls/wined3d/drawprim.c | 10 +++++-----
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 8896db9..4b71311 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -37,13 +37,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
static void buffer_create_buffer_object(struct wined3d_buffer *This)
{
GLenum error, gl_usage;
- IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
TRACE("Creating an OpenGL vertex buffer object for IWineD3DVertexBuffer %p Usage(%s)\n",
This, debug_d3dusage(This->resource.usage));
- /* Make sure that a context is there. Needed in a multithreaded environment. Otherwise this call is a nop */
- ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
/* Make sure that the gl error is cleared. Do not use checkGLcall
@@ -689,6 +686,8 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
TRACE("iface %p\n", iface);
+ ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+
if (!This->buffer_object)
{
/* TODO: Make converting independent from VBOs */
@@ -724,7 +723,7 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
if (This->conversion_count > VB_MAXDECLCHANGES)
{
FIXME("Too many declaration changes, stopping converting\n");
- ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+
ENTER_GL();
GL_EXTCALL(glDeleteBuffersARB(1, &This->buffer_object));
checkGLcall("glDeleteBuffersARB");
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index dcdf21a..c0fb678 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -756,6 +756,11 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
GLenum feedback_type;
GLfloat *feedbuffer;
+ /* Simply activate the context for blitting. This disables all the things we don't want and
+ * takes care of dirtifying. Dirtifying is preferred over pushing / popping, since drawing the
+ * patch (as opposed to normal draws) will most likely need different changes anyway. */
+ ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_BLIT);
+
/* First, locate the position data. This is provided in a vertex buffer in the stateblock.
* Beware of vbos
*/
@@ -806,11 +811,6 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
patch->has_normals = TRUE;
patch->has_texcoords = FALSE;
- /* Simply activate the context for blitting. This disables all the things we don't want and
- * takes care of dirtifying. Dirtifying is preferred over pushing / popping, since drawing the
- * patch (as opposed to normal draws) will most likely need different changes anyway
- */
- ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_BLIT);
ENTER_GL();
glMatrixMode(GL_PROJECTION);
Module: wine
Branch: master
Commit: d962939290f407d925c12b2fb3f4d3cdd0d015da
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d962939290f407d925c12b2fb…
Author: Aric Stewart <aric(a)codeweavers.com>
Date: Thu Jun 25 16:59:46 2009 +0900
wintrust: GetSignedMsgFromCabFile looks for signinfo at the beginning of the cab.
Discussed with Juan Lang, We could look for the signinfo at the
beginning of the cab and restore the file pointer afterward.
This allows IE7 to read the signing information from downloaded ActiveX
controls.
---
dlls/wintrust/crypt.c | 35 ++++-------------------------------
1 files changed, 4 insertions(+), 31 deletions(-)
diff --git a/dlls/wintrust/crypt.c b/dlls/wintrust/crypt.c
index e01a230..d9fa563 100644
--- a/dlls/wintrust/crypt.c
+++ b/dlls/wintrust/crypt.c
@@ -1121,36 +1121,6 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
TRACE("(%p %p %d %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
pcbSignedDataMsg, pbSignedDataMsg);
- /*
- * FIXME: I just noticed that I am memorizing the initial file pointer
- * offset and restoring it before reading in the rest of the header
- * information in the cabinet. Perhaps that's correct -- that is, perhaps
- * this API is supposed to support "streaming" cabinets which are embedded
- * in other files, or cabinets which begin at file offsets other than zero.
- * Otherwise, I should instead go to the absolute beginning of the file.
- * (Either way, the semantics of wine's FDICopy require me to leave the
- * file pointer where it is afterwards -- If Windows does not do so, we
- * ought to duplicate the native behavior in the FDIIsCabinet API, not here.
- *
- * So, the answer lies in Windows; will native cabinet.dll recognize a
- * cabinet "file" embedded in another file? Note that cabextract.c does
- * support this, which implies that Microsoft's might. I haven't tried it
- * yet so I don't know. ATM, most of wine's FDI cabinet routines (except
- * this one) would not work in this way. To fix it, we could just make the
- * various references to absolute file positions in the code relative to an
- * initial "beginning" offset. Because the FDICopy API doesn't take a
- * file-handle like this one, we would therein need to search through the
- * file for the beginning of the cabinet (as we also do in cabextract.c).
- * Note that this limits us to a maximum of one cabinet per. file: the first.
- *
- * So, in summary: either the code below is wrong, or the rest of fdi.c is
- * wrong... I cannot imagine that both are correct ;) One of these flaws
- * should be fixed after determining the behavior on Windows. We ought
- * to check both FDIIsCabinet and FDICopy for the right behavior.
- *
- * -gmt
- */
-
/* get basic offset & size info */
base_offset = SetFilePointer(pSubjectInfo->hFile, 0L, NULL, SEEK_CUR);
@@ -1162,7 +1132,7 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
cabsize = SetFilePointer(pSubjectInfo->hFile, 0L, NULL, SEEK_CUR);
if ((cabsize == -1) || (base_offset == -1) ||
- (SetFilePointer(pSubjectInfo->hFile, base_offset, NULL, SEEK_SET) == INVALID_SET_FILE_POINTER))
+ (SetFilePointer(pSubjectInfo->hFile, 0, NULL, SEEK_SET) == INVALID_SET_FILE_POINTER))
{
TRACE("seek error\n");
return FALSE;
@@ -1267,6 +1237,7 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
NULL) || dwRead != cert_size)
{
ERR("couldn't read cert\n");
+ SetFilePointer(pSubjectInfo->hFile, base_offset, NULL, SEEK_SET);
return FALSE;
}
/* The encoding of the files I've seen appears to be in ASN.1
@@ -1274,6 +1245,8 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
* always is.
*/
*pdwEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING;
+ /* Restore base offset */
+ SetFilePointer(pSubjectInfo->hFile, base_offset, NULL, SEEK_SET);
return TRUE;
}