I'm trying to render to a cubemap using the geometry shader (GS). I want to render just depth, therefore I need to set a null render target and a depthstencilView as a texture2Darray of resources and indexing them with SV_RenderTargetArrayIndex in the GS.
The problem is that anytime that I launch PIX to verify the rendering results, the application crashes under pix (it doesn't crash if launch it without pix).
I tried disabling the shadow generation code and it still crashes, then I disabled the code that was creating the depth stencil view and the shader resource view for the cubemap and magically PIX wasn't crashing anymore.
So I think the problem might be in how I create those resources. I started digging on the internet to be sure that I was doing everything in the correct way etc. But I couldn't find any contraddiction with my code, so everything seems correct. It's also true that I couldn't find any reference or code sample that was showing the use of a depthstencilview for cubemap rendering with a rendertargetview set to null and color writes off.
btw here is my code to create DSV:
// Create a texture array to hold cube map data FdkGfxTexture2DDesc texDesc; ZeroMemory(&texDesc,sizeof(FdkGfxTexture2DDesc)); texDesc.width = 1024; texDesc.height = 1024; texDesc.mipLevels = 1; texDesc.arraySize = 6; texDesc.format = FDK_FORMAT_R32_TYPELESS; texDesc.sampleDesc.count = 1; texDesc.sampleDesc.quality = 0; texDesc.usage = FDK_USAGE_DEFAULT; texDesc.bindFlags = FDK_BIND_DEPTH_STENCIL | FDK_BIND_SHADER_RESOURCE; texDesc.CPUAccessFlags = 0; texDesc.miscFlags = FDK_RESOURCE_MISC_TEXTURECUBE; FdkGfxTexture2DId texId = fdkGfxCreateTexture2D(device,&texDesc,NULL); // Create the depth stencil view desc for cube depth render FdkGfxDepthStencilResourceViewDesc descDSV; ZeroMemory(&descDSV,sizeof(descDSV)); descDSV.format = FDK_FORMAT_D32_FLOAT; descDSV.viewDimension = FDK_DSV_DIMENSION_TEXTURE2DARRAY; descDSV.texture2DArray.firstArraySlice = 0; descDSV.texture2DArray.arraySize = 6; descDSV.texture2DArray.mipSlice = 0; mDeferredData->mPointLightShadowMapBufferId = fdkGfxCreateDepthStencilTarget2D(device,&descDSV,texId); //create shader resource view desc for the cube depth texture FdkGfxShaderResourceViewDesc srvDesc; ZeroMemory(&srvDesc,sizeof(srvDesc)); srvDesc.format = FDK_FORMAT_R32_FLOAT; srvDesc.viewDimension = FDK_SRV_DIMENSION_TEXTURECUBE; srvDesc.textureCube.mipLevels = 1; srvDesc.textureCube.mostDetailedMip = 0; mDeferredData->mPointLightShadowMapShaderResource = fdkGfxCreateShaderResource(device,&srvDesc,texId); fdkGfxDestroyTexture2D(texId);
fdk is just my API you can replace it with D3D11_blabla ;)
When it comes time to render, I expect to do something like:
OMSetRenderTargets(0,0,cubeMapDSV); //rtViewCount == 0, rtView == NULL
which means no render target view, just depth. I guess the rendering should be faster if we render depth with no color writes.
Could someone shed some light on this ?
Thanks in advance
Edited by MegaPixel, 04 September 2012 - 03:01 AM.