コード例 #1
0
RenderTarget *TextureManager::GenerateTexture(ShaderPSO *generationShader, uint32 width, uint32 height)
{
    RenderTarget *generationTarget = mDirect3DManager->GetContextManager()->CreateRenderTarget(width, height, DXGI_FORMAT_R16G16_FLOAT, true, 1, 1, 0);
    generationTarget->SetIsReady(false); //render targets are defaulted to ready, but it isn't really ready for usage until it's filled, so set not ready for now
    mDirect3DManager->GetContextManager()->GetGraphicsContext()->TransitionResource(generationTarget, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, true);

    GenerateTextureInfo generateInfo;
    generateInfo.GenerationFence = 0;
    generateInfo.GenerateTarget = generationTarget;
    generateInfo.GenerationShader = generationShader;
    mGeneratedTextures.Add(generateInfo);

    return generationTarget;
}