2012-02-18 4 views
1

: drawFrame가다이렉트 X 11 블루 스크린 내 프로그램 실행 때 나는 다음과 같은 코드를 사용하려고 해요

HRESULT hResult; 
HDC hDC; 
IDXGISurface1 *pSurface = NULL; 
hResult = m_flashTexture->QueryInterface(__uuidof(IDXGISurface1), (void**)&pSurface); 
hResult = pSurface->GetDC(TRUE, &hDC);     
assert(SUCCEEDED(hResult)); 
m_flashPlayer->DrawFrame(hDC); 

이 ...

void CFlashDXPlayer::DrawFrame(HDC dc) 
{ 
if (m_dirtyFlag) 
{ 
    IViewObject* pViewObject = NULL; 
    m_flashInterface->QueryInterface(IID_IViewObject, (LPVOID*) &pViewObject); 
    if (pViewObject != NULL) 
    { 
     // Combine regions 
     HRGN unionRgn, first, second = NULL; 
     unionRgn = CreateRectRgnIndirect(&m_dirtyRects[0]); 
     if (m_dirtyRects.size() >= 2) 
      second = CreateRectRgn(0, 0, 1, 1); 

     for (std::vector<RECT>::iterator it = m_dirtyRects.begin() + 1; it != m_dirtyRects.end(); ++it) 
     { 
      // Fill combined region 
      first = unionRgn; 
      SetRectRgn(second, it->left, it->top, it->right, it->bottom); 
      unionRgn = CreateRectRgn(0, 0, 1, 1); 

      CombineRgn(unionRgn, first, second, RGN_OR); 
      DeleteObject(first); 
     } 

     if (second) 
      DeleteObject(second); 

     RECT clipRgnRect; GetRgnBox(unionRgn, &clipRgnRect); 
     RECTL clipRect = { 0, 0, m_width, m_height }; 

     // Fill background 
     if (m_transpMode != TMODE_FULL_ALPHA) 
     { 
      // Set clip region 
      SelectClipRgn(dc, unionRgn); 

      COLORREF fillColor = GetBackgroundColor(); 
      HBRUSH fillColorBrush = CreateSolidBrush(fillColor); 
      FillRgn(dc, unionRgn, fillColorBrush); 
      DeleteObject(fillColorBrush); 

      // Draw to main buffer 
      HRESULT hr = pViewObject->Draw(DVASPECT_TRANSPARENT, 1, NULL, NULL, NULL, dc, &clipRect, &clipRect, NULL, 0); 
      assert(SUCCEEDED(hr)); 
     } 
     else 
     { 
      if (m_alphaBlackDC == NULL) 
      { 
       // Create memory buffers 
       BITMAPINFOHEADER bih = {0}; 
       bih.biSize = sizeof(BITMAPINFOHEADER); 
       bih.biBitCount = 32; 
       bih.biCompression = BI_RGB; 
       bih.biPlanes = 1; 
       bih.biWidth = LONG(m_width); 
       bih.biHeight = -LONG(m_height); 

       m_alphaBlackDC = CreateCompatibleDC(dc); 
       m_alphaBlackBitmap = CreateDIBSection(m_alphaBlackDC, (BITMAPINFO*)&bih, DIB_RGB_COLORS, (void**)&m_alphaBlackBuffer, 0, 0); 
       SelectObject(m_alphaBlackDC, m_alphaBlackBitmap); 

       m_alphaWhiteDC = CreateCompatibleDC(dc); 
       m_alphaWhiteBitmap = CreateDIBSection(m_alphaWhiteDC, (BITMAPINFO*)&bih, DIB_RGB_COLORS, (void**)&m_alphaWhiteBuffer, 0, 0); 
       SelectObject(m_alphaWhiteDC, m_alphaWhiteBitmap); 
      } 

      HRESULT hr; 
      HBRUSH fillColorBrush; 

      // Render frame twice - against white and against black background to calculate alpha 
      SelectClipRgn(m_alphaBlackDC, unionRgn); 

      COLORREF blackColor = 0x00000000; 
      fillColorBrush = CreateSolidBrush(blackColor); 
      FillRgn(m_alphaBlackDC, unionRgn, fillColorBrush); 
      DeleteObject(fillColorBrush); 

      hr = pViewObject->Draw(DVASPECT_TRANSPARENT, 1, NULL, NULL, NULL, m_alphaBlackDC, &clipRect, &clipRect, NULL, 0); 
      assert(SUCCEEDED(hr)); 

      // White background 
      SelectClipRgn(m_alphaWhiteDC, unionRgn); 

      COLORREF whiteColor = 0x00FFFFFF; 
      fillColorBrush = CreateSolidBrush(whiteColor); 
      FillRgn(m_alphaWhiteDC, unionRgn, fillColorBrush); 
      DeleteObject(fillColorBrush); 

      hr = pViewObject->Draw(DVASPECT_TRANSPARENT, 1, NULL, NULL, NULL, m_alphaWhiteDC, &clipRect, &clipRect, NULL, 0); 
      assert(SUCCEEDED(hr)); 

      // Combine alpha 
      for (LONG y = clipRgnRect.top; y < clipRgnRect.bottom; ++y) 
      { 
       int offset = y * m_width * 4 + clipRgnRect.left * 4; 
       for (LONG x = clipRgnRect.left; x < clipRgnRect.right; ++x) 
       { 
        BYTE blackRed = m_alphaBlackBuffer[offset]; 
        BYTE whiteRed = m_alphaWhiteBuffer[offset]; 
        m_alphaBlackBuffer[offset + 3] = 255 - (whiteRed - blackRed); 
        offset += 4; 
       } 
      } 

      // Blit result to target DC 
      BitBlt(dc, clipRgnRect.left, clipRgnRect.top, 
        clipRgnRect.right - clipRgnRect.left, 
        clipRgnRect.bottom - clipRgnRect.top, 
        m_alphaBlackDC, clipRgnRect.left, clipRgnRect.top, SRCCOPY); 
     } 

     DeleteObject(unionRgn); 
     pViewObject->Release(); 
    } 

    m_dirtyFlag = false; 
    m_dirtyRects.clear(); 
    m_dirtyUnionRect.left = m_dirtyUnionRect.top = LONG_MAX; 
    m_dirtyUnionRect.right = m_dirtyUnionRect.bottom = -LONG_MAX; 
} 
} 

