|
@@ -13,18 +13,18 @@
|
|
|
|
|
|
|
|
namespace BansheeEngine
|
|
namespace BansheeEngine
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
- D3D9Texture::D3D9Texture()
|
|
|
|
|
- :Texture(), mD3DPool(D3DPOOL_MANAGED), mDynamicTextures(false),
|
|
|
|
|
- mHwGammaReadSupported(false), mHwGammaWriteSupported(false), mMultisampleType(D3DMULTISAMPLE_NONE),
|
|
|
|
|
- mMultisampleQuality(0), mIsBindableAsShaderResource(true)
|
|
|
|
|
|
|
+ D3D9TextureCore::D3D9TextureCore(TextureType textureType, UINT32 width, UINT32 height, UINT32 depth, UINT32 numMipmaps,
|
|
|
|
|
+ PixelFormat format, int usage, bool hwGamma, UINT32 multisampleCount)
|
|
|
|
|
+ :TextureCore(textureType, width, height, depth, numMipmaps, format, usage, hwGamma, multisampleCount),
|
|
|
|
|
+ mD3DPool(D3DPOOL_MANAGED), mDynamicTextures(false), mHwGammaReadSupported(false), mHwGammaWriteSupported(false),
|
|
|
|
|
+ mMultisampleType(D3DMULTISAMPLE_NONE), mMultisampleQuality(0), mIsBindableAsShaderResource(true)
|
|
|
{ }
|
|
{ }
|
|
|
|
|
|
|
|
- D3D9Texture::~D3D9Texture()
|
|
|
|
|
|
|
+ D3D9TextureCore::~D3D9TextureCore()
|
|
|
{
|
|
{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::initialize_internal()
|
|
|
|
|
|
|
+ void D3D9TextureCore::initialize()
|
|
|
{
|
|
{
|
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
|
|
|
|
|
@@ -36,10 +36,10 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
BS_INC_RENDER_STAT_CAT(ResCreated, RenderStatObject_Texture);
|
|
BS_INC_RENDER_STAT_CAT(ResCreated, RenderStatObject_Texture);
|
|
|
- Texture::initialize_internal();
|
|
|
|
|
|
|
+ TextureCore::initialize();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::destroy_internal()
|
|
|
|
|
|
|
+ void D3D9TextureCore::destroy()
|
|
|
{
|
|
{
|
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
|
|
|
|
|
@@ -62,25 +62,25 @@ namespace BansheeEngine
|
|
|
mSurfaceList.clear();
|
|
mSurfaceList.clear();
|
|
|
|
|
|
|
|
BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_Texture);
|
|
BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_Texture);
|
|
|
- Texture::destroy_internal();
|
|
|
|
|
|
|
+ TextureCore::destroy();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- PixelData D3D9Texture::lockImpl(GpuLockOptions options, UINT32 mipLevel, UINT32 face)
|
|
|
|
|
|
|
+ PixelData D3D9TextureCore::lockImpl(GpuLockOptions options, UINT32 mipLevel, UINT32 face)
|
|
|
{
|
|
{
|
|
|
- if (mMultisampleCount > 0)
|
|
|
|
|
|
|
+ if (mProperties.getMultisampleCount() > 0)
|
|
|
BS_EXCEPT(InvalidStateException, "Multisampled textures cannot be accessed from the CPU directly.");
|
|
BS_EXCEPT(InvalidStateException, "Multisampled textures cannot be accessed from the CPU directly.");
|
|
|
|
|
|
|
|
if(mLockedBuffer != nullptr)
|
|
if(mLockedBuffer != nullptr)
|
|
|
BS_EXCEPT(InternalErrorException, "Trying to lock a buffer that's already locked.");
|
|
BS_EXCEPT(InternalErrorException, "Trying to lock a buffer that's already locked.");
|
|
|
|
|
|
|
|
- if(getUsage() == TU_DEPTHSTENCIL)
|
|
|
|
|
|
|
+ if (mProperties.getUsage() == TU_DEPTHSTENCIL)
|
|
|
BS_EXCEPT(InternalErrorException, "Cannot lock a depth stencil texture.");
|
|
BS_EXCEPT(InternalErrorException, "Cannot lock a depth stencil texture.");
|
|
|
|
|
|
|
|
- UINT32 mipWidth = mWidth >> mipLevel;
|
|
|
|
|
- UINT32 mipHeight = mHeight >> mipLevel;
|
|
|
|
|
- UINT32 mipDepth = mDepth >> mipLevel;
|
|
|
|
|
|
|
+ UINT32 mipWidth = mProperties.getWidth() >> mipLevel;
|
|
|
|
|
+ UINT32 mipHeight = mProperties.getHeight() >> mipLevel;
|
|
|
|
|
+ UINT32 mipDepth = mProperties.getDepth() >> mipLevel;
|
|
|
|
|
|
|
|
- PixelData lockedArea(mipWidth, mipHeight, mipDepth, mFormat);
|
|
|
|
|
|
|
+ PixelData lockedArea(mipWidth, mipHeight, mipDepth, mProperties.getFormat());
|
|
|
|
|
|
|
|
mLockedBuffer = getBuffer(face, mipLevel);
|
|
mLockedBuffer = getBuffer(face, mipLevel);
|
|
|
lockedArea.setExternalBuffer((UINT8*)mLockedBuffer->lock(options));
|
|
lockedArea.setExternalBuffer((UINT8*)mLockedBuffer->lock(options));
|
|
@@ -88,7 +88,7 @@ namespace BansheeEngine
|
|
|
return lockedArea;
|
|
return lockedArea;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::unlockImpl()
|
|
|
|
|
|
|
+ void D3D9TextureCore::unlockImpl()
|
|
|
{
|
|
{
|
|
|
if(mLockedBuffer == nullptr)
|
|
if(mLockedBuffer == nullptr)
|
|
|
BS_EXCEPT(InternalErrorException, "Trying to unlock a buffer that's not locked.");
|
|
BS_EXCEPT(InternalErrorException, "Trying to unlock a buffer that's not locked.");
|
|
@@ -97,19 +97,19 @@ namespace BansheeEngine
|
|
|
mLockedBuffer = nullptr;
|
|
mLockedBuffer = nullptr;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::readData(PixelData& dest, UINT32 mipLevel, UINT32 face)
|
|
|
|
|
|
|
+ void D3D9TextureCore::readData(PixelData& dest, UINT32 mipLevel, UINT32 face)
|
|
|
{
|
|
{
|
|
|
- if (mMultisampleCount > 0)
|
|
|
|
|
|
|
+ if (mProperties.getMultisampleCount() > 0)
|
|
|
BS_EXCEPT(InvalidStateException, "Multisampled textures cannot be accessed from the CPU directly.");
|
|
BS_EXCEPT(InvalidStateException, "Multisampled textures cannot be accessed from the CPU directly.");
|
|
|
|
|
|
|
|
- if (mUsage == TU_DEPTHSTENCIL || mUsage == TU_RENDERTARGET) // Render targets cannot be locked normally
|
|
|
|
|
|
|
+ if (mProperties.getUsage() == TU_DEPTHSTENCIL || mProperties.getUsage() == TU_RENDERTARGET) // Render targets cannot be locked normally
|
|
|
{
|
|
{
|
|
|
IDirect3DDevice9* device = D3D9RenderSystem::getActiveD3D9Device();
|
|
IDirect3DDevice9* device = D3D9RenderSystem::getActiveD3D9Device();
|
|
|
|
|
|
|
|
D3D9PixelBuffer* sourceBuffer = static_cast<D3D9PixelBuffer*>(getBuffer(face, mipLevel).get());
|
|
D3D9PixelBuffer* sourceBuffer = static_cast<D3D9PixelBuffer*>(getBuffer(face, mipLevel).get());
|
|
|
|
|
|
|
|
- UINT32 mipWidth = mWidth >> mipLevel;
|
|
|
|
|
- UINT32 mipHeight = mHeight >> mipLevel;
|
|
|
|
|
|
|
+ UINT32 mipWidth = mProperties.getWidth() >> mipLevel;
|
|
|
|
|
+ UINT32 mipHeight = mProperties.getHeight() >> mipLevel;
|
|
|
D3DFORMAT format = chooseD3DFormat(device);
|
|
D3DFORMAT format = chooseD3DFormat(device);
|
|
|
|
|
|
|
|
// Note: I'm allocating and releasing a texture every time we read.
|
|
// Note: I'm allocating and releasing a texture every time we read.
|
|
@@ -141,7 +141,7 @@ namespace BansheeEngine
|
|
|
BS_EXCEPT(RenderingAPIException, "Failed to retrieve render target data: " + msg);
|
|
BS_EXCEPT(RenderingAPIException, "Failed to retrieve render target data: " + msg);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- PixelData myData(mipWidth, mipHeight, 1, mFormat);
|
|
|
|
|
|
|
+ PixelData myData(mipWidth, mipHeight, 1, mProperties.getFormat());
|
|
|
|
|
|
|
|
D3DLOCKED_RECT lrect;
|
|
D3DLOCKED_RECT lrect;
|
|
|
hr = stagingSurface->LockRect(&lrect, nullptr, D3DLOCK_READONLY);
|
|
hr = stagingSurface->LockRect(&lrect, nullptr, D3DLOCK_READONLY);
|
|
@@ -188,12 +188,12 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::writeData(const PixelData& src, UINT32 mipLevel, UINT32 face, bool discardWholeBuffer)
|
|
|
|
|
|
|
+ void D3D9TextureCore::writeData(const PixelData& src, UINT32 mipLevel, UINT32 face, bool discardWholeBuffer)
|
|
|
{
|
|
{
|
|
|
- if (mMultisampleCount > 0)
|
|
|
|
|
|
|
+ if (mProperties.getMultisampleCount() > 0)
|
|
|
BS_EXCEPT(InvalidStateException, "Multisampled textures cannot be accessed from the CPU directly.");
|
|
BS_EXCEPT(InvalidStateException, "Multisampled textures cannot be accessed from the CPU directly.");
|
|
|
|
|
|
|
|
- if(mUsage == TU_DYNAMIC || mUsage == TU_STATIC)
|
|
|
|
|
|
|
+ if (mProperties.getUsage() == TU_DYNAMIC || mProperties.getUsage() == TU_STATIC)
|
|
|
{
|
|
{
|
|
|
PixelData myData = lock(discardWholeBuffer ? GBL_WRITE_ONLY_DISCARD : GBL_WRITE_ONLY, mipLevel, face);
|
|
PixelData myData = lock(discardWholeBuffer ? GBL_WRITE_ONLY_DISCARD : GBL_WRITE_ONLY, mipLevel, face);
|
|
|
PixelUtil::bulkPixelConversion(src, myData);
|
|
PixelUtil::bulkPixelConversion(src, myData);
|
|
@@ -201,19 +201,21 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- BS_EXCEPT(RenderingAPIException, "Trying to write into a buffer with unsupported usage: " + toString(mUsage));
|
|
|
|
|
|
|
+ BS_EXCEPT(RenderingAPIException, "Trying to write into a buffer with unsupported usage: " + toString(mProperties.getUsage()));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::copyImpl(UINT32 srcFace, UINT32 srcMipLevel, UINT32 destFace, UINT32 destMipLevel, TexturePtr& target)
|
|
|
|
|
|
|
+ void D3D9TextureCore::copyImpl(UINT32 srcFace, UINT32 srcMipLevel, UINT32 destFace, UINT32 destMipLevel, const SPtr<TextureCore>& target)
|
|
|
{
|
|
{
|
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
|
|
|
|
|
|
- if (getTextureType() == TEX_TYPE_1D || getTextureType() == TEX_TYPE_3D)
|
|
|
|
|
|
|
+ TextureType texType = mProperties.getTextureType();
|
|
|
|
|
+
|
|
|
|
|
+ if (texType == TEX_TYPE_1D || texType == TEX_TYPE_3D)
|
|
|
BS_EXCEPT(NotImplementedException, "Copy not implemented for 1D and 3D textures yet.");
|
|
BS_EXCEPT(NotImplementedException, "Copy not implemented for 1D and 3D textures yet.");
|
|
|
|
|
|
|
|
HRESULT hr;
|
|
HRESULT hr;
|
|
|
- D3D9Texture *other = static_cast<D3D9Texture*>(target.get());
|
|
|
|
|
|
|
+ D3D9TextureCore* other = static_cast<D3D9TextureCore*>(target.get());
|
|
|
|
|
|
|
|
for (auto& resPair : mMapDeviceToTextureResources)
|
|
for (auto& resPair : mMapDeviceToTextureResources)
|
|
|
{
|
|
{
|
|
@@ -223,7 +225,7 @@ namespace BansheeEngine
|
|
|
IDirect3DSurface9 *sourceSurface = nullptr;
|
|
IDirect3DSurface9 *sourceSurface = nullptr;
|
|
|
IDirect3DSurface9 *destSurface = nullptr;
|
|
IDirect3DSurface9 *destSurface = nullptr;
|
|
|
|
|
|
|
|
- if (getTextureType() == TEX_TYPE_2D && srcTextureResource->pNormTex != nullptr && dstTextureResource->pNormTex != nullptr)
|
|
|
|
|
|
|
+ if (texType == TEX_TYPE_2D && srcTextureResource->pNormTex != nullptr && dstTextureResource->pNormTex != nullptr)
|
|
|
{
|
|
{
|
|
|
if(FAILED(hr = srcTextureResource->pNormTex->GetSurfaceLevel(srcMipLevel, &sourceSurface)))
|
|
if(FAILED(hr = srcTextureResource->pNormTex->GetSurfaceLevel(srcMipLevel, &sourceSurface)))
|
|
|
{
|
|
{
|
|
@@ -237,7 +239,7 @@ namespace BansheeEngine
|
|
|
BS_EXCEPT(RenderingAPIException, "Cannot retrieve destination surface for copy: " + msg);
|
|
BS_EXCEPT(RenderingAPIException, "Cannot retrieve destination surface for copy: " + msg);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- else if (getTextureType() == TEX_TYPE_CUBE_MAP && srcTextureResource->pCubeTex != nullptr && dstTextureResource->pCubeTex != nullptr)
|
|
|
|
|
|
|
+ else if (texType == TEX_TYPE_CUBE_MAP && srcTextureResource->pCubeTex != nullptr && dstTextureResource->pCubeTex != nullptr)
|
|
|
{
|
|
{
|
|
|
IDirect3DSurface9 *sourceSurface = nullptr;
|
|
IDirect3DSurface9 *sourceSurface = nullptr;
|
|
|
if (FAILED(hr = srcTextureResource->pCubeTex->GetCubeMapSurface((D3DCUBEMAP_FACES)srcFace, srcMipLevel, &sourceSurface)))
|
|
if (FAILED(hr = srcTextureResource->pCubeTex->GetCubeMapSurface((D3DCUBEMAP_FACES)srcFace, srcMipLevel, &sourceSurface)))
|
|
@@ -274,7 +276,7 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- D3D9Texture::TextureResources* D3D9Texture::getTextureResources(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ D3D9TextureCore::TextureResources* D3D9TextureCore::getTextureResources(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
auto iterFind = mMapDeviceToTextureResources.find(d3d9Device);
|
|
auto iterFind = mMapDeviceToTextureResources.find(d3d9Device);
|
|
|
|
|
|
|
@@ -284,7 +286,7 @@ namespace BansheeEngine
|
|
|
return iterFind->second;
|
|
return iterFind->second;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- D3D9Texture::TextureResources* D3D9Texture::allocateTextureResources(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ D3D9TextureCore::TextureResources* D3D9TextureCore::allocateTextureResources(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
assert(mMapDeviceToTextureResources.find(d3d9Device) == mMapDeviceToTextureResources.end());
|
|
assert(mMapDeviceToTextureResources.find(d3d9Device) == mMapDeviceToTextureResources.end());
|
|
|
|
|
|
|
@@ -302,7 +304,7 @@ namespace BansheeEngine
|
|
|
return textureResources;
|
|
return textureResources;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::freeTextureResources(IDirect3DDevice9* d3d9Device, D3D9Texture::TextureResources* textureResources)
|
|
|
|
|
|
|
+ void D3D9TextureCore::freeTextureResources(IDirect3DDevice9* d3d9Device, D3D9TextureCore::TextureResources* textureResources)
|
|
|
{
|
|
{
|
|
|
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
|
|
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
|
|
|
|
|
|
|
@@ -323,14 +325,16 @@ namespace BansheeEngine
|
|
|
SAFE_RELEASE(textureResources->pDepthStencilSurface);
|
|
SAFE_RELEASE(textureResources->pDepthStencilSurface);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- UINT32 D3D9Texture::calculateSize() const
|
|
|
|
|
|
|
+ UINT32 D3D9TextureCore::calculateSize() const
|
|
|
{
|
|
{
|
|
|
- UINT32 instanceSize = getNumFaces() * PixelUtil::getMemorySize(mWidth, mHeight, mDepth, mFormat);
|
|
|
|
|
|
|
+ UINT32 instanceSize = mProperties.getNumFaces() *
|
|
|
|
|
+ PixelUtil::getMemorySize(mProperties.getWidth(), mProperties.getHeight(),
|
|
|
|
|
+ mProperties.getDepth(), mProperties.getFormat());
|
|
|
|
|
|
|
|
return instanceSize * (UINT32)mMapDeviceToTextureResources.size();
|
|
return instanceSize * (UINT32)mMapDeviceToTextureResources.size();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::determinePool()
|
|
|
|
|
|
|
+ void D3D9TextureCore::determinePool()
|
|
|
{
|
|
{
|
|
|
if (useDefaultPool())
|
|
if (useDefaultPool())
|
|
|
mD3DPool = D3DPOOL_DEFAULT;
|
|
mD3DPool = D3DPOOL_DEFAULT;
|
|
@@ -338,9 +342,9 @@ namespace BansheeEngine
|
|
|
mD3DPool = D3DPOOL_MANAGED;
|
|
mD3DPool = D3DPOOL_MANAGED;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::createInternalResources(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ void D3D9TextureCore::createInternalResources(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
- switch (getTextureType())
|
|
|
|
|
|
|
+ switch (mProperties.getTextureType())
|
|
|
{
|
|
{
|
|
|
case TEX_TYPE_1D:
|
|
case TEX_TYPE_1D:
|
|
|
case TEX_TYPE_2D:
|
|
case TEX_TYPE_2D:
|
|
@@ -353,32 +357,39 @@ namespace BansheeEngine
|
|
|
createVolumeTex(d3d9Device);
|
|
createVolumeTex(d3d9Device);
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(InternalErrorException, "Unknown texture type.");
|
|
BS_EXCEPT(InternalErrorException, "Unknown texture type.");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::createNormTex(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ void D3D9TextureCore::createNormTex(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
- assert(mWidth > 0 || mHeight > 0);
|
|
|
|
|
|
|
+ UINT32 width = mProperties.getWidth();
|
|
|
|
|
+ UINT32 height = mProperties.getHeight();
|
|
|
|
|
+ int texUsage = mProperties.getUsage();
|
|
|
|
|
+ UINT32 origNumMips = mProperties.getNumMipmaps();
|
|
|
|
|
+ PixelFormat format = mProperties.getFormat();
|
|
|
|
|
+ bool hwGamma = mProperties.isHardwareGammaEnabled();
|
|
|
|
|
+ UINT32 sampleCount = mProperties.getMultisampleCount();
|
|
|
|
|
+
|
|
|
|
|
+ assert(width > 0 || height > 0);
|
|
|
|
|
|
|
|
D3DFORMAT d3dPF = chooseD3DFormat(d3d9Device);
|
|
D3DFORMAT d3dPF = chooseD3DFormat(d3d9Device);
|
|
|
- if(mFormat != D3D9Mappings::_getPF(d3dPF))
|
|
|
|
|
|
|
+ if (format != D3D9Mappings::_getPF(d3dPF))
|
|
|
{
|
|
{
|
|
|
- BS_EXCEPT(RenderingAPIException, "Provided pixel format is not supported by the driver: " + toString(mFormat));
|
|
|
|
|
|
|
+ BS_EXCEPT(RenderingAPIException, "Provided pixel format is not supported by the driver: " + toString(format));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Use D3DX to help us create the texture, this way it can adjust any relevant sizes
|
|
// Use D3DX to help us create the texture, this way it can adjust any relevant sizes
|
|
|
- UINT numMips = (mNumMipmaps == MIP_UNLIMITED) ? D3DX_DEFAULT : mNumMipmaps + 1;
|
|
|
|
|
|
|
+ UINT numMips = (origNumMips == MIP_UNLIMITED) ? D3DX_DEFAULT : origNumMips + 1;
|
|
|
|
|
|
|
|
DWORD usage = 0;
|
|
DWORD usage = 0;
|
|
|
- if((mUsage & TU_RENDERTARGET) != 0)
|
|
|
|
|
|
|
+ if ((texUsage & TU_RENDERTARGET) != 0)
|
|
|
usage = D3DUSAGE_RENDERTARGET;
|
|
usage = D3DUSAGE_RENDERTARGET;
|
|
|
- else if((mUsage & TU_DEPTHSTENCIL) != 0)
|
|
|
|
|
|
|
+ else if ((texUsage & TU_DEPTHSTENCIL) != 0)
|
|
|
usage = D3DUSAGE_DEPTHSTENCIL;
|
|
usage = D3DUSAGE_DEPTHSTENCIL;
|
|
|
|
|
|
|
|
// Check dynamic textures
|
|
// Check dynamic textures
|
|
|
- if (mUsage & TU_DYNAMIC)
|
|
|
|
|
|
|
+ if (texUsage & TU_DYNAMIC)
|
|
|
{
|
|
{
|
|
|
if (canUseDynamicTextures(d3d9Device, usage, D3DRTYPE_TEXTURE, d3dPF))
|
|
if (canUseDynamicTextures(d3d9Device, usage, D3DRTYPE_TEXTURE, d3dPF))
|
|
|
{
|
|
{
|
|
@@ -392,18 +403,18 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Check sRGB support
|
|
// Check sRGB support
|
|
|
- if (mHwGamma)
|
|
|
|
|
|
|
+ if (hwGamma)
|
|
|
{
|
|
{
|
|
|
mHwGammaReadSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_TEXTURE, d3dPF, false);
|
|
mHwGammaReadSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_TEXTURE, d3dPF, false);
|
|
|
- if (mUsage & TU_RENDERTARGET)
|
|
|
|
|
|
|
+ if (texUsage & TU_RENDERTARGET)
|
|
|
mHwGammaWriteSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_TEXTURE, d3dPF, true);
|
|
mHwGammaWriteSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_TEXTURE, d3dPF, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Check multisample level
|
|
// Check multisample level
|
|
|
- if ((mUsage & TU_RENDERTARGET) != 0 || (mUsage & TU_DEPTHSTENCIL) != 0)
|
|
|
|
|
|
|
+ if ((texUsage & TU_RENDERTARGET) != 0 || (texUsage & TU_DEPTHSTENCIL) != 0)
|
|
|
{
|
|
{
|
|
|
D3D9RenderSystem* rsys = static_cast<D3D9RenderSystem*>(BansheeEngine::RenderSystem::instancePtr());
|
|
D3D9RenderSystem* rsys = static_cast<D3D9RenderSystem*>(BansheeEngine::RenderSystem::instancePtr());
|
|
|
- rsys->determineMultisampleSettings(d3d9Device, mMultisampleCount, d3dPF, false, &mMultisampleType, &mMultisampleQuality);
|
|
|
|
|
|
|
+ rsys->determineMultisampleSettings(d3d9Device, sampleCount, d3dPF, false, &mMultisampleType, &mMultisampleQuality);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -415,7 +426,7 @@ namespace BansheeEngine
|
|
|
const D3DCAPS9& rkCurCaps = device->getD3D9DeviceCaps();
|
|
const D3DCAPS9& rkCurCaps = device->getD3D9DeviceCaps();
|
|
|
|
|
|
|
|
// Check if mip maps are supported on hardware
|
|
// Check if mip maps are supported on hardware
|
|
|
- if (numMips > 1 && (!(rkCurCaps.TextureCaps & D3DPTEXTURECAPS_MIPMAP) || (mUsage & TU_RENDERTARGET) != 0 || (mUsage & TU_DEPTHSTENCIL) != 0))
|
|
|
|
|
|
|
+ if (numMips > 1 && (!(rkCurCaps.TextureCaps & D3DPTEXTURECAPS_MIPMAP) || (texUsage & TU_RENDERTARGET) != 0 || (texUsage & TU_DEPTHSTENCIL) != 0))
|
|
|
{
|
|
{
|
|
|
BS_EXCEPT(InvalidParametersException, "Invalid number of mipmaps. Maximum allowed is: 0");
|
|
BS_EXCEPT(InvalidParametersException, "Invalid number of mipmaps. Maximum allowed is: 0");
|
|
|
}
|
|
}
|
|
@@ -430,10 +441,10 @@ namespace BansheeEngine
|
|
|
else
|
|
else
|
|
|
textureResources = allocateTextureResources(d3d9Device);
|
|
textureResources = allocateTextureResources(d3d9Device);
|
|
|
|
|
|
|
|
- if ((mUsage & TU_RENDERTARGET) != 0 && (mMultisampleType != D3DMULTISAMPLE_NONE))
|
|
|
|
|
|
|
+ if ((texUsage & TU_RENDERTARGET) != 0 && (mMultisampleType != D3DMULTISAMPLE_NONE))
|
|
|
{
|
|
{
|
|
|
// Create AA surface
|
|
// Create AA surface
|
|
|
- HRESULT hr = d3d9Device->CreateRenderTarget(mWidth, mHeight, d3dPF,
|
|
|
|
|
|
|
+ HRESULT hr = d3d9Device->CreateRenderTarget(width, height, d3dPF,
|
|
|
mMultisampleType, mMultisampleQuality,
|
|
mMultisampleType, mMultisampleQuality,
|
|
|
FALSE,
|
|
FALSE,
|
|
|
&textureResources->pMultisampleSurface, NULL);
|
|
&textureResources->pMultisampleSurface, NULL);
|
|
@@ -445,7 +456,6 @@ namespace BansheeEngine
|
|
|
hr = textureResources->pMultisampleSurface->GetDesc(&desc);
|
|
hr = textureResources->pMultisampleSurface->GetDesc(&desc);
|
|
|
if (FAILED(hr))
|
|
if (FAILED(hr))
|
|
|
{
|
|
{
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(RenderingAPIException, "Can't get texture description: " + String(DXGetErrorDescription(hr)));
|
|
BS_EXCEPT(RenderingAPIException, "Can't get texture description: " + String(DXGetErrorDescription(hr)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -453,10 +463,10 @@ namespace BansheeEngine
|
|
|
|
|
|
|
|
mIsBindableAsShaderResource = false; // Cannot bind AA surfaces
|
|
mIsBindableAsShaderResource = false; // Cannot bind AA surfaces
|
|
|
}
|
|
}
|
|
|
- else if ((mUsage & TU_DEPTHSTENCIL) != 0 && (mMultisampleType != D3DMULTISAMPLE_NONE))
|
|
|
|
|
|
|
+ else if ((texUsage & TU_DEPTHSTENCIL) != 0 && (mMultisampleType != D3DMULTISAMPLE_NONE))
|
|
|
{
|
|
{
|
|
|
// Create AA depth stencil surface
|
|
// Create AA depth stencil surface
|
|
|
- HRESULT hr = d3d9Device->CreateDepthStencilSurface(mWidth, mHeight, d3dPF,
|
|
|
|
|
|
|
+ HRESULT hr = d3d9Device->CreateDepthStencilSurface(width, height, d3dPF,
|
|
|
mMultisampleType, mMultisampleQuality,
|
|
mMultisampleType, mMultisampleQuality,
|
|
|
FALSE,
|
|
FALSE,
|
|
|
&textureResources->pDepthStencilSurface, NULL);
|
|
&textureResources->pDepthStencilSurface, NULL);
|
|
@@ -469,7 +479,6 @@ namespace BansheeEngine
|
|
|
hr = textureResources->pDepthStencilSurface->GetDesc(&desc);
|
|
hr = textureResources->pDepthStencilSurface->GetDesc(&desc);
|
|
|
if (FAILED(hr))
|
|
if (FAILED(hr))
|
|
|
{
|
|
{
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(RenderingAPIException, "Can't get texture description: " + String(DXGetErrorDescription(hr)));
|
|
BS_EXCEPT(RenderingAPIException, "Can't get texture description: " + String(DXGetErrorDescription(hr)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -480,19 +489,17 @@ namespace BansheeEngine
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
// Create normal texture
|
|
// Create normal texture
|
|
|
- HRESULT hr = D3DXCreateTexture(d3d9Device, (UINT)mWidth, (UINT)mHeight, numMips,
|
|
|
|
|
|
|
+ HRESULT hr = D3DXCreateTexture(d3d9Device, (UINT)width, (UINT)height, numMips,
|
|
|
usage, d3dPF, mD3DPool, &textureResources->pNormTex);
|
|
usage, d3dPF, mD3DPool, &textureResources->pNormTex);
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
if (FAILED(hr))
|
|
|
{
|
|
{
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(RenderingAPIException, "Error creating texture: " + String(DXGetErrorDescription(hr)));
|
|
BS_EXCEPT(RenderingAPIException, "Error creating texture: " + String(DXGetErrorDescription(hr)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
hr = textureResources->pNormTex->QueryInterface(IID_IDirect3DBaseTexture9, (void **)&textureResources->pBaseTex);
|
|
hr = textureResources->pNormTex->QueryInterface(IID_IDirect3DBaseTexture9, (void **)&textureResources->pBaseTex);
|
|
|
if (FAILED(hr))
|
|
if (FAILED(hr))
|
|
|
{
|
|
{
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(RenderingAPIException, "Can't get base texture: " + String(DXGetErrorDescription(hr)));
|
|
BS_EXCEPT(RenderingAPIException, "Can't get base texture: " + String(DXGetErrorDescription(hr)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -501,7 +508,6 @@ namespace BansheeEngine
|
|
|
hr = textureResources->pNormTex->GetLevelDesc(0, &desc);
|
|
hr = textureResources->pNormTex->GetLevelDesc(0, &desc);
|
|
|
if (FAILED(hr))
|
|
if (FAILED(hr))
|
|
|
{
|
|
{
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(RenderingAPIException, "Can't get texture description: " + String(DXGetErrorDescription(hr)));
|
|
BS_EXCEPT(RenderingAPIException, "Can't get texture description: " + String(DXGetErrorDescription(hr)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -509,24 +515,31 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::createCubeTex(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ void D3D9TextureCore::createCubeTex(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
- assert(mWidth > 0 || mHeight > 0);
|
|
|
|
|
|
|
+ UINT32 width = mProperties.getWidth();
|
|
|
|
|
+ UINT32 height = mProperties.getHeight();
|
|
|
|
|
+ int texUsage = mProperties.getUsage();
|
|
|
|
|
+ UINT32 origNumMips = mProperties.getNumMipmaps();
|
|
|
|
|
+ PixelFormat format = mProperties.getFormat();
|
|
|
|
|
+ bool hwGamma = mProperties.isHardwareGammaEnabled();
|
|
|
|
|
+
|
|
|
|
|
+ assert(width > 0 || height > 0);
|
|
|
|
|
|
|
|
D3DFORMAT d3dPF = chooseD3DFormat(d3d9Device);
|
|
D3DFORMAT d3dPF = chooseD3DFormat(d3d9Device);
|
|
|
- if(mFormat != D3D9Mappings::_getPF(d3dPF))
|
|
|
|
|
|
|
+ if (format != D3D9Mappings::_getPF(d3dPF))
|
|
|
{
|
|
{
|
|
|
- BS_EXCEPT(RenderingAPIException, "Provided pixel format is not supported by the driver: " + toString(mFormat));
|
|
|
|
|
|
|
+ BS_EXCEPT(RenderingAPIException, "Provided pixel format is not supported by the driver: " + toString(format));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Use D3DX to help us create the texture, this way it can adjust any relevant sizes
|
|
// Use D3DX to help us create the texture, this way it can adjust any relevant sizes
|
|
|
- DWORD usage = (mUsage & TU_RENDERTARGET) ? D3DUSAGE_RENDERTARGET : 0;
|
|
|
|
|
- usage |= (mUsage & TU_DEPTHSTENCIL) ? D3DUSAGE_DEPTHSTENCIL : 0;
|
|
|
|
|
|
|
+ DWORD usage = (texUsage & TU_RENDERTARGET) ? D3DUSAGE_RENDERTARGET : 0;
|
|
|
|
|
+ usage |= (texUsage & TU_DEPTHSTENCIL) ? D3DUSAGE_DEPTHSTENCIL : 0;
|
|
|
|
|
|
|
|
- UINT numMips = (mNumMipmaps == MIP_UNLIMITED) ? D3DX_DEFAULT : mNumMipmaps + 1;
|
|
|
|
|
|
|
+ UINT numMips = (origNumMips == MIP_UNLIMITED) ? D3DX_DEFAULT : origNumMips + 1;
|
|
|
|
|
|
|
|
// Check dynamic textures
|
|
// Check dynamic textures
|
|
|
- if (mUsage & TU_DYNAMIC)
|
|
|
|
|
|
|
+ if (texUsage & TU_DYNAMIC)
|
|
|
{
|
|
{
|
|
|
if (canUseDynamicTextures(d3d9Device, usage, D3DRTYPE_CUBETEXTURE, d3dPF))
|
|
if (canUseDynamicTextures(d3d9Device, usage, D3DRTYPE_CUBETEXTURE, d3dPF))
|
|
|
{
|
|
{
|
|
@@ -540,10 +553,10 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Check sRGB support
|
|
// Check sRGB support
|
|
|
- if (mHwGamma)
|
|
|
|
|
|
|
+ if (hwGamma)
|
|
|
{
|
|
{
|
|
|
mHwGammaReadSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_CUBETEXTURE, d3dPF, false);
|
|
mHwGammaReadSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_CUBETEXTURE, d3dPF, false);
|
|
|
- if (mUsage & TU_RENDERTARGET)
|
|
|
|
|
|
|
+ if (texUsage & TU_RENDERTARGET)
|
|
|
mHwGammaWriteSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_CUBETEXTURE, d3dPF, true);
|
|
mHwGammaWriteSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_CUBETEXTURE, d3dPF, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -571,19 +584,17 @@ namespace BansheeEngine
|
|
|
textureResources = allocateTextureResources(d3d9Device);
|
|
textureResources = allocateTextureResources(d3d9Device);
|
|
|
|
|
|
|
|
// Create the texture
|
|
// Create the texture
|
|
|
- HRESULT hr = D3DXCreateCubeTexture(d3d9Device, (UINT)mWidth, numMips,
|
|
|
|
|
|
|
+ HRESULT hr = D3DXCreateCubeTexture(d3d9Device, (UINT)width, numMips,
|
|
|
usage, d3dPF, mD3DPool, &textureResources->pCubeTex);
|
|
usage, d3dPF, mD3DPool, &textureResources->pCubeTex);
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
if (FAILED(hr))
|
|
|
{
|
|
{
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(RenderingAPIException, "Error creating texture: " + String(DXGetErrorDescription(hr)));
|
|
BS_EXCEPT(RenderingAPIException, "Error creating texture: " + String(DXGetErrorDescription(hr)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
hr = textureResources->pCubeTex->QueryInterface(IID_IDirect3DBaseTexture9, (void **)&textureResources->pBaseTex);
|
|
hr = textureResources->pCubeTex->QueryInterface(IID_IDirect3DBaseTexture9, (void **)&textureResources->pBaseTex);
|
|
|
if (FAILED(hr))
|
|
if (FAILED(hr))
|
|
|
{
|
|
{
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(RenderingAPIException, "Can't get base texture: " + String(DXGetErrorDescription(hr)));
|
|
BS_EXCEPT(RenderingAPIException, "Can't get base texture: " + String(DXGetErrorDescription(hr)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -592,35 +603,42 @@ namespace BansheeEngine
|
|
|
hr = textureResources->pCubeTex->GetLevelDesc(0, &desc);
|
|
hr = textureResources->pCubeTex->GetLevelDesc(0, &desc);
|
|
|
if (FAILED(hr))
|
|
if (FAILED(hr))
|
|
|
{
|
|
{
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(RenderingAPIException, "Can't get texture description: " + String(DXGetErrorDescription(hr)));
|
|
BS_EXCEPT(RenderingAPIException, "Can't get texture description: " + String(DXGetErrorDescription(hr)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
setFinalAttributes(d3d9Device, textureResources, desc.Width, desc.Height, 1, D3D9Mappings::_getPF(desc.Format));
|
|
setFinalAttributes(d3d9Device, textureResources, desc.Width, desc.Height, 1, D3D9Mappings::_getPF(desc.Format));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::createVolumeTex(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ void D3D9TextureCore::createVolumeTex(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
- assert(mWidth > 0 && mHeight > 0 && mDepth>0);
|
|
|
|
|
|
|
+ UINT32 width = mProperties.getWidth();
|
|
|
|
|
+ UINT32 height = mProperties.getHeight();
|
|
|
|
|
+ UINT32 depth = mProperties.getDepth();
|
|
|
|
|
+ int texUsage = mProperties.getUsage();
|
|
|
|
|
+ UINT32 origNumMips = mProperties.getNumMipmaps();
|
|
|
|
|
+ PixelFormat format = mProperties.getFormat();
|
|
|
|
|
+ bool hwGamma = mProperties.isHardwareGammaEnabled();
|
|
|
|
|
+
|
|
|
|
|
+ assert(width > 0 && height > 0 && depth > 0);
|
|
|
|
|
|
|
|
- if (mUsage & TU_RENDERTARGET)
|
|
|
|
|
|
|
+ if (texUsage & TU_RENDERTARGET)
|
|
|
BS_EXCEPT(RenderingAPIException, "D3D9 Volume texture can not be created as render target !!");
|
|
BS_EXCEPT(RenderingAPIException, "D3D9 Volume texture can not be created as render target !!");
|
|
|
|
|
|
|
|
- if (mUsage & TU_DEPTHSTENCIL)
|
|
|
|
|
|
|
+ if (texUsage & TU_DEPTHSTENCIL)
|
|
|
BS_EXCEPT(RenderingAPIException, "D3D9 Volume texture can not be created as a depth stencil target !!");
|
|
BS_EXCEPT(RenderingAPIException, "D3D9 Volume texture can not be created as a depth stencil target !!");
|
|
|
|
|
|
|
|
D3DFORMAT d3dPF = chooseD3DFormat(d3d9Device);
|
|
D3DFORMAT d3dPF = chooseD3DFormat(d3d9Device);
|
|
|
- if(mFormat != D3D9Mappings::_getPF(d3dPF))
|
|
|
|
|
|
|
+ if(format != D3D9Mappings::_getPF(d3dPF))
|
|
|
{
|
|
{
|
|
|
- BS_EXCEPT(RenderingAPIException, "Provided pixel format is not supported by the driver: " + toString(mFormat));
|
|
|
|
|
|
|
+ BS_EXCEPT(RenderingAPIException, "Provided pixel format is not supported by the driver: " + toString(format));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Use D3DX to help us create the texture, this way it can adjust any relevant sizes
|
|
// Use D3DX to help us create the texture, this way it can adjust any relevant sizes
|
|
|
- DWORD usage = (mUsage & TU_RENDERTARGET) ? D3DUSAGE_RENDERTARGET : 0;
|
|
|
|
|
- UINT numMips = (mNumMipmaps == MIP_UNLIMITED) ? D3DX_DEFAULT : mNumMipmaps + 1;
|
|
|
|
|
|
|
+ DWORD usage = (texUsage & TU_RENDERTARGET) ? D3DUSAGE_RENDERTARGET : 0;
|
|
|
|
|
+ UINT numMips = (origNumMips == MIP_UNLIMITED) ? D3DX_DEFAULT : origNumMips + 1;
|
|
|
|
|
|
|
|
// Check dynamic textures
|
|
// Check dynamic textures
|
|
|
- if (mUsage & TU_DYNAMIC)
|
|
|
|
|
|
|
+ if (texUsage & TU_DYNAMIC)
|
|
|
{
|
|
{
|
|
|
if (canUseDynamicTextures(d3d9Device, usage, D3DRTYPE_VOLUMETEXTURE, d3dPF))
|
|
if (canUseDynamicTextures(d3d9Device, usage, D3DRTYPE_VOLUMETEXTURE, d3dPF))
|
|
|
{
|
|
{
|
|
@@ -634,10 +652,10 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Check sRGB support
|
|
// Check sRGB support
|
|
|
- if (mHwGamma)
|
|
|
|
|
|
|
+ if (hwGamma)
|
|
|
{
|
|
{
|
|
|
mHwGammaReadSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_VOLUMETEXTURE, d3dPF, false);
|
|
mHwGammaReadSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_VOLUMETEXTURE, d3dPF, false);
|
|
|
- if (mUsage & TU_RENDERTARGET)
|
|
|
|
|
|
|
+ if (texUsage & TU_RENDERTARGET)
|
|
|
mHwGammaWriteSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_VOLUMETEXTURE, d3dPF, true);
|
|
mHwGammaWriteSupported = canUseHardwareGammaCorrection(d3d9Device, usage, D3DRTYPE_VOLUMETEXTURE, d3dPF, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -661,19 +679,17 @@ namespace BansheeEngine
|
|
|
textureResources = allocateTextureResources(d3d9Device);
|
|
textureResources = allocateTextureResources(d3d9Device);
|
|
|
|
|
|
|
|
// Create the texture
|
|
// Create the texture
|
|
|
- HRESULT hr = D3DXCreateVolumeTexture(d3d9Device, (UINT)mWidth, (UINT)mHeight, (UINT)mDepth,
|
|
|
|
|
|
|
+ HRESULT hr = D3DXCreateVolumeTexture(d3d9Device, (UINT)width, (UINT)height, (UINT)depth,
|
|
|
numMips, usage, d3dPF, mD3DPool, &textureResources->pVolumeTex);
|
|
numMips, usage, d3dPF, mD3DPool, &textureResources->pVolumeTex);
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
if (FAILED(hr))
|
|
|
{
|
|
{
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(RenderingAPIException, "Error creating texture: " + String(DXGetErrorDescription(hr)));
|
|
BS_EXCEPT(RenderingAPIException, "Error creating texture: " + String(DXGetErrorDescription(hr)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
hr = textureResources->pVolumeTex->QueryInterface(IID_IDirect3DBaseTexture9, (void**)&textureResources->pBaseTex);
|
|
hr = textureResources->pVolumeTex->QueryInterface(IID_IDirect3DBaseTexture9, (void**)&textureResources->pBaseTex);
|
|
|
if (FAILED(hr))
|
|
if (FAILED(hr))
|
|
|
{
|
|
{
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(RenderingAPIException, "Can't get base texture: " + String(DXGetErrorDescription(hr)));
|
|
BS_EXCEPT(RenderingAPIException, "Can't get base texture: " + String(DXGetErrorDescription(hr)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -682,40 +698,40 @@ namespace BansheeEngine
|
|
|
hr = textureResources->pVolumeTex->GetLevelDesc(0, &desc);
|
|
hr = textureResources->pVolumeTex->GetLevelDesc(0, &desc);
|
|
|
if (FAILED(hr))
|
|
if (FAILED(hr))
|
|
|
{
|
|
{
|
|
|
- destroy_internal();
|
|
|
|
|
BS_EXCEPT(RenderingAPIException, "Can't get texture description: " + String(DXGetErrorDescription(hr)));
|
|
BS_EXCEPT(RenderingAPIException, "Can't get texture description: " + String(DXGetErrorDescription(hr)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
setFinalAttributes(d3d9Device, textureResources, desc.Width, desc.Height, desc.Depth, D3D9Mappings::_getPF(desc.Format));
|
|
setFinalAttributes(d3d9Device, textureResources, desc.Width, desc.Height, desc.Depth, D3D9Mappings::_getPF(desc.Format));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::setFinalAttributes(IDirect3DDevice9* d3d9Device, TextureResources* textureResources,
|
|
|
|
|
|
|
+ void D3D9TextureCore::setFinalAttributes(IDirect3DDevice9* d3d9Device, TextureResources* textureResources,
|
|
|
UINT32 width, UINT32 height, UINT32 depth, PixelFormat format)
|
|
UINT32 width, UINT32 height, UINT32 depth, PixelFormat format)
|
|
|
{
|
|
{
|
|
|
- if(width != mWidth || height != mHeight || depth != mDepth)
|
|
|
|
|
|
|
+ if(width != mProperties.getWidth() || height != mProperties.getHeight() || depth != mProperties.getDepth())
|
|
|
{
|
|
{
|
|
|
BS_EXCEPT(InternalErrorException, "Wanted and created textures sizes don't match!" \
|
|
BS_EXCEPT(InternalErrorException, "Wanted and created textures sizes don't match!" \
|
|
|
- "Width: " + toString(width) + "/" + toString(mWidth) +
|
|
|
|
|
- "Height: " + toString(height) + "/" + toString(mHeight) +
|
|
|
|
|
- "Depth: " + toString(depth) + "/" + toString(mDepth));
|
|
|
|
|
|
|
+ "Width: " + toString(width) + "/" + toString(mProperties.getWidth()) +
|
|
|
|
|
+ "Height: " + toString(height) + "/" + toString(mProperties.getHeight()) +
|
|
|
|
|
+ "Depth: " + toString(depth) + "/" + toString(mProperties.getDepth()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(format != mFormat)
|
|
|
|
|
|
|
+ if(format != mProperties.getFormat())
|
|
|
{
|
|
{
|
|
|
- BS_EXCEPT(InternalErrorException, "Wanted and created texture formats don't match! " + toString(format) + "/" + toString(mFormat));
|
|
|
|
|
|
|
+ BS_EXCEPT(InternalErrorException, "Wanted and created texture formats don't match! " +
|
|
|
|
|
+ toString(format) + "/" + toString(mProperties.getFormat()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
createSurfaceList(d3d9Device, textureResources);
|
|
createSurfaceList(d3d9Device, textureResources);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- D3DTEXTUREFILTERTYPE D3D9Texture::getBestFilterMethod(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ D3DTEXTUREFILTERTYPE D3D9TextureCore::getBestFilterMethod(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
D3D9Device* device = D3D9RenderSystem::getDeviceManager()->getDeviceFromD3D9Device(d3d9Device);
|
|
D3D9Device* device = D3D9RenderSystem::getDeviceManager()->getDeviceFromD3D9Device(d3d9Device);
|
|
|
const D3DCAPS9& deviceCaps = device->getD3D9DeviceCaps();
|
|
const D3DCAPS9& deviceCaps = device->getD3D9DeviceCaps();
|
|
|
|
|
|
|
|
DWORD filterCaps = 0;
|
|
DWORD filterCaps = 0;
|
|
|
|
|
|
|
|
- switch (getTextureType())
|
|
|
|
|
|
|
+ switch (mProperties.getTextureType())
|
|
|
{
|
|
{
|
|
|
case TEX_TYPE_1D:
|
|
case TEX_TYPE_1D:
|
|
|
// Same as 2D
|
|
// Same as 2D
|
|
@@ -748,7 +764,7 @@ namespace BansheeEngine
|
|
|
return D3DTEXF_POINT;
|
|
return D3DTEXF_POINT;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- bool D3D9Texture::canUseDynamicTextures(IDirect3DDevice9* d3d9Device, DWORD srcUsage, D3DRESOURCETYPE srcType,
|
|
|
|
|
|
|
+ bool D3D9TextureCore::canUseDynamicTextures(IDirect3DDevice9* d3d9Device, DWORD srcUsage, D3DRESOURCETYPE srcType,
|
|
|
D3DFORMAT srcFormat)
|
|
D3DFORMAT srcFormat)
|
|
|
{
|
|
{
|
|
|
IDirect3D9* pD3D = nullptr;
|
|
IDirect3D9* pD3D = nullptr;
|
|
@@ -770,7 +786,7 @@ namespace BansheeEngine
|
|
|
return hr == D3D_OK;
|
|
return hr == D3D_OK;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- bool D3D9Texture::canUseHardwareGammaCorrection(IDirect3DDevice9* d3d9Device, DWORD srcUsage,
|
|
|
|
|
|
|
+ bool D3D9TextureCore::canUseHardwareGammaCorrection(IDirect3DDevice9* d3d9Device, DWORD srcUsage,
|
|
|
D3DRESOURCETYPE srcType, D3DFORMAT srcFormat, bool forwriting)
|
|
D3DRESOURCETYPE srcType, D3DFORMAT srcFormat, bool forwriting)
|
|
|
{
|
|
{
|
|
|
IDirect3D9* pD3D = nullptr;
|
|
IDirect3D9* pD3D = nullptr;
|
|
@@ -799,7 +815,7 @@ namespace BansheeEngine
|
|
|
return hr == D3D_OK;
|
|
return hr == D3D_OK;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- bool D3D9Texture::canAutoGenMipmaps(IDirect3DDevice9* d3d9Device, DWORD srcUsage, D3DRESOURCETYPE srcType, D3DFORMAT srcFormat)
|
|
|
|
|
|
|
+ bool D3D9TextureCore::canAutoGenMipmaps(IDirect3DDevice9* d3d9Device, DWORD srcUsage, D3DRESOURCETYPE srcType, D3DFORMAT srcFormat)
|
|
|
{
|
|
{
|
|
|
IDirect3D9* pD3D = nullptr;
|
|
IDirect3D9* pD3D = nullptr;
|
|
|
|
|
|
|
@@ -827,30 +843,34 @@ namespace BansheeEngine
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- D3DFORMAT D3D9Texture::chooseD3DFormat(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ D3DFORMAT D3D9TextureCore::chooseD3DFormat(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
// Choose frame buffer pixel format in case PF_UNKNOWN was requested
|
|
// Choose frame buffer pixel format in case PF_UNKNOWN was requested
|
|
|
- if(mFormat == PF_UNKNOWN)
|
|
|
|
|
|
|
+ if(mProperties.getFormat() == PF_UNKNOWN)
|
|
|
{
|
|
{
|
|
|
D3D9Device* device = D3D9RenderSystem::getDeviceManager()->getDeviceFromD3D9Device(d3d9Device);
|
|
D3D9Device* device = D3D9RenderSystem::getDeviceManager()->getDeviceFromD3D9Device(d3d9Device);
|
|
|
|
|
|
|
|
- if((mUsage & TU_DEPTHSTENCIL) != 0)
|
|
|
|
|
|
|
+ if((mProperties.getUsage() & TU_DEPTHSTENCIL) != 0)
|
|
|
return device->getDepthStencilFormat();
|
|
return device->getDepthStencilFormat();
|
|
|
else
|
|
else
|
|
|
return device->getBackBufferFormat();
|
|
return device->getBackBufferFormat();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Choose closest supported D3D format as a D3D format
|
|
// Choose closest supported D3D format as a D3D format
|
|
|
- return D3D9Mappings::_getPF(D3D9Mappings::_getClosestSupportedPF(mFormat));
|
|
|
|
|
|
|
+ return D3D9Mappings::_getPF(D3D9Mappings::_getClosestSupportedPF(mProperties.getFormat()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::createSurfaceList(IDirect3DDevice9* d3d9Device, TextureResources* textureResources)
|
|
|
|
|
|
|
+ void D3D9TextureCore::createSurfaceList(IDirect3DDevice9* d3d9Device, TextureResources* textureResources)
|
|
|
{
|
|
{
|
|
|
|
|
+ int texUsage = mProperties.getUsage();
|
|
|
|
|
+ TextureType texType = mProperties.getTextureType();
|
|
|
|
|
+ UINT32 numMips = mProperties.getNumMipmaps();
|
|
|
|
|
+
|
|
|
assert(textureResources != nullptr);
|
|
assert(textureResources != nullptr);
|
|
|
|
|
|
|
|
// Need to know static / dynamic
|
|
// Need to know static / dynamic
|
|
|
UINT32 usage;
|
|
UINT32 usage;
|
|
|
- if ((mUsage & TU_DYNAMIC) && mDynamicTextures)
|
|
|
|
|
|
|
+ if ((texUsage & TU_DYNAMIC) && mDynamicTextures)
|
|
|
{
|
|
{
|
|
|
usage = GBU_DYNAMIC;
|
|
usage = GBU_DYNAMIC;
|
|
|
}
|
|
}
|
|
@@ -859,23 +879,23 @@ namespace BansheeEngine
|
|
|
usage = GBU_STATIC;
|
|
usage = GBU_STATIC;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (mUsage & TU_RENDERTARGET)
|
|
|
|
|
|
|
+ if (texUsage & TU_RENDERTARGET)
|
|
|
{
|
|
{
|
|
|
usage |= TU_RENDERTARGET;
|
|
usage |= TU_RENDERTARGET;
|
|
|
}
|
|
}
|
|
|
- else if(mUsage & TU_DEPTHSTENCIL)
|
|
|
|
|
|
|
+ else if (texUsage & TU_DEPTHSTENCIL)
|
|
|
{
|
|
{
|
|
|
usage |= TU_RENDERTARGET;
|
|
usage |= TU_RENDERTARGET;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- UINT32 surfaceCount = static_cast<UINT32>((getNumFaces() * (mNumMipmaps + 1)));
|
|
|
|
|
|
|
+ UINT32 surfaceCount = static_cast<UINT32>((mProperties.getNumFaces() * (numMips + 1)));
|
|
|
bool updateOldList = mSurfaceList.size() == surfaceCount;
|
|
bool updateOldList = mSurfaceList.size() == surfaceCount;
|
|
|
if(!updateOldList)
|
|
if(!updateOldList)
|
|
|
{
|
|
{
|
|
|
mSurfaceList.clear();
|
|
mSurfaceList.clear();
|
|
|
- for(UINT32 face = 0; face < getNumFaces(); face++)
|
|
|
|
|
|
|
+ for (UINT32 face = 0; face < mProperties.getNumFaces(); face++)
|
|
|
{
|
|
{
|
|
|
- for(UINT32 mip = 0; mip <= mNumMipmaps; mip++)
|
|
|
|
|
|
|
+ for (UINT32 mip = 0; mip <= numMips; mip++)
|
|
|
{
|
|
{
|
|
|
mSurfaceList.push_back(bs_shared_ptr<D3D9PixelBuffer>((GpuBufferUsage)usage, this));
|
|
mSurfaceList.push_back(bs_shared_ptr<D3D9PixelBuffer>((GpuBufferUsage)usage, this));
|
|
|
}
|
|
}
|
|
@@ -885,19 +905,19 @@ namespace BansheeEngine
|
|
|
IDirect3DSurface9* surface = nullptr;
|
|
IDirect3DSurface9* surface = nullptr;
|
|
|
IDirect3DVolume9* volume = nullptr;
|
|
IDirect3DVolume9* volume = nullptr;
|
|
|
|
|
|
|
|
- if((mUsage & TU_RENDERTARGET) != 0 && (mMultisampleType != D3DMULTISAMPLE_NONE))
|
|
|
|
|
|
|
+ if ((texUsage & TU_RENDERTARGET) != 0 && (mMultisampleType != D3DMULTISAMPLE_NONE))
|
|
|
{
|
|
{
|
|
|
assert(textureResources->pMultisampleSurface);
|
|
assert(textureResources->pMultisampleSurface);
|
|
|
- assert(getTextureType() == TEX_TYPE_2D);
|
|
|
|
|
|
|
+ assert(texUsage == TEX_TYPE_2D);
|
|
|
|
|
|
|
|
D3D9PixelBuffer* currPixelBuffer = static_cast<D3D9PixelBuffer*>(mSurfaceList[0].get());
|
|
D3D9PixelBuffer* currPixelBuffer = static_cast<D3D9PixelBuffer*>(mSurfaceList[0].get());
|
|
|
|
|
|
|
|
currPixelBuffer->bind(d3d9Device, textureResources->pMultisampleSurface, textureResources->pBaseTex);
|
|
currPixelBuffer->bind(d3d9Device, textureResources->pMultisampleSurface, textureResources->pBaseTex);
|
|
|
}
|
|
}
|
|
|
- else if((mUsage & TU_DEPTHSTENCIL) != 0 && (mMultisampleType != D3DMULTISAMPLE_NONE))
|
|
|
|
|
|
|
+ else if ((texUsage & TU_DEPTHSTENCIL) != 0 && (mMultisampleType != D3DMULTISAMPLE_NONE))
|
|
|
{
|
|
{
|
|
|
assert(textureResources->pDepthStencilSurface);
|
|
assert(textureResources->pDepthStencilSurface);
|
|
|
- assert(getTextureType() == TEX_TYPE_2D);
|
|
|
|
|
|
|
+ assert(texUsage == TEX_TYPE_2D);
|
|
|
|
|
|
|
|
D3D9PixelBuffer* currPixelBuffer = static_cast<D3D9PixelBuffer*>(mSurfaceList[0].get());
|
|
D3D9PixelBuffer* currPixelBuffer = static_cast<D3D9PixelBuffer*>(mSurfaceList[0].get());
|
|
|
|
|
|
|
@@ -908,19 +928,19 @@ namespace BansheeEngine
|
|
|
assert(textureResources->pBaseTex);
|
|
assert(textureResources->pBaseTex);
|
|
|
|
|
|
|
|
UINT32 numCreatedMips = textureResources->pBaseTex->GetLevelCount() - 1;
|
|
UINT32 numCreatedMips = textureResources->pBaseTex->GetLevelCount() - 1;
|
|
|
- if(numCreatedMips != mNumMipmaps)
|
|
|
|
|
|
|
+ if (numCreatedMips != numMips)
|
|
|
{
|
|
{
|
|
|
BS_EXCEPT(InternalErrorException, "Number of created and wanted mip map levels doesn't match: " +
|
|
BS_EXCEPT(InternalErrorException, "Number of created and wanted mip map levels doesn't match: " +
|
|
|
- toString(numCreatedMips) + "/" + toString(mNumMipmaps));
|
|
|
|
|
|
|
+ toString(numCreatedMips) + "/" + toString(numMips));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- switch(getTextureType())
|
|
|
|
|
|
|
+ switch(texType)
|
|
|
{
|
|
{
|
|
|
case TEX_TYPE_2D:
|
|
case TEX_TYPE_2D:
|
|
|
case TEX_TYPE_1D:
|
|
case TEX_TYPE_1D:
|
|
|
assert(textureResources->pNormTex);
|
|
assert(textureResources->pNormTex);
|
|
|
|
|
|
|
|
- for(UINT32 mip = 0; mip <= mNumMipmaps; mip++)
|
|
|
|
|
|
|
+ for (UINT32 mip = 0; mip <= numMips; mip++)
|
|
|
{
|
|
{
|
|
|
if(textureResources->pNormTex->GetSurfaceLevel(static_cast<UINT>(mip), &surface) != D3D_OK)
|
|
if(textureResources->pNormTex->GetSurfaceLevel(static_cast<UINT>(mip), &surface) != D3D_OK)
|
|
|
BS_EXCEPT(RenderingAPIException, "Get surface level failed");
|
|
BS_EXCEPT(RenderingAPIException, "Get surface level failed");
|
|
@@ -938,12 +958,12 @@ namespace BansheeEngine
|
|
|
|
|
|
|
|
for(UINT32 face = 0; face < 6; face++)
|
|
for(UINT32 face = 0; face < 6; face++)
|
|
|
{
|
|
{
|
|
|
- for(UINT32 mip = 0; mip <= mNumMipmaps; mip++)
|
|
|
|
|
|
|
+ for (UINT32 mip = 0; mip <= numMips; mip++)
|
|
|
{
|
|
{
|
|
|
if(textureResources->pCubeTex->GetCubeMapSurface((D3DCUBEMAP_FACES)face, static_cast<UINT>(mip), &surface) != D3D_OK)
|
|
if(textureResources->pCubeTex->GetCubeMapSurface((D3DCUBEMAP_FACES)face, static_cast<UINT>(mip), &surface) != D3D_OK)
|
|
|
BS_EXCEPT(RenderingAPIException, "Get cubemap surface failed");
|
|
BS_EXCEPT(RenderingAPIException, "Get cubemap surface failed");
|
|
|
|
|
|
|
|
- UINT32 idx = face*(mNumMipmaps + 1) + mip;
|
|
|
|
|
|
|
+ UINT32 idx = face*(numMips + 1) + mip;
|
|
|
D3D9PixelBuffer* currPixelBuffer = static_cast<D3D9PixelBuffer*>(mSurfaceList[idx].get());
|
|
D3D9PixelBuffer* currPixelBuffer = static_cast<D3D9PixelBuffer*>(mSurfaceList[idx].get());
|
|
|
|
|
|
|
|
currPixelBuffer->bind(d3d9Device, surface, textureResources->pBaseTex);
|
|
currPixelBuffer->bind(d3d9Device, surface, textureResources->pBaseTex);
|
|
@@ -955,7 +975,7 @@ namespace BansheeEngine
|
|
|
case TEX_TYPE_3D:
|
|
case TEX_TYPE_3D:
|
|
|
assert(textureResources->pVolumeTex);
|
|
assert(textureResources->pVolumeTex);
|
|
|
|
|
|
|
|
- for(UINT32 mip = 0; mip <= mNumMipmaps; mip++)
|
|
|
|
|
|
|
+ for (UINT32 mip = 0; mip <= numMips; mip++)
|
|
|
{
|
|
{
|
|
|
if(textureResources->pVolumeTex->GetVolumeLevel(static_cast<UINT>(mip), &volume) != D3D_OK)
|
|
if(textureResources->pVolumeTex->GetVolumeLevel(static_cast<UINT>(mip), &volume) != D3D_OK)
|
|
|
BS_EXCEPT(RenderingAPIException, "Get volume level failed");
|
|
BS_EXCEPT(RenderingAPIException, "Get volume level failed");
|
|
@@ -970,16 +990,16 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- PixelBufferPtr D3D9Texture::getBuffer(UINT32 face, UINT32 mipmap)
|
|
|
|
|
|
|
+ PixelBufferPtr D3D9TextureCore::getBuffer(UINT32 face, UINT32 mipmap)
|
|
|
{
|
|
{
|
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
|
|
|
|
|
|
- if(face >= getNumFaces())
|
|
|
|
|
|
|
+ if(face >= mProperties.getNumFaces())
|
|
|
BS_EXCEPT(InvalidParametersException, "A three dimensional cube has six faces");
|
|
BS_EXCEPT(InvalidParametersException, "A three dimensional cube has six faces");
|
|
|
- if(mipmap > mNumMipmaps)
|
|
|
|
|
|
|
+ if (mipmap > mProperties.getNumMipmaps())
|
|
|
BS_EXCEPT(InvalidParametersException, "Mipmap index out of range");
|
|
BS_EXCEPT(InvalidParametersException, "Mipmap index out of range");
|
|
|
|
|
|
|
|
- UINT32 idx = face*(mNumMipmaps+1) + mipmap;
|
|
|
|
|
|
|
+ UINT32 idx = face*(mProperties.getNumMipmaps() + 1) + mipmap;
|
|
|
|
|
|
|
|
IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getActiveD3D9Device();
|
|
IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getActiveD3D9Device();
|
|
|
TextureResources* textureResources = getTextureResources(d3d9Device);
|
|
TextureResources* textureResources = getTextureResources(d3d9Device);
|
|
@@ -994,12 +1014,13 @@ namespace BansheeEngine
|
|
|
return mSurfaceList[idx];
|
|
return mSurfaceList[idx];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- bool D3D9Texture::useDefaultPool()
|
|
|
|
|
|
|
+ bool D3D9TextureCore::useDefaultPool()
|
|
|
{
|
|
{
|
|
|
- return (mUsage & TU_RENDERTARGET) || (mUsage & TU_DEPTHSTENCIL) || ((mUsage & TU_DYNAMIC) && mDynamicTextures);
|
|
|
|
|
|
|
+ int usage = mProperties.getUsage();
|
|
|
|
|
+ return (usage & TU_RENDERTARGET) || (usage & TU_DEPTHSTENCIL) || ((usage & TU_DYNAMIC) && mDynamicTextures);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ void D3D9TextureCore::notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
|
|
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
|
|
|
|
|
|
|
@@ -1007,7 +1028,7 @@ namespace BansheeEngine
|
|
|
createInternalResources(d3d9Device);
|
|
createInternalResources(d3d9Device);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ void D3D9TextureCore::notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
|
|
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
|
|
|
|
|
|
|
@@ -1033,7 +1054,7 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::notifyOnDeviceLost(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ void D3D9TextureCore::notifyOnDeviceLost(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
|
|
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
|
|
|
|
|
|
|
@@ -1049,7 +1070,7 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void D3D9Texture::notifyOnDeviceReset(IDirect3DDevice9* d3d9Device)
|
|
|
|
|
|
|
+ void D3D9TextureCore::notifyOnDeviceReset(IDirect3DDevice9* d3d9Device)
|
|
|
{
|
|
{
|
|
|
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
|
|
D3D9_DEVICE_ACCESS_CRITICAL_SECTION
|
|
|
|
|
|
|
@@ -1059,7 +1080,7 @@ namespace BansheeEngine
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- IDirect3DBaseTexture9* D3D9Texture::getTexture_internal()
|
|
|
|
|
|
|
+ IDirect3DBaseTexture9* D3D9TextureCore::getTexture_internal()
|
|
|
{
|
|
{
|
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
|
|
|
|
|
@@ -1079,7 +1100,7 @@ namespace BansheeEngine
|
|
|
return textureResources->pBaseTex;
|
|
return textureResources->pBaseTex;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- IDirect3DTexture9* D3D9Texture::getNormTexture_internal()
|
|
|
|
|
|
|
+ IDirect3DTexture9* D3D9TextureCore::getNormTexture_internal()
|
|
|
{
|
|
{
|
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
|
|
|
|
|
@@ -1098,7 +1119,7 @@ namespace BansheeEngine
|
|
|
return textureResources->pNormTex;
|
|
return textureResources->pNormTex;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- IDirect3DCubeTexture9* D3D9Texture::getCubeTexture_internal()
|
|
|
|
|
|
|
+ IDirect3DCubeTexture9* D3D9TextureCore::getCubeTexture_internal()
|
|
|
{
|
|
{
|
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
THROW_IF_NOT_CORE_THREAD;
|
|
|
|
|
|