Open benstevens48 opened 6 years ago
Where does the exception come from? (use native or mixed mode debugging, and turn on first chance exceptions to see...)
4096 is the max texture size for D3D feature level 9.3, which is probably what you are getting in the emulator. Virtual bitmaps are not limited to the GPU max texture size, but there could be something else hitting this limit?
Hi Shawn, I'm not very familiar with debugging native code. I tried enabling mixed mode, but the most information I can get is 'Exception thrown at 0x76747BCA (msvcrt.dll) in Test.exe: 0xC0000005: Access violation reading location 0x0C049000'. Also, the last dll to load was C:\Windows\System32\PhotoMetadataHandler.dll (Cannot find or open the PDB file). The problem does not occur if I use software rendering for the emulator. Also, I'm using the 3GB memory emulator so I don't think it's running out of memory.
You should be able to examine the callstack when the debugger breaks after hitting this exception.
Here is the stack
msvcrt.dll!_memcpy()
rfxvmt.dll!CVmtChannelV1::DoWrite(unsigned char *,unsigned __int64,unsigned int &,unsigned int &)
rfxvmt.dll!CVmtChannelV1::VWrite(unsigned long,char *,unsigned __int64 &)
rfxvmt.dll!_RfxVmtVWriteChannel@16()
rfxvmt.dll!InvokeVWrite(void *,unsigned __int64 *,unsigned long,...)
rfxvmt.dll!_RfxVmtWriteChannel@20()
rdvgu1132.dll!VmtTransport::WriteNonCached(void *,unsigned long)
rdvgu1132.dll!VmtTransport::Flush(void)
rdvgu1132.dll!UMResource::Init(struct D3D11DDIARG_CREATERESOURCE const *,struct D3D10DDI_HRTRESOURCE)
rdvgu1132.dll!UMResourceContainer::UMResourceContainer(class UMDevice *,struct D3D11DDIARG_CREATERESOURCE const *,struct D3D10DDI_HRTRESOURCE)
rdvgu1132.dll!UMDevice::CreateResource11Impl(struct D3D11DDIARG_CREATERESOURCE const *,class UMResourceContainer *,struct D3D10DDI_HRTRESOURCE)
rdvgu1132.dll!CreateResource11(class UMDevice *,struct D3D11DDIARG_CREATERESOURCE const *,class UMResourceContainer *,struct D3D10DDI_HRTRESOURCE)
d3d11.dll!CResource<struct ID3D11Texture2D1>::CLS::FinalConstruct(class CContext *,struct D3D11DDIARG_CREATERESOURCE const *,struct SD3D11SharedResourceCreationArgs *,struct SD3D11CrossLayerData *,struct D3D10DDI_HRTRESOURCE)
d3d11.dll!CDevice::CreateLayeredChild(unsigned int,void const *,unsigned long,struct ID3D11LayeredUseCounted *,struct _GUID const &,void * *)
d3d11.dll!NDXGI::CDeviceChild<struct IDXGIResource1,struct IDXGISwapChainInternal>::FinalConstruct(enum ED3D11DeviceChildType,struct SLayeredArgs const *,unsigned long,struct ID3D11LayeredUseCounted *)
d3d11.dll!NDXGI::CDevice::CreateLayeredChild(unsigned int,void const *,unsigned long,struct ID3D11LayeredUseCounted *,struct _GUID const &,void * *)
d3d11.dll!NOutermost::CDevice::CreateLayeredChild(unsigned int,void const *,unsigned long,struct ID3D11LayeredUseCounted *,struct _GUID const &,void * *)
d3d11.dll!CDevice::CreateTexture2D_Worker(struct D3D11_TEXTURE2D_DESC1 const *,struct D3D11_SUBRESOURCE_DATA const *,int,struct ID3D11Texture2D1 * *,struct SD3D11SharedResourceCreationArgs *,bool,bool,struct ID3D11LayeredUseCounted *)
d3d11.dll!CDevice::CreateTexture2D(struct D3D11_TEXTURE2D_DESC const *,struct D3D11_SUBRESOURCE_DATA const *,struct ID3D11Texture2D * *)
d2d1.dll!6ec69b9f()
[Frames below may be incorrect and/or missing, no symbols loaded for d2d1.dll]
d2d1.dll!6ec6916e()
d2d1.dll!6ec68973()
d2d1.dll!6ec7b360()
d2d1.dll!6ec7b527()
d2d1.dll!6ec7b59d()
d2d1.dll!6ed937aa()
d2d1.dll!6ed93317()
d2d1.dll!6ecae299()
d2d1.dll!6eba130b()
d2d1.dll!6eba124b()
d2d1.dll!6eba1144()
d2d1.dll!6eba106c()
Microsoft.Graphics.Canvas.dll!As<struct ID2D1DeviceContext2,struct ID2D1DeviceContext1>(struct ID2D1DeviceContext1 *)
Microsoft.Graphics.Canvas.dll!ABI::Microsoft::Graphics::Canvas::UI::Xaml::CanvasSwapChainPanelAdapter::`vector deleting destructor'(unsigned int)
Microsoft.Graphics.Canvas.dll!std::_Ref_count_obj<class CanvasAnimatedControlAdapter>::_Destroy(void)
Microsoft.Graphics.Canvas.dll!std::_Ref_count_base::_Decref(void)
Microsoft.Graphics.Canvas.dll!std::_Func_class<class Microsoft::WRL::ComPtr<class ABI::Microsoft::Graphics::Canvas::CanvasBitmap> >::operator()(void)
Microsoft.Graphics.Canvas.dll!ExceptionBoundary<<lambda_3c79ad746edac733c881be077d5d671e> >()
Microsoft.Graphics.Canvas.dll!Microsoft::WRL::Details::InvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,ABI::Windows::System::Threading::IWorkItemHandler,Microsoft::WRL::FtmBase>,<lambda_aaa08f7508114a56a06cea2020ec2da7>,1,1>::Invoke()
threadpoolwinrt.dll!Windows::System::Threading::CThreadPoolWorkItem::CommonWorkCallback(void)
threadpoolwinrt.dll!Windows::System::Threading::CThreadPoolWorkItem::BatchedCallback(struct _TP_CALLBACK_INSTANCE *,void *,struct _TP_WORK *)
ntdll.dll!TppWorkpExecuteCallback()
ntdll.dll!TppWorkerThread()
ntdll.dll!__RtlUserThreadStart()
ntdll.dll!__RtlUserThreadStart@8()
I think there may be a mismatch somewhere between the actual device capabilities and the reported capabilities. For example, Device.MaximumBitmapSizeInPixels reports 16384, but I'm pretty sure it's the 4096 limit that's the issue - I just tried resizing an image which was smaller than that (3840 pixels wide), which worked fine, to 4097 pixels wide, and it failed with the larger image.
Thanks. This looks like an emulator bug. I'll pass it on to the relevant team, but for now just turning off device hardware acceleration in your settings should be a good workaround.
Ok, thanks. The main reason for doing this was to check that it worked on a phone. I assume that someone has tested it on a phone (I don't have a Windows Phone myself)?
Yes, Win2D works on phones. Of course the only way to be 100% sure your particular app will work is to try it for real. The emulator is a close approximation but not the same thing as a real phone (for instance it is x86 rather than ARM, and not the same GPU or graphics driver).
When using the Windows 10 Mobile Emulator (any of them I tried, and specifically 10.0.15254.0), if I try to load a CanvasVirtualBitmap with width larger than 4096 pixels, I get an uncatchable Access violation exception (assuming Use device hardware acceleration is set in the emulator settings). I was just wondering if this problem is simply to do with using the emulator, or whether it's actually a bug in Win2D.