| 375 | } |
| 376 | |
| 377 | void MSAAFilter::RenderBackgroundVelocity() |
| 378 | { |
| 379 | PIXEvent pixEvent(L"Render Background Velocity"); |
| 380 | |
| 381 | ID3D11DeviceContextPtr context = deviceManager.ImmediateContext(); |
| 382 | |
| 383 | SetViewport(context, velocityTarget.Width, velocityTarget.Height); |
| 384 | |
| 385 | // Don't use camera translation for background velocity |
| 386 | FirstPersonCamera tempCamera = camera; |
| 387 | tempCamera.SetPosition(Float3(0.0f, 0.0f, 0.0f)); |
| 388 | |
| 389 | backgroundVelocityConstants.Data.InvViewProjection = Float4x4::Transpose(Float4x4::Invert(tempCamera.ViewProjectionMatrix())); |
| 390 | backgroundVelocityConstants.Data.PrevViewProjection = Float4x4::Transpose(prevViewProjection); |
| 391 | backgroundVelocityConstants.Data.RTSize.x = float(velocityTarget.Width); |
| 392 | backgroundVelocityConstants.Data.RTSize.y = float(velocityTarget.Height); |
| 393 | backgroundVelocityConstants.Data.JitterOffset = jitterOffset; |
| 394 | backgroundVelocityConstants.ApplyChanges(context); |
| 395 | backgroundVelocityConstants.SetPS(context, 0); |
| 396 | |
| 397 | prevViewProjection = tempCamera.ViewProjectionMatrix(); |
| 398 | |
| 399 | float blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; |
| 400 | context->OMSetBlendState(blendStates.BlendDisabled(), blendFactor, 0xFFFFFFFF); |
| 401 | context->OMSetDepthStencilState(depthStencilStates.DepthEnabled(), 0); |
| 402 | context->RSSetState(rasterizerStates.NoCull()); |
| 403 | |
| 404 | ID3D11RenderTargetView* rtvs[1] = { velocityTarget.RTView }; |
| 405 | context->OMSetRenderTargets(1, rtvs, depthBuffer.DSView); |
| 406 | |
| 407 | context->VSSetShader(backgroundVelocityVS, nullptr, 0); |
| 408 | context->PSSetShader(backgroundVelocityPS, nullptr, 0); |
| 409 | context->GSSetShader(nullptr, nullptr, 0); |
| 410 | context->HSSetShader(nullptr, nullptr, 0); |
| 411 | context->DSSetShader(nullptr, nullptr, 0); |
| 412 | |
| 413 | ID3D11Buffer* vbs[1] = { nullptr }; |
| 414 | UINT strides[1] = { 0 }; |
| 415 | UINT offsets[1] = { 0 }; |
| 416 | context->IASetVertexBuffers(0, 1, vbs, strides, offsets); |
| 417 | context->IASetInputLayout(nullptr); |
| 418 | context->IASetIndexBuffer(nullptr, DXGI_FORMAT_R16_UINT, 0); |
| 419 | context->Draw(3, 0); |
| 420 | |
| 421 | rtvs[0] = nullptr; |
| 422 | context->OMSetRenderTargets(1, rtvs, nullptr); |
| 423 | } |
| 424 | |
| 425 | void MSAAFilter::RenderHUD() |
| 426 | { |
nothing calls this directly
no test coverage detected