コード例 #1
0
	bool UpdateApplication( IGameApp& game )
	{
		EngineProfiling::Update();

		float DeltaTime = Graphics::GetFrameTime();
	
		GameInput::Update(DeltaTime);
		EngineTuning::Update(DeltaTime);
		
		game.Update(DeltaTime);
		game.RenderScene();

		PostEffects::Render();

		if (TestGenerateMips)
		{
			GraphicsContext& MipsContext = GraphicsContext::Begin();

			// Exclude from timings this copy necessary to setup the test
			MipsContext.CopySubresource(g_GenMipsBuffer, 0, g_SceneColorBuffer, 0);

			EngineProfiling::BeginBlock(L"GenerateMipMaps()", &MipsContext);
			g_GenMipsBuffer.GenerateMipMaps(MipsContext);
			EngineProfiling::EndBlock(&MipsContext);

			MipsContext.Finish();
		}

		// Xbox One has an separate image plane that we use for UI.  It will composite with the
		// main image plane, so we need to clear it each from (assuming it's being dynamically
		// updated.)

		GraphicsContext& UiContext = GraphicsContext::Begin(L"Render UI");
		UiContext.ClearColor(g_OverlayBuffer);
		UiContext.SetRenderTarget(g_OverlayBuffer);
		UiContext.SetViewportAndScissor(0, 0, g_OverlayBuffer.GetWidth(), g_OverlayBuffer.GetHeight());
		game.RenderUI(UiContext);

		EngineTuning::Display( UiContext, 10.0f, 40.0f, 1900.0f, 1040.0f );

		UiContext.Finish();

		Graphics::Present();

		if (GameInput::IsFirstPressed(GameInput::kKey_escape))
		{
			return false; // shutdown
		}
		return true;
	}
コード例 #2
0
    bool UpdateApplication( IGameApp& game )
    {
        EngineProfiling::Update();

        float DeltaTime = Graphics::GetFrameTime();
    
        GameInput::Update(DeltaTime);
        EngineTuning::Update(DeltaTime);
        
        game.Update(DeltaTime);
        game.RenderScene();

        PostEffects::Render();

        if (TestGenerateMips)
        {
            GraphicsContext& MipsContext = GraphicsContext::Begin();

            // Exclude from timings this copy necessary to setup the test
            MipsContext.TransitionResource(g_SceneColorBuffer, D3D12_RESOURCE_STATE_GENERIC_READ);
            MipsContext.TransitionResource(g_GenMipsBuffer, D3D12_RESOURCE_STATE_COPY_DEST);
            MipsContext.CopySubresource(g_GenMipsBuffer, 0, g_SceneColorBuffer, 0);

            EngineProfiling::BeginBlock(L"GenerateMipMaps()", &MipsContext);
            g_GenMipsBuffer.GenerateMipMaps(MipsContext);
            EngineProfiling::EndBlock(&MipsContext);

            MipsContext.Finish();
        }

        GraphicsContext& UiContext = GraphicsContext::Begin(L"Render UI");
        UiContext.TransitionResource(g_OverlayBuffer, D3D12_RESOURCE_STATE_RENDER_TARGET, true);
        UiContext.ClearColor(g_OverlayBuffer);
        UiContext.SetRenderTarget(g_OverlayBuffer.GetRTV());
        UiContext.SetViewportAndScissor(0, 0, g_OverlayBuffer.GetWidth(), g_OverlayBuffer.GetHeight());
        game.RenderUI(UiContext);

        EngineTuning::Display( UiContext, 10.0f, 40.0f, 1900.0f, 1040.0f );

        UiContext.Finish();

        Graphics::Present();

        return !game.IsDone();
    }
コード例 #3
0
    void TerminateApplication( IGameApp& game )
    {
        game.Cleanup();

        GameInput::Shutdown();
    }