{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/DirectX-Graphics-Samples/issues/110","repository_url":"https://api.github.com/repos/Microsoft/DirectX-Graphics-Samples","labels_url":"https://api.github.com/repos/Microsoft/DirectX-Graphics-Samples/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/DirectX-Graphics-Samples/issues/110/comments","events_url":"https://api.github.com/repos/Microsoft/DirectX-Graphics-Samples/issues/110/events","html_url":"https://github.com/Microsoft/DirectX-Graphics-Samples/issues/110","id":137552165,"number":110,"title":"VS 2015 graphics debugger crashing on call of map function","user":{"login":"Yoshusa","id":9078369,"avatar_url":"https://avatars.githubusercontent.com/u/9078369?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoshusa","html_url":"https://github.com/Yoshusa","followers_url":"https://api.github.com/users/Yoshusa/followers","following_url":"https://api.github.com/users/Yoshusa/following{/other_user}","gists_url":"https://api.github.com/users/Yoshusa/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoshusa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoshusa/subscriptions","organizations_url":"https://api.github.com/users/Yoshusa/orgs","repos_url":"https://api.github.com/users/Yoshusa/repos","events_url":"https://api.github.com/users/Yoshusa/events{/privacy}","received_events_url":"https://api.github.com/users/Yoshusa/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-01T11:48:07Z","updated_at":"2016-03-10T14:03:37Z","closed_at":"2016-03-10T14:03:37Z","body":"Dear Microsoft Team,\r\n\r\nTake the following code and add it to the begin of the LoadAssets method of the HelloTriangle example (or any other of the hello world examples):\r\n\r\n    HRESULT NativeResult;\r\n\r\n    D3D12_HEAP_PROPERTIES NativeUploadHeapProperties;\r\n        \r\n    NativeUploadHeapProperties.Type                 = D3D12_HEAP_TYPE_UPLOAD;\r\n    NativeUploadHeapProperties.CPUPageProperty      = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;\r\n    NativeUploadHeapProperties.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;\r\n    NativeUploadHeapProperties.CreationNodeMask     = 0;\r\n    NativeUploadHeapProperties.VisibleNodeMask      = 0;\r\n\r\n    D3D12_RESOURCE_DESC NativeUploadResourceDescriptor;\r\n\r\n    NativeUploadResourceDescriptor.Dimension          = D3D12_RESOURCE_DIMENSION_TEXTURE2D;\r\n    NativeUploadResourceDescriptor.Alignment          = 0;\r\n    NativeUploadResourceDescriptor.Width              = 1024;\r\n    NativeUploadResourceDescriptor.Height             = 1024;\r\n    NativeUploadResourceDescriptor.DepthOrArraySize   = 1;\r\n    NativeUploadResourceDescriptor.MipLevels          = 1;\r\n    NativeUploadResourceDescriptor.Format             = DXGI_FORMAT_R8G8B8A8_UNORM;\r\n    NativeUploadResourceDescriptor.SampleDesc.Count   = 1;\r\n    NativeUploadResourceDescriptor.SampleDesc.Quality = 0;\r\n    NativeUploadResourceDescriptor.Layout             = D3D12_TEXTURE_LAYOUT_UNKNOWN;\r\n    NativeUploadResourceDescriptor.Flags              = D3D12_RESOURCE_FLAG_NONE;\r\n\r\n    ComPtr<ID3D12Resource> NativeUploadResourcePtr;\r\n\r\n    NativeResult = m_device->CreateCommittedResource(&NativeUploadHeapProperties, D3D12_HEAP_FLAG_NONE, &NativeUploadResourceDescriptor, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&NativeUploadResourcePtr));\r\n\r\n    CD3DX12_RANGE NativeRange(0, 0);\r\n\r\n    NativeResult = NativeUploadResourcePtr->Map(0, &NativeRange, nullptr);\r\n\r\nRunning this piece of code without the graphics debugger returns s_OK for all NativeResult values, but the graphics debugger crashes on the Map function with a null pointer exception.\r\nReading the documentation I thought it was ok to map textures with unknow texture layout, as long as I do not expect a CPU pointer in return and have a zero read range. After the Map Operation I wanted to use the WriteToSubresource method. But maybe I am wrong with this approach.\r\n\r\nWhat I want to do is the following: I have a texture array, whose textures can be edited by the user (terrain materials in a game engine). When the user selects a new material then I have to update some slots in the texture array. My workaround is now to use intermediate buffers for upload, but looking at the code of the UpdateSubresources method I think that mapping an upload texture plus WriteToSubresource would be faster.\r\n\r\nKind Regards,\r\n\r\nJoerg Sahm"},"comment":{"url":"https://api.github.com/repos/Microsoft/DirectX-Graphics-Samples/issues/comments/194857697","html_url":"https://github.com/Microsoft/DirectX-Graphics-Samples/issues/110#issuecomment-194857697","issue_url":"https://api.github.com/repos/Microsoft/DirectX-Graphics-Samples/issues/110","id":194857697,"user":{"login":"Yoshusa","id":9078369,"avatar_url":"https://avatars.githubusercontent.com/u/9078369?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoshusa","html_url":"https://github.com/Yoshusa","followers_url":"https://api.github.com/users/Yoshusa/followers","following_url":"https://api.github.com/users/Yoshusa/following{/other_user}","gists_url":"https://api.github.com/users/Yoshusa/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoshusa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoshusa/subscriptions","organizations_url":"https://api.github.com/users/Yoshusa/orgs","repos_url":"https://api.github.com/users/Yoshusa/repos","events_url":"https://api.github.com/users/Yoshusa/events{/privacy}","received_events_url":"https://api.github.com/users/Yoshusa/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T14:03:36Z","updated_at":"2016-03-10T14:03:36Z","body":"Hi Bob,\r\n\r\nsorry for the late response. I've had some nasty exceptions while trying to upgrade my system to 10586, so I decided to reinstall it. Yes, you are right, I now get the same debug layer output as on your system.\r\n\r\nI will close the issue. However, please consider the following notes:\r\n- I think, this restriction is worth to mention it in the remarks section of the CreateCommittedResource method documentation (and also in the docs of the other methods for resource creation).\r\n- I would like to have a best practice sample about streaming textures (not only updating a complete texture, but also updating parts of a mega texture or clip map). Getting footprints and copying texture data row-wise as in the UpdateSubresources method seems inefficient to me (though I am aware, that this is maybe the only chance to do it in a hardware independent way).\r\n\r\nGreetings,\r\n\r\nJoerg"}}