Changeset 95081 in vbox
- Timestamp:
- May 24, 2022 5:24:22 PM (3 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/d3d11main.cpp
r94469 r95081 32 32 virtual ID3D11DeviceContext *ImmediateContext(); 33 33 virtual ID3D11RenderTargetView *RenderTargetView(); 34 virtual ID3D11DepthStencilView *DepthStencilView(); 34 35 35 36 private: … … 58 59 IDXGIResource *pDxgiResource; /* Interface of the render target. */ 59 60 IDXGIKeyedMutex *pDXGIKeyedMutex; /* Synchronization interface for the render device. */ 61 ID3D11Texture2D *pDepthStencilBuffer; 62 ID3D11DepthStencilView *pDepthStencilView; 60 63 } mRender; 61 64 … … 192 195 D3D_FEATURE_LEVEL_11_1, 193 196 D3D_FEATURE_LEVEL_11_0, 197 D3D_FEATURE_LEVEL_10_1, 198 D3D_FEATURE_LEVEL_10_0, 194 199 D3D_FEATURE_LEVEL_9_3, 200 D3D_FEATURE_LEVEL_9_2, 201 D3D_FEATURE_LEVEL_9_1 195 202 }; 196 203 UINT Flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; … … 200 207 D3D_FEATURE_LEVEL FeatureLevel = D3D_FEATURE_LEVEL_9_1; 201 208 202 HTEST(D3D11CreateDevice(pAdapter, 203 D3D_DRIVER_TYPE_HARDWARE, 204 NULL, 205 Flags, 206 aFeatureLevels, 207 RT_ELEMENTS(aFeatureLevels), 208 D3D11_SDK_VERSION, 209 ppDevice, 210 &FeatureLevel, 211 ppImmediateContext)); 209 hr = D3D11CreateDevice(pAdapter, 210 D3D_DRIVER_TYPE_HARDWARE, 211 NULL, 212 Flags, 213 aFeatureLevels, 214 RT_ELEMENTS(aFeatureLevels), 215 D3D11_SDK_VERSION, 216 ppDevice, 217 &FeatureLevel, 218 ppImmediateContext); 219 if (FAILED(hr) && RT_BOOL(Flags & D3D11_CREATE_DEVICE_DEBUG)) 220 { 221 /* Device creation may fail because _DEBUG flag requires "D3D11 SDK Layers for Windows 10" ("Graphics Tools"): 222 * Settings/System/Apps/Optional features/Add a feature/Graphics Tools 223 * Retry without the flag. 224 */ 225 Flags &= ~D3D11_CREATE_DEVICE_DEBUG; 226 hr = D3D11CreateDevice(pAdapter, 227 D3D_DRIVER_TYPE_HARDWARE, 228 NULL, 229 Flags, 230 aFeatureLevels, 231 RT_ELEMENTS(aFeatureLevels), 232 D3D11_SDK_VERSION, 233 ppDevice, 234 &FeatureLevel, 235 ppImmediateContext); 236 } 237 D3DAssertHR(hr); 212 238 213 239 if (FeatureLevel != D3D_FEATURE_LEVEL_11_1) 214 240 { 215 D3DTestShowError(hr, "FeatureLevel"); 241 char s[128]; 242 sprintf(s, "Feature level %x", FeatureLevel); 243 D3DTestShowError(hr, s); 216 244 } 217 245 … … 272 300 273 301 HTEST(mRender.pRenderTarget->QueryInterface(__uuidof(IDXGIKeyedMutex), (LPVOID*)&mRender.pDXGIKeyedMutex)); 302 303 D3D11_TEXTURE2D_DESC depthStencilDesc; 304 depthStencilDesc.Width = 800; 305 depthStencilDesc.Height = 600; 306 depthStencilDesc.MipLevels = 1; 307 depthStencilDesc.ArraySize = 1; 308 depthStencilDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; 309 depthStencilDesc.SampleDesc.Count = 1; 310 depthStencilDesc.SampleDesc.Quality = 0; 311 depthStencilDesc.Usage = D3D11_USAGE_DEFAULT; 312 depthStencilDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL; 313 depthStencilDesc.CPUAccessFlags = 0; 314 depthStencilDesc.MiscFlags = 0; 315 316 HTEST(mRender.pDevice->CreateTexture2D(&depthStencilDesc, 0, &mRender.pDepthStencilBuffer)); 317 HTEST(mRender.pDevice->CreateDepthStencilView(mRender.pDepthStencilBuffer, 0, &mRender.pDepthStencilView)); 274 318 } 275 319 … … 465 509 * Use the shared texture from the render device. 466 510 */ 467 mRender.pImmediateContext->OMSetRenderTargets(1, &mRender.pRenderTargetView, NULL);511 mRender.pImmediateContext->OMSetRenderTargets(1, &mRender.pRenderTargetView, mRender.pDepthStencilView); 468 512 mpRender->DoRender(this); 469 513 } … … 545 589 } 546 590 591 ID3D11DepthStencilView *D3D11Test::DepthStencilView() 592 { 593 return mRender.pDepthStencilView; 594 } 595 547 596 int WINAPI WinMain(HINSTANCE hInstance, 548 597 HINSTANCE hPrevInstance, -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/d3d11render.cpp
r94469 r95081 270 270 FLOAT aColor[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; 271 271 pImmediateContext->ClearRenderTargetView(pDP->RenderTargetView(), aColor); 272 if (pDP->DepthStencilView()) 273 pImmediateContext->ClearDepthStencilView(pDP->DepthStencilView(), 274 D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0); 272 275 273 276 pImmediateContext->IASetInputLayout(mpInputLayout); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/d3d11render.h
r93115 r95081 60 60 virtual ID3D11DeviceContext *ImmediateContext() = 0; 61 61 virtual ID3D11RenderTargetView *RenderTargetView() = 0; 62 virtual ID3D11DepthStencilView *DepthStencilView() = 0; 62 63 }; 63 64
Note:
See TracChangeset
for help on using the changeset viewer.