나는 또한 내가 설정하는 것이 언급해야한다을 m_flashTexture까지 다음 사용 :이 코드를 실행 할 때마다

D3D11_TEXTURE2D_DESC textureDesc;     
ZeroMemory(&textureDesc, sizeof(textureDesc));     
textureDesc.Width = width;     
textureDesc.Height = height;     
textureDesc.MipLevels = 1;     
textureDesc.ArraySize = 1;     
textureDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;     
textureDesc.SampleDesc.Count = 1;     
textureDesc.Usage = D3D11_USAGE_DEFAULT;     
textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE |  D3D11_BIND_RENDER_TARGET;     
textureDesc.MiscFlags = D3D11_RESOURCE_MISC_GDI_COMPATIBLE; 
HRESULT hr = device->CreateTexture2D(&textureDesc, NULL, &m_flashTexture); 

(거기에 더이지만, 다른 클래스의 무리에 묻혀있다, 다른 것이 유용 할 거라 생각하면 알려주세요.) flashPlayer-> drawFrame() 함수의 어딘가에서 발생하는 죽음의 블루 스크린을 얻습니다. 나는 무엇이 블루 스크린을 일으키는 지 전혀 모른다.

아이디어가 있거나 파란색 화면이 나타나는 것처럼 보이는 것이 있습니까?

감사합니다.

추가 정보 여기에

이 충돌의 결과가 사람이 무엇을 의미하는지 알고 있습니까

