void VulkanQuad::InitializeImpl (VkCommandBuffer uploadCommandBuffer) { VulkanSample::InitializeImpl (uploadCommandBuffer); CreatePipelineStateObject (); CreateMeshBuffers (uploadCommandBuffer); }
void VulkanTexturedQuad::InitializeImpl(VkCommandBuffer uploadCommandBuffer) { VulkanSample::InitializeImpl(uploadCommandBuffer); CreateSampler (); CreateTexture (uploadCommandBuffer); CreateDescriptors (); CreatePipelineStateObject(); CreateMeshBuffers(uploadCommandBuffer); }
void CFXAPISample::Initialize () { window_.reset (new Window ("AMD CFX API test", 1920, 1080)); CreateDeviceAndSwapChain (); InitializeAMDCFXAPI (); CreateMeshBuffers (); D3D11_DEPTH_STENCIL_DESC dsDesc = {}; dsDesc.DepthEnable = false; dsDesc.DepthFunc = D3D11_COMPARISON_ALWAYS; device_->CreateDepthStencilState (&dsDesc, &depthStencilState_); ComPtr<ID3DBlob> vsCode, psCode; D3DCompileFromFile (L"..\\src\\Shaders\\shaders.hlsl", nullptr, nullptr, "VS_main", "vs_5_0", 0, 0, &vsCode, nullptr); D3DCompileFromFile (L"..\\src\\Shaders\\shaders.hlsl", nullptr, nullptr, "PS_main", "ps_5_0", 0, 0, &psCode, nullptr); D3D11_INPUT_ELEMENT_DESC layoutDesc[] = { {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0} }; device_->CreateVertexShader (vsCode->GetBufferPointer (), vsCode->GetBufferSize (), 0, &vertexShader_); device_->CreatePixelShader (psCode->GetBufferPointer (), psCode->GetBufferSize (), nullptr, &pixelShader_); device_->CreateInputLayout (layoutDesc, 2, vsCode->GetBufferPointer (), vsCode->GetBufferSize (), &inputLayout_); D3D11_TEXTURE2D_DESC textureDesc; textureDesc.ArraySize = 1; textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; textureDesc.CPUAccessFlags = 0; textureDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; textureDesc.Height = 1; textureDesc.MipLevels = 1; textureDesc.MiscFlags = 0; textureDesc.SampleDesc.Count = 1; textureDesc.SampleDesc.Quality = 0; textureDesc.Usage = D3D11_USAGE_DEFAULT; textureDesc.Width = 1; if (cfxEnabled_) { // Our texture is also a render target and is only updated every second // frame. Create it using the Crossfire API to enable transfers on it. agsDriverExtensions_CreateTexture2D (agsContext_, &textureDesc, nullptr, &texture_, // If set to TransferDisable, flickering will be present // as the updated version is not transfered to the second GPU. // With TransferApp1StepP2P, the Crossfire API will copy the // data to the second GPU. AGS_AFR_TRANSFER_1STEP_P2P); } else { device_->CreateTexture2D (&textureDesc, nullptr, &texture_); } device_->CreateShaderResourceView (texture_.Get (), nullptr, &textureSRV_); device_->CreateRenderTargetView (texture_.Get (), nullptr, &textureRTV_); textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE; device_->CreateTexture2D (&textureDesc, nullptr, &uploadTexture_); device_->CreateShaderResourceView (uploadTexture_.Get (), nullptr, &uploadTextureSRV_); }