Example #1
0
        public void Initialize(int height, int width, IntPtr handle)
        {
            m_Height = height;
            m_Width  = width;

            m_Viewport.Width    = m_Width;
            m_Viewport.Height   = m_Height;
            m_Viewport.MaxDepth = 1.0f;

            m_SissorRect.Right  = m_Width;
            m_SissorRect.Bottom = m_Height;

#if DEBUG
            // enable the d3d12 debug layer
            DebugInterface.Get().EnableDebugLayer();
#endif
            m_DeviceContext = new Direct3D12.H1DX12DeviceContext();
            m_DeviceContext.Intialize();

            m_SwapChainDX12 = new Direct3D12.H1SwapChain(null, m_DeviceContext.MainCommandListPool);
            m_SwapChainDX12.Initialize(m_Width, m_Height, handle);

            // create Gen2Layer
#if SGD_DX12
            m_Gen2Layer = new Gen2Layer.H1Gen2Layer();
            m_Gen2Layer.Initialize();
#endif

            var cbvHeapDesc = new DescriptorHeapDescription()
            {
                DescriptorCount = 2,
                Flags           = DescriptorHeapFlags.ShaderVisible,
                Type            = DescriptorHeapType.ConstantBufferViewShaderResourceViewUnorderedAccessView
            };

            m_ConstantBufferViewHeap       = Device.CreateDescriptorHeap(cbvHeapDesc);
            m_ConstantBufferDescriptorSize = Device.GetDescriptorHandleIncrementSize(DescriptorHeapType.ConstantBufferViewShaderResourceViewUnorderedAccessView);

            // create resource manager
            m_ResourceManager = new H1GPUResourceManager();
            m_ResourceManager.Initialize(this); // set the owner as this renderer

            m_ShaderManager = new H1ShaderManager();
            m_ShaderManager.Initialize(this);

            // temp
            //m_TempStaticMesh = new H1StaticMesh(H1Global<H1AssimpImporter>.Instance.asset.GetModel(2));

            // load assets
            //LoadAssets();

            // setting for physics
            SettingForPhysics();
        }
Example #2
0
 // Initialize device context
 void InitializeDeviceContext()
 {
     // create & initialize device context
     m_DeviceContext = new Direct3D12.H1DX12DeviceContext();
     m_DeviceContext.Intialize();
 }