DXGL r659 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r658‎ | r659 | r660 >
Date:01:34, 29 May 2016
Author:admin
Status:new
Tags:
Comment:
Fix Blt source when destination needs uploading.
Fix OpenGL errors on certain raster operations that do not use source.
Modified paths:
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)
  • /ddraw/glDirectDrawSurface.h (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)
  • /ddraw/glUtil.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDrawSurface.cpp
@@ -871,7 +871,7 @@
872872 for(i = 0; i < ddsd.dwBackBufferCount; i++)
873873 {
874874 tmp = tmp->GetBackbuffer();
875 - textures[i+1] = tmp->GetTexture();
 875+ textures[i+1] = tmp->texture;
876876 }
877877 glTexture *tmptex = textures[0];
878878 memmove(textures,&textures[1],ddsd.dwBackBufferCount*sizeof(GLuint));
Index: ddraw/glDirectDrawSurface.h
@@ -111,9 +111,6 @@
112112 ULONG WINAPI AddRefColor();
113113 ULONG WINAPI ReleaseColor();
114114 //void SetFilter(int level, GLint mag, GLint min, glExtensions *ext, glUtil *util);
115 - glTexture *GetTexture(){
116 - return texture;
117 - }
118115 void Restore2();
119116 HRESULT Flip2(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags);
120117 HRESULT AddAttachedSurface2(LPDIRECTDRAWSURFACE7 lpDDSAttachedSurface, IUnknown *iface);
Index: ddraw/glRenderer.cpp
@@ -1407,6 +1407,7 @@
14081408 srcrect.bottom = ddsdSrc.dwHeight;
14091409 }
14101410 else srcrect = *lpSrcRect;
 1411+ if (dest->texture->levels[dest->miplevel].dirty & 1) glTexture__Upload(dest->texture, dest->miplevel);
14111412 This->bltvertices[1].x = This->bltvertices[3].x = (GLfloat)destrect.left * ((GLfloat)dest->fakex/(GLfloat)ddsd.dwWidth);
14121413 This->bltvertices[0].x = This->bltvertices[2].x = (GLfloat)destrect.right * ((GLfloat)dest->fakex/(GLfloat)ddsd.dwWidth);
14131414 This->bltvertices[0].y = This->bltvertices[1].y = (GLfloat)dest->fakey-((GLfloat)destrect.top * ((GLfloat)dest->fakey/(GLfloat)ddsd.dwHeight));
@@ -1478,7 +1479,7 @@
14791480 }
14801481 if(src)
14811482 {
1482 - glUtil_SetTexture(This->util,0,src->GetTexture());
 1483+ glUtil_SetTexture(This->util,0,src->texture);
14831484 if(This->ext->GLEXT_ARB_sampler_objects)
14841485 {
14851486 if((dxglcfg.scalingfilter == 0) || (This->ddInterface->GetBPP() == 8))
@@ -1492,11 +1493,10 @@
14931494 src->texture->colorsizes[2], src->texture->colorsizes[3]);
14941495 if(dest) This->ext->glUniform4i(shader->shader.uniforms[11], dest->texture->colorsizes[0], dest->texture->colorsizes[1],
14951496 dest->texture->colorsizes[2], dest->texture->colorsizes[3]);
1496 - if (dest->texture->levels[dest->miplevel].dirty & 1) glTexture__Upload(dest->texture, dest->miplevel);
14971497 dest->texture->levels[dest->miplevel].dirty |= 2;
14981498 glUtil_EnableArray(This->util, shader->shader.attribs[0], TRUE);
14991499 This->ext->glVertexAttribPointer(shader->shader.attribs[0],2,GL_FLOAT,GL_FALSE,sizeof(BltVertex),&This->bltvertices[0].x);
1500 - if(!(dwFlags & DDBLT_COLORFILL))
 1500+ if((!(dwFlags & DDBLT_COLORFILL)) && (shader->shader.attribs[3] != -1))
15011501 {
15021502 glUtil_EnableArray(This->util, shader->shader.attribs[3], TRUE);
15031503 This->ext->glVertexAttribPointer(shader->shader.attribs[3],2,GL_FLOAT,GL_FALSE,sizeof(BltVertex),&This->bltvertices[0].s);
Index: ddraw/glUtil.cpp
@@ -637,6 +637,7 @@
638638 {
639639 glUtil_SetActiveTexture(This, level);
640640 glBindTexture(GL_TEXTURE_2D, texname);
 641+ This->textures[level] = texname;
641642 }
642643 }
643644