Commit 1f172390 authored by Chuck Walbourn's avatar Chuck Walbourn
Browse files

New XDK samples

parent 51fc1033
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ enum RootParameterIndex
{
    ConstantBuffer,
    TextureSRV,
    TextureSRV_2,
    Count
};

@@ -38,6 +39,7 @@ void FullScreenQuad::Initialize(_In_ ID3D12Device* d3dDevice)
        D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS;

    CD3DX12_DESCRIPTOR_RANGE textureSRVs(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0);
    CD3DX12_DESCRIPTOR_RANGE textureSRVs_2(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 1);

    CD3DX12_STATIC_SAMPLER_DESC sampler(
        0, // register
@@ -56,6 +58,7 @@ void FullScreenQuad::Initialize(_In_ ID3D12Device* d3dDevice)
    CD3DX12_ROOT_PARAMETER rootParameters[static_cast<uint32_t>(RootParameterIndex::Count)] = {};
    rootParameters[RootParameterIndex::ConstantBuffer].InitAsConstantBufferView(0, 0, D3D12_SHADER_VISIBILITY_PIXEL);
    rootParameters[RootParameterIndex::TextureSRV].InitAsDescriptorTable(1, &textureSRVs, D3D12_SHADER_VISIBILITY_PIXEL);
    rootParameters[RootParameterIndex::TextureSRV_2].InitAsDescriptorTable(1, &textureSRVs_2, D3D12_SHADER_VISIBILITY_PIXEL);

    CD3DX12_ROOT_SIGNATURE_DESC rootSignatureDesc;
    rootSignatureDesc.Init(_countof(rootParameters), rootParameters, 1, &sampler, rootSignatureFlags);
@@ -77,6 +80,24 @@ void FullScreenQuad::Draw(
    d3dCommandList->SetGraphicsRootSignature(m_d3dRootSignature.Get());
    d3dCommandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBuffer, constantBuffer);
    d3dCommandList->SetGraphicsRootDescriptorTable(RootParameterIndex::TextureSRV, texture);
    d3dCommandList->SetGraphicsRootDescriptorTable(RootParameterIndex::TextureSRV_2, texture);
    d3dCommandList->SetPipelineState(d3dPSO);
    d3dCommandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
    d3dCommandList->DrawInstanced(3, 1, 0, 0);
}

_Use_decl_annotations_
void FullScreenQuad::Draw(
    ID3D12GraphicsCommandList* d3dCommandList,
    ID3D12PipelineState* d3dPSO,
    D3D12_GPU_DESCRIPTOR_HANDLE texture,
    D3D12_GPU_DESCRIPTOR_HANDLE texture2,
    D3D12_GPU_VIRTUAL_ADDRESS constantBuffer)
{
    d3dCommandList->SetGraphicsRootSignature(m_d3dRootSignature.Get());
    d3dCommandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBuffer, constantBuffer);
    d3dCommandList->SetGraphicsRootDescriptorTable(RootParameterIndex::TextureSRV, texture);
    d3dCommandList->SetGraphicsRootDescriptorTable(RootParameterIndex::TextureSRV_2, texture2);
    d3dCommandList->SetPipelineState(d3dPSO);
    d3dCommandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
    d3dCommandList->DrawInstanced(3, 1, 0, 0);
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ namespace DX
    public:
        void Initialize(_In_ ID3D12Device* d3dDevice);
        void Draw(_In_ ID3D12GraphicsCommandList* d3dCommandList, _In_ ID3D12PipelineState* d3dPSO, D3D12_GPU_DESCRIPTOR_HANDLE texture, D3D12_GPU_VIRTUAL_ADDRESS constantBuffer = 0);
        void Draw(_In_ ID3D12GraphicsCommandList* d3dCommandList, _In_ ID3D12PipelineState* d3dPSO, D3D12_GPU_DESCRIPTOR_HANDLE texture, D3D12_GPU_DESCRIPTOR_HANDLE texture2, D3D12_GPU_VIRTUAL_ADDRESS constantBuffer = 0);

        void ReleaseDevice();

+2 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
    "            DENY_HULL_SHADER_ROOT_ACCESS )," \
    "CBV(b0, visibility = SHADER_VISIBILITY_PIXEL ), " \
    "DescriptorTable (SRV(t0), visibility = SHADER_VISIBILITY_PIXEL),"\
    "DescriptorTable (SRV(t1), visibility = SHADER_VISIBILITY_PIXEL),"\
    "StaticSampler(s0,"\
    "           filter =   FILTER_MIN_MAG_MIP_POINT,"\
    "           addressU = TEXTURE_ADDRESS_CLAMP,"\
+9 −0
Original line number Diff line number Diff line
@@ -200,6 +200,15 @@ This repo contains game development samples written by the Microsoft Xbox Advanc
 </tr>
</table>

<table>
 <tr>
  <td>Xbox One (XDK only)</td>
  <td><a href="XDKSamples/Graphics/AsyncPresent">AsyncPresent</a></td>
  <td><a href="XDKSamples/Graphics/HLSLSymbols">HLSL Symbols</a></td> 
  <td><a href="XDKSamples/Graphics/SimpleDmaDecompression">Simple DMA Decompression</a></td>
 </tr>
</table>

### System

<table>
+53.5 KiB
Loading image diff...
Loading