[2.1] Checking for Shadow Mapping support?

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
Kaylx
Greenskin
Posts: 123
Joined: Sun May 22, 2011 10:45 pm
Location: Scotland
x 7

[2.1] Checking for Shadow Mapping support?

Post by Kaylx »

Hey peeps,

I'm wondering what the best way is to check for shadow mapping support in 2.1 regardless of render system?
I was hoping to use RenderSystemCapabilities or something else but i don't know what to check to be honest.

For background we have several users on Direct3D but shadows only work for those with a feature level of 11 or more.
I want to disable shadows if they are not supported and I don't want to link to the Direct3D render system just to check the feature level, plus we have OpenGL and Metal users to consider as well.

Regards,
Kaylx
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] Checking for Shadow Mapping support?

Post by dark_sylinc »

Hi!

Shadow mapping is supported in all of our targetted platforms and hardware. If shadows are not working in a particular HW it could be a bug in our code or in the driver's.

A particular case is ESM shadow mapping which uses compute shaders for fast large-kernel filtering, but we provide a fallback for GPUs which don't support compute shaders as shown in ShadowMapDebuggingGameState::chooseEsmShadowNode sample.
User avatar
Kaylx
Greenskin
Posts: 123
Joined: Sun May 22, 2011 10:45 pm
Location: Scotland
x 7

Re: [2.1] Checking for Shadow Mapping support?

Post by Kaylx »

Hi Matias,

We use ESM shadow mapping as it gives the best results in our scenario and check for RSC_COMPUTE_PROGRAM just like the sample code does.

Our shadow compositor setup was taken straight from ShadowMapDebugging.compositor (i.e. ShadowMapDebuggingEsmShadowNodeBase, ShadowMapDebuggingEsmShadowNodeCompute, ShadowMapDebuggingEsmShadowNodePixelShader).

As for whether it's an Ogre issue or Driver issue I don't know, but here's the error:

Code: Select all

OGRE EXCEPTION(-2147024809:RenderingAPIException): Error creating texture
Error Description:invalid parameters were passed.
ID3D11Device::CreateTexture2D: D3D11_BIND_UNORDERED_ACCESS for Texture2D is only available on feature levels greater or equal to D3D_FEATURE_LEVEL_11_0.
ID3D11Device::CreateTexture2D: The format (0x38, R16_UNORM) cannot be bound as an UnorderedAccessView, or cast to a format that could be bound as an UnorderedAccessView.  Therefore this format does not support D3D11_BIND_UNORDERED_ACCESS.
ID3D11Device::CreateTexture2D: Returning E_INVALIDARG, meaning invalid parameters were passed.
 in D3D11Texture::_create2DTex at ...\3rdparty\ogre\2.1\src\rendersystems\direct3d11\src\ogred3d11texture.cpp (line 698)
I'm going to take an educated guess and say it has something to do with the atlas and tmpGaussianFilter textures being marked as uav lol.

Regards,
Kaylx
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] Checking for Shadow Mapping support?

Post by dark_sylinc »

Oh yeah, that sounds like a bug.

I will check running with Feature Level 10 to see if this can be repro'ed. We should not create an UAV texture in the fallback path.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] Checking for Shadow Mapping support?

Post by dark_sylinc »

I took a quick look and indeed we're creating UAV textures when we shouldn't.

Additionally, RSC_COMPUTE_PROGRAM was being set in FL 10, which is wrong. That has been fixed.

Only remains to strip the UAV flag from textures in the fallback path.
User avatar
Kaylx
Greenskin
Posts: 123
Joined: Sun May 22, 2011 10:45 pm
Location: Scotland
x 7

Re: [2.1] Checking for Shadow Mapping support?

Post by Kaylx »

Thanks for looking into it so quicky. :)

I shall keep an eye out for the uav fallback fix then try a new build out.
Post Reply