Commit 4e2f4e29 by Nicolas Capens Committed by Nicolas Capens

Fix D3D8 build.

Change-Id: I879eb3c3d9093f769f88bd3a2dcc67f91bd6eb47 Reviewed-on: https://swiftshader-review.googlesource.com/15049Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 99764be9
...@@ -2149,7 +2149,7 @@ namespace D3D8 ...@@ -2149,7 +2149,7 @@ namespace D3D8
cursorBitmap->LockRect(&lock, 0, 0); cursorBitmap->LockRect(&lock, 0, 0);
delete cursor; 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); void *buffer = cursor->lockExternal(0, 0, 0, sw::LOCK_DISCARD, sw::PUBLIC);
memcpy(buffer, lock.pBits, desc.Width * desc.Height * sizeof(unsigned int)); memcpy(buffer, lock.pBits, desc.Width * desc.Height * sizeof(unsigned int));
......
...@@ -59,11 +59,11 @@ namespace D3D8 ...@@ -59,11 +59,11 @@ namespace D3D8
} }
Direct3DSurface8::Direct3DSurface8(Direct3DDevice8 *device, Unknown *container, int width, int height, D3DFORMAT format, D3DPOOL pool, D3DMULTISAMPLE_TYPE multiSample, bool lockable, unsigned long usage) 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); 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() Direct3DSurface8::~Direct3DSurface8()
...@@ -228,7 +228,7 @@ namespace D3D8 ...@@ -228,7 +228,7 @@ namespace D3D8
desc->Type = D3DRTYPE_SURFACE; desc->Type = D3DRTYPE_SURFACE;
desc->Height = height; desc->Height = height;
desc->Width = width; desc->Width = width;
desc->Size = size(getWidth(), getHeight(), getDepth(), 0, getExternalFormat()); desc->Size = memoryUsage(width, height, multiSample, format);
desc->MultiSampleType = multiSample; desc->MultiSampleType = multiSample;
desc->Usage = usage; desc->Usage = usage;
...@@ -284,8 +284,8 @@ namespace D3D8 ...@@ -284,8 +284,8 @@ namespace D3D8
return Surface::bytes(translateFormat(format)); 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));
} }
} }
...@@ -57,7 +57,7 @@ namespace D3D8 ...@@ -57,7 +57,7 @@ namespace D3D8
static int bytes(D3DFORMAT format); static int bytes(D3DFORMAT format);
private: 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 // Creation parameters
Direct3DDevice8 *const device; Direct3DDevice8 *const device;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
namespace D3D8 namespace D3D8
{ {
Direct3DVolume8::Direct3DVolume8(Direct3DDevice8 *device, Direct3DVolumeTexture8 *container, int width, int height, int depth, D3DFORMAT format, D3DPOOL pool, bool lockable, unsigned long usage) 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)); resource = new Direct3DResource8(device, D3DRTYPE_VOLUME, memoryUsage(width, height, depth, format));
} }
...@@ -195,6 +195,6 @@ namespace D3D8 ...@@ -195,6 +195,6 @@ namespace D3D8
unsigned int Direct3DVolume8::memoryUsage(int width, int height, int depth, D3DFORMAT format) 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));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment