This is the code that is creating the textures:
Code: Select all
mTextureObjectA.set(mTexSize, mTexSize, GFXFormatR8G8B8X8, &GFXDynamicTextureProfile, avar("%s() - (line %d)", __FUNCTION__, __LINE__), 0); // was GFXDefaultStaticDiffuseProfile
mTextureObjectB.set(mTexSize, mTexSize, GFXFormatR8G8B8X8, &GFXDynamicTextureProfile, avar("%s() - (line %d)", __FUNCTION__, __LINE__), 0); // was GFXDefaultStaticDiffuseProfile
The previous working webkit code used 'GFXDefaultStaticDiffuseProfile', which has been renamed in development to'GFXStaticTextureProfile'. However when I try to use that I get a crash when the code tries to lock the texture. Locking the texture calls ID3D11DeviceContext::Map, which throws this error:
Code: Select all
D3D11 ERROR: ID3D11DeviceContext::Map: Map cannot be called with MAP_WRITE_DISCARD access, because the Resource was not created with the D3D11_CPU_ACCESS_WRITE flag. [ RESOURCE_MANIPULATION ERROR #2097210: RESOURCE_MAP_INVALIDMAPTYPE]
D:\Torque\Torque3D\Engine\source\gfx\D3D11\gfxD3D11TextureObject.cpp(114,0): {Fatal} - GFXD3D11TextureObject::lock - Failed to map subresource.
Having had a look through the D3D11 documentation I think I need the texture to be dynamic since webkit will be updating it. Hence why I've updated the texture profile to GFXDynamicTextureProfile.
In GFXD3D11TextureManager::_innerCreateTexture() I'm now getting these errors when the texture is created:
E_INVALIDARG One or more arguments are invalid
D3D11 ERROR: ID3D11Device::CreateTexture2D: A D3D11_USAGE_DYNAMIC Resource must have MipLevels equal to 1. [ STATE_CREATION ERROR #102: CREATETEXTURE2D_INVALIDMIPLEVELS]
D3D11 ERROR: ID3D11Device::CreateTexture2D: A D3D11_USAGE_DYNAMIC Resource cannot be bound to certain parts of the graphics pipeline, but must have at least one BindFlags bit set. The following BindFlags bits (0x28) cannot be set in this case: D3D11_BIND_STREAM_OUTPUT (0), D3D11_BIND_RENDER_TARGET (1), D3D11_BIND_DEPTH_STENCIL (0), D3D11_BIND_UNORDERED_ACCESS (0). [ STATE_CREATION ERROR #99: CREATETEXTURE2D_INVALIDBINDFLAGS]
This is the D3D11_TEXTURE3D_DESC that has been created:
