//---------------------------------------------------------------------------- void DX11GeometryShader::DisableUAView(ID3D11DeviceContext* context, unsigned int bindPoint) { if (mDXObject) { ID3D11Device* device = nullptr; context->GetDevice(&device); if (!device) { LogError("Cannot access device of context."); return; } if (device->GetFeatureLevel() == D3D_FEATURE_LEVEL_11_1) { ID3D11UnorderedAccessView* uaViews[1] = { nullptr }; unsigned int initialCounts[1] = { 0xFFFFFFFFu }; context->OMSetRenderTargetsAndUnorderedAccessViews( D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL, nullptr, nullptr, bindPoint, 1, uaViews, initialCounts); } else { LogError("D3D11.1 is required for UAVs in geometry shaders."); } device->Release(); } }
// Save all states that are changed by the font-wrapper when drawing a string HRESULT CFW1StateSaver::saveCurrentState(ID3D11DeviceContext *pContext) { if(m_savedState) releaseSavedState(); if(pContext == NULL) return E_INVALIDARG; ID3D11Device *pDevice; pContext->GetDevice(&pDevice); if(pDevice != NULL) { m_featureLevel = pDevice->GetFeatureLevel(); pDevice->Release(); } pContext->AddRef(); m_pContext = pContext; m_pContext->IAGetPrimitiveTopology(&m_primitiveTopology); m_pContext->IAGetInputLayout(&m_pInputLayout); m_pContext->OMGetBlendState(&m_pBlendState, m_blendFactor, &m_sampleMask); m_pContext->OMGetDepthStencilState(&m_pDepthStencilState, &m_stencilRef); m_pContext->RSGetState(&m_pRasterizerState); m_numVSClassInstances = 256; m_pContext->VSGetShader(&m_pVS, m_pVSClassInstances, &m_numVSClassInstances); m_pContext->VSGetConstantBuffers(0, 1, &m_pVSConstantBuffer); m_numPSClassInstances = 256; m_pContext->PSGetShader(&m_pPS, m_pPSClassInstances, &m_numPSClassInstances); m_pContext->PSGetShaderResources(0, 1, &m_pPSSRV); pContext->PSGetSamplers(0, 1, &m_pSamplerState); if(m_featureLevel >= D3D_FEATURE_LEVEL_10_0) { m_numGSClassInstances = 256; m_pContext->GSGetShader(&m_pGS, m_pGSClassInstances, &m_numGSClassInstances); m_pContext->GSGetConstantBuffers(0, 1, &m_pGSConstantBuffer); m_pContext->GSGetShaderResources(0, 1, &m_pGSSRV); if(m_featureLevel >= D3D_FEATURE_LEVEL_11_0) { m_numHSClassInstances = 256; m_pContext->HSGetShader(&m_pHS, m_pHSClassInstances, &m_numHSClassInstances); m_numDSClassInstances = 256; m_pContext->DSGetShader(&m_pDS, m_pDSClassInstances, &m_numDSClassInstances); } } m_pContext->IAGetVertexBuffers(0, 1, &m_pVB, &m_vertexStride, &m_vertexOffset); m_pContext->IAGetIndexBuffer(&m_pIndexBuffer, &m_indexFormat, &m_indexOffset); m_savedState = true; return S_OK; }