Skip to content

Commit

Permalink
[D3D11] Make it possible to render into the other slices of TEX_TYPE_…
Browse files Browse the repository at this point in the history
…2D_ARRAY, not first only
  • Loading branch information
Eugene Golushkov committed Feb 13, 2016
1 parent 2826171 commit fa4f9cb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion RenderSystems/Direct3D11/include/OgreD3D11Texture.h
Expand Up @@ -195,7 +195,7 @@ namespace Ogre {
D3D11Device & mDevice;
ComPtr<ID3D11RenderTargetView> mRenderTargetView;
public:
D3D11RenderTexture(const String &name, D3D11HardwarePixelBuffer *buffer, D3D11Device & device );
D3D11RenderTexture(const String &name, D3D11HardwarePixelBuffer *buffer, uint32 zoffset, D3D11Device & device);
virtual ~D3D11RenderTexture();

void rebind(D3D11HardwarePixelBuffer *buffer);
Expand Down
Expand Up @@ -62,7 +62,7 @@ namespace Ogre {
String name;
name = "rtt/"+StringConverter::toString((size_t)mParentTexture) + "/" + StringConverter::toString(mSubresourceIndex) + "/" + parentTexture->getName();

RenderTexture *trt = new D3D11RenderTexture(name, this, mDevice);
RenderTexture *trt = new D3D11RenderTexture(name, this, zoffset, mDevice);
mSliceTRT.push_back(trt);
Root::getSingleton().getRenderSystem()->attachRenderTarget(*trt);
}
Expand Down
10 changes: 7 additions & 3 deletions RenderSystems/Direct3D11/src/OgreD3D11Texture.cpp
Expand Up @@ -1040,19 +1040,22 @@ namespace Ogre
RTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
RTVDesc.Texture2DArray.FirstArraySlice = buffer->getFace();
RTVDesc.Texture2DArray.ArraySize = 1;
RTVDesc.Texture2DArray.MipSlice = 0;
break;
case D3D11_SRV_DIMENSION_TEXTURE2D:
RTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
break;
case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
RTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
RTVDesc.Texture2DArray.FirstArraySlice = mZOffset;
RTVDesc.Texture2DArray.ArraySize = 1;
break;
case D3D11_SRV_DIMENSION_TEXTURE2DMS:
RTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
break;
case D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY:
RTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY;
RTVDesc.Texture2DArray.FirstArraySlice = mZOffset;
RTVDesc.Texture2DArray.ArraySize = 1;
break;
case D3D11_SRV_DIMENSION_TEXTURE3D:
RTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
Expand Down Expand Up @@ -1118,8 +1121,9 @@ namespace Ogre
RenderTexture::getCustomAttribute(name, pData);
}
//---------------------------------------------------------------------
D3D11RenderTexture::D3D11RenderTexture( const String &name, D3D11HardwarePixelBuffer *buffer, D3D11Device & device ) : mDevice(device),
RenderTexture(buffer, 0)
D3D11RenderTexture::D3D11RenderTexture( const String &name, D3D11HardwarePixelBuffer *buffer, uint32 zoffset, D3D11Device & device )
: RenderTexture(buffer, zoffset)
, mDevice(device)
{
mName = name;
rebind(buffer);
Expand Down

0 comments on commit fa4f9cb

Please sign in to comment.