Fix D3D8 build.
Change-Id: I879eb3c3d9093f769f88bd3a2dcc67f91bd6eb47
Reviewed-on: https://swiftshader-review.googlesource.com/15049
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/D3D8/Direct3DDevice8.cpp b/src/D3D8/Direct3DDevice8.cpp
index 5c85f83..1130d11 100644
--- a/src/D3D8/Direct3DDevice8.cpp
+++ b/src/D3D8/Direct3DDevice8.cpp
@@ -2149,7 +2149,7 @@
cursorBitmap->LockRect(&lock, 0, 0);
delete cursor;
- cursor = sw::Surface::create(0, desc.Width, desc.Height, 1, 0, sw::FORMAT_A8R8G8B8, false, false);
+ cursor = sw::Surface::create(0, desc.Width, desc.Height, 1, 0, 1, sw::FORMAT_A8R8G8B8, false, false);
void *buffer = cursor->lockExternal(0, 0, 0, sw::LOCK_DISCARD, sw::PUBLIC);
memcpy(buffer, lock.pBits, desc.Width * desc.Height * sizeof(unsigned int));
diff --git a/src/D3D8/Direct3DSurface8.cpp b/src/D3D8/Direct3DSurface8.cpp
index d744727..f9d1e96 100644
--- a/src/D3D8/Direct3DSurface8.cpp
+++ b/src/D3D8/Direct3DSurface8.cpp
@@ -59,11 +59,11 @@
}
Direct3DSurface8::Direct3DSurface8(Direct3DDevice8 *device, Unknown *container, int width, int height, D3DFORMAT format, D3DPOOL pool, D3DMULTISAMPLE_TYPE multiSample, bool lockable, unsigned long usage)
- : Surface(getParentResource(container), width, height, sampleCount(multiSample), 0, translateFormat(format), lockable, (usage & D3DUSAGE_RENDERTARGET) == D3DUSAGE_RENDERTARGET || (usage & D3DUSAGE_DEPTHSTENCIL) == D3DUSAGE_DEPTHSTENCIL), device(device), container(container), width(width), height(height), format(format), pool(pool), multiSample(multiSample), lockable(lockable), usage(usage)
+ : Surface(getParentResource(container), width, height, 1, 0, sampleCount(multiSample), translateFormat(format), lockable, (usage & D3DUSAGE_RENDERTARGET) == D3DUSAGE_RENDERTARGET || (usage & D3DUSAGE_DEPTHSTENCIL) == D3DUSAGE_DEPTHSTENCIL), device(device), container(container), width(width), height(height), format(format), pool(pool), multiSample(multiSample), lockable(lockable), usage(usage)
{
parentTexture = dynamic_cast<Direct3DBaseTexture8*>(container);
- resource = new Direct3DResource8(device, D3DRTYPE_SURFACE, memoryUsage(width, height, format));
+ resource = new Direct3DResource8(device, D3DRTYPE_SURFACE, memoryUsage(width, height, multiSample, format));
}
Direct3DSurface8::~Direct3DSurface8()
@@ -228,7 +228,7 @@
desc->Type = D3DRTYPE_SURFACE;
desc->Height = height;
desc->Width = width;
- desc->Size = size(getWidth(), getHeight(), getDepth(), 0, getExternalFormat());
+ desc->Size = memoryUsage(width, height, multiSample, format);
desc->MultiSampleType = multiSample;
desc->Usage = usage;
@@ -284,8 +284,8 @@
return Surface::bytes(translateFormat(format));
}
- unsigned int Direct3DSurface8::memoryUsage(int width, int height, D3DFORMAT format)
+ unsigned int Direct3DSurface8::memoryUsage(int width, int height, D3DMULTISAMPLE_TYPE multiSample, D3DFORMAT format)
{
- return Surface::size(width, height, 1, 0, translateFormat(format));
+ return Surface::size(width, height, 1, 0, sampleCount(multiSample), translateFormat(format));
}
}
diff --git a/src/D3D8/Direct3DSurface8.hpp b/src/D3D8/Direct3DSurface8.hpp
index e07829d..5ccecf3 100644
--- a/src/D3D8/Direct3DSurface8.hpp
+++ b/src/D3D8/Direct3DSurface8.hpp
@@ -57,7 +57,7 @@
static int bytes(D3DFORMAT format);
private:
- static unsigned int memoryUsage(int width, int height, D3DFORMAT format); // FIXME: Surface::size
+ static unsigned int memoryUsage(int width, int height, D3DMULTISAMPLE_TYPE multiSample, D3DFORMAT format); // FIXME: Surface::size
// Creation parameters
Direct3DDevice8 *const device;
diff --git a/src/D3D8/Direct3DVolume8.cpp b/src/D3D8/Direct3DVolume8.cpp
index e04cb48..9869068 100644
--- a/src/D3D8/Direct3DVolume8.cpp
+++ b/src/D3D8/Direct3DVolume8.cpp
@@ -24,7 +24,7 @@
namespace D3D8
{
Direct3DVolume8::Direct3DVolume8(Direct3DDevice8 *device, Direct3DVolumeTexture8 *container, int width, int height, int depth, D3DFORMAT format, D3DPOOL pool, bool lockable, unsigned long usage)
- : Surface(container->getResource(), width, height, depth, 0, translateFormat(format), lockable, false), container(container), width(width), height(height), depth(depth), format(format), pool(pool), lockable(lockable), usage(usage)
+ : Surface(container->getResource(), width, height, depth, 0, 1, translateFormat(format), lockable, false), container(container), width(width), height(height), depth(depth), format(format), pool(pool), lockable(lockable), usage(usage)
{
resource = new Direct3DResource8(device, D3DRTYPE_VOLUME, memoryUsage(width, height, depth, format));
}
@@ -195,6 +195,6 @@
unsigned int Direct3DVolume8::memoryUsage(int width, int height, int depth, D3DFORMAT format)
{
- return Surface::size(width, height, depth, 0, translateFormat(format));
+ return Surface::size(width, height, depth, 0, 1, translateFormat(format));
}
}