• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About haiiry

  • Rank

Personal Information

  • Interests
  1. Got it wokring. I was running my code in separate thread. After I moved it to hooked Present(), application did not crash.
  2. To clarify, desc.SampleDesc.Count is 1 always. Original texture is DXGI_FORMAT_R8G8B8A8_UNORM_SRGB aswell. I use format and dimensions from original texture (GetDesc and then applied it to create my texture). I've tried to check if texture is already _STAGING when I pass it to my function, but it never was. Same as https://msdn.microsoft.com/en-us/library/windows/desktop/bb174570(v=vs.85).aspx Just tested on 2 another systems with Intel CPU + AMD GPU and AMD CPU + AMD GPU and it didn't crash. Seems like something with intel and nvidia drivers.
  3. As I'm injecting into another application and D3D device is already created, I did not.
  4. I'm trying to get, basically, screenshot (each 1 second, without saving) of Direct3D11 application. Code works fine on my PC(Intel CPU, Radeon GPU) but crashes after few iterations on 2 others (Intel CPU + Intel integrated GPU, Intel CPU + Nvidia GPU). void extractBitmap(void* texture) { if (texture) { ID3D11Texture2D* d3dtex = (ID3D11Texture2D*)texture; ID3D11Texture2D* pNewTexture = NULL; D3D11_TEXTURE2D_DESC desc; d3dtex->GetDesc(&desc); desc.BindFlags = 0; desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; desc.Usage = D3D11_USAGE_STAGING; desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; HRESULT hRes = D3D11Device->CreateTexture2D(&desc, NULL, &pNewTexture); if (FAILED(hRes)) { printCon(std::string("CreateTexture2D FAILED:" + format_error(hRes)).c_str()); if (hRes == DXGI_ERROR_DEVICE_REMOVED) printCon(std::string("DXGI_ERROR_DEVICE_REMOVED -- " + format_error(D3D11Device->GetDeviceRemovedReason())).c_str()); } else { if (pNewTexture) { D3D11DeviceContext->CopyResource(pNewTexture, d3dtex); // Wokring with texture pNewTexture->Release(); } } } return; } D3D11SwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast< void** >(&pBackBuffer)); extractBitmap(pBackBuffer); pBackBuffer->Release(); Crash log: CreateTexture2D FAILED:887a0005 DXGI_ERROR_DEVICE_REMOVED -- 887a0020 Once I comment out D3D11DeviceContext->CopyResource(pNewTexture, d3dtex); code works fine on all 3 PC's.
  • Advertisement