ADDITIONAL_DEBUG_TEXT: 
Use '!findthebuild' command to search for the target build information. 
If the build information is available, run '!findthebuild -s ; .reload' to set symbol path and load symbols. 

FAULTING_MODULE: fffff80002c01000 nt 

DEBUG_FLR_IMAGE_TIMESTAMP: 4d41a3e1 

READ_ADDRESS: unable to get nt!MmSpecialPoolStart 
unable to get nt!MmSpecialPoolEnd 
unable to get nt!MmPoolCodeStart 
unable to get nt!MmPoolCodeEnd 
fffff8814061c6a0 

FAULTING_IP: 
igdpmd64+15a878 
fffff880`0697c878 8b0408   mov  eax,dword ptr [rax+rcx] 

MM_INTERNAL_CODE: 5 

CUSTOMER_CRASH_COUNT: 1 

DEFAULT_BUCKET_ID: VISTA_DRIVER_FAULT 

BUGCHECK_STR: 0x50 

CURRENT_IRQL: 0 

LAST_CONTROL_TRANSFER: from fffff80002c283bf to fffff80002c7dc40 

STACK_TEXT: 
fffff880`0a7e5878 fffff800`02c283bf : 00000000`00000050 fffff881`4061c6a0 00000000`00000000  fffff880`0a7e59e0 : nt+0x7cc40 
fffff880`0a7e5880 00000000`00000050 : fffff881`4061c6a0 00000000`00000000 fffff880`0a7e59e0  00000000`00000005 : nt+0x273bf 
fffff880`0a7e5888 fffff881`4061c6a0 : 00000000`00000000 fffff880`0a7e59e0 00000000`00000005 00000000`00000000 : 0x50 
fffff880`0a7e5890 00000000`00000000 : fffff880`0a7e59e0 00000000`00000005 00000000`00000000 00000000`00000000 : 0xfffff881`4061c6a0 


STACK_COMMAND: .bugcheck ; kb 

FOLLOWUP_IP: 
igdpmd64+15a878 
fffff880`0697c878 8b0408   mov  eax,dword ptr [rax+rcx] 

SYMBOL_NAME: igdpmd64+15a878 

FOLLOWUP_NAME: MachineOwner 

MODULE_NAME: igdpmd64 

IMAGE_NAME: igdpmd64.sys 

BUCKET_ID: WRONG_SYMBOLS 

Followup: MachineOwner 

덤프입니까?

+1

비디오 드라이버를 업데이트 해 보셨습니까? 나는이 분야에 대해 잘 알고 있지는 않지만, DirectX만으로 잘못 사용 되더라도 블루 스크린을 유발할 수있는 것처럼 나에게는 소리가 나지 않습니다. –

+0

충돌에 가장 가까운 지점에 디버거를 기록하거나 단계를 밟을 방법이 없습니까? – Gubatron

+0

그래, 나는 그것을 시험해 보았다. 그리고 나는 그것이 내가 directx를 사용했던 방식이라고 생각하지 않을 것이라는 점에 동의한다 ... 당신은 그것이 단지 정상적인 오류라고 생각할 것이다. –

답변

0

사용자 공간 응용 프로그램을 작성하면 BSoD가 발생할 때마다 일부 커널 수준 코드 (Windows 커널 자체 또는 일부 드라이버)에 버그가 있습니다.이 경우 igdpmd64.sys). 간단히 말해서, OS는 어떤 상황에서도 결코 사용자 공간 응용 프로그램의 무언가로 인해 충돌이 발생해야합니다. 그래서 나는이 드라이버에 대한 업그레이드가 있는지 여부를 조사 할 것입니다.

그러나 DirectX를 잘못 사용하고이 드라이버 버그를 유발하는 코드에 버그가있을 가능성이 있습니다.

확실히, 나는 크래시를 유발하는 절대적으로 최소한의 완전한 프로그램을 만들려고 노력할 것입니다. 최소한 드라이버 작성자에게 제출할 수 있습니다.

관련 문제