Update to v1200.

This commit is contained in:
Michael Fabian Dirks
2016-07-20 02:01:40 +02:00
parent 76679f0a12
commit aa3cf453e5
20 changed files with 514 additions and 474 deletions
+14 -11
View File
@@ -58,24 +58,27 @@ void PixelFormat::setFormat(const DDPIXELFORMAT &pf) {
asm_coder.CodePoint(point_code, depth, amask, rmask, gmask, bmask);
}
static void adjustTexSize(int *width, int *height, IDirect3DDevice7 *dir3dDev) {
static void adjustTexSize(int *width, int *height, IDirect3DDevice7 *dir3dDev, bool forcePOT = true) {
D3DDEVICEDESC7 ddDesc = { 0 };
if (dir3dDev->GetCaps(&ddDesc) < 0) {
*width = *height = 256;
return;
}
int w = *width, h = *height, min, max;
//make power of 2
//Try *always* making POW2 size to fix GF6800 non-pow2 tex issue
// if( ddDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2 ){
for (w = 1; w < *width; w <<= 1) {}
for (h = 1; h < *height; h <<= 1) {}
// }
//make square
if (ddDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY) {
if( ddDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2 || ddDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL || forcePOT){
// DirectX Device doesn't support Non Power-Of-Two Textures.
for (w = 1; w < *width; w <<= 1) {}
for (h = 1; h < *height; h <<= 1) {}
} else if (ddDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY) {
// DirectX Device only supports Square Textures;
if (w > h) h = w;
else w = h;
}
//check aspect ratio
if (max = ddDesc.dwMaxTextureAspectRatio) {
int asp = w > h ? w / h : h / w;
@@ -300,7 +303,7 @@ ddSurf *ddUtil::createSurface(int w, int h, int flags, gxGraphics *gfx) {
desc.ddsCaps.dwCaps |= DDSCAPS_COMPLEX;
desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALLFACES;
}
adjustTexSize((int*)&desc.dwWidth, (int*)&desc.dwHeight, gfx->dir3dDev);
adjustTexSize((int*)&desc.dwWidth, (int*)&desc.dwHeight, gfx->dir3dDev, !(flags & (gxCanvas::CANVAS_TEX_NPOT)));
} else {
desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
if (flags & gxCanvas::CANVAS_HIGHCOLOR) {
@@ -514,7 +517,7 @@ ddSurf *ddUtil::loadSurface(const std::string &f, int flags, gxGraphics *gfx) {
}
int t_w = width, t_h = height;
if (flags & gxCanvas::CANVAS_TEXTURE) adjustTexSize(&t_w, &t_h, gfx->dir3dDev);
if (flags & gxCanvas::CANVAS_TEXTURE) adjustTexSize(&t_w, &t_h, gfx->dir3dDev, !(flags & (gxCanvas::CANVAS_TEX_NPOT)));
copy(dest, 0, 0, t_w, t_h, src, 0, height - 1, width, -height);
src->Release();
+457 -456
View File
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -67,13 +67,14 @@ public:
CANVAS_TEX_CUBE = 0x0080,
CANVAS_TEX_VIDMEM = 0x0100,
CANVAS_TEX_HICOLOR = 0x0200,
CANVAS_TEX_NPOT = 0x0400, // 1024
CANVAS_TEXTURE = 0x10000,
CANVAS_NONDISPLAY = 0x20000,
CANVAS_HIGHCOLOR = 0x40000,
CANVAS_3DRENDER = 0x1000,
CANVAS_3DZRENDER = 0x2000,
CANVAS_3DRENDER = 0x1000, // 4096
CANVAS_3DZRENDER = 0x2000, // 8192
};
enum {
+2
View File
@@ -69,6 +69,7 @@
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<CallingConvention>StdCall</CallingConvention>
<ExceptionHandling>Async</ExceptionHandling>
<RemoveUnreferencedCodeData>false</RemoveUnreferencedCodeData>
</ClCompile>
<ResourceCompile>
<Culture>0x0409</Culture>
@@ -96,6 +97,7 @@
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<CallingConvention>StdCall</CallingConvention>
<ExceptionHandling>Async</ExceptionHandling>
<RemoveUnreferencedCodeData>false</RemoveUnreferencedCodeData>
</ClCompile>
<ResourceCompile>
<Culture>0x0409</Culture>