Пример #1
0
//----------------------------------------------------------------------------
PerformanceAMDWindow::PerformanceAMDWindow(Parameters& parameters)
    :
    Window(parameters),
    mTextColor({ 0.0f, 0.0f, 0.0f, 1.0f }),
    mPerformance(mEngine->GetDevice())
{
    if (!SetEnvironment())
    {
        parameters.created = false;
        return;
    }

    CreateCamera();
    CreateTextureGenerator();
    CreateScene();

    // Disable back-face culling.
    mNoCullingState.reset(new RasterizerState());
    mNoCullingState->cullMode = RasterizerState::CULL_NONE;
    mEngine->SetRasterizerState(mNoCullingState);

    mPerformance.SaveCounterInformation("AMD7970Counters.txt");
    mPerformance.Register(Listener);
    mPerformance.SetAllCounters();

    UpdateCW();
}
//----------------------------------------------------------------------------
PerformanceAMDWindow::PerformanceAMDWindow(Parameters& parameters)
    :
    Window(parameters),
    mTextColor(0.0f, 0.0f, 0.0f, 1.0f),
    mPerformance(mEngine->GetDevice())
{
    std::string gtpath = mEnvironment.GetVariable("GTE_PATH");
    if (gtpath == "")
    {
        LogError("You must create the environment variable GTE_PATH.");
        parameters.created = false;
        return;
    }
    mEnvironment.Insert(gtpath + "/Samples/Basics/PerformanceAMD/Shaders/");
    mEnvironment.Insert(gtpath + "/Samples/#Data/");
    if (mEnvironment.GetPath("GenerateTexture.hlsl") == "")
    {
        LogError("Cannot find file GenerateTexture.hlsl.");
        parameters.created = false;
        return;
    }
    if (mEnvironment.GetPath("MedicineBag.jpg") == "")
    {
        LogError("Cannot find file MedicineBag.jpg.");
        parameters.created = false;
        return;
    }

    CreateCamera();
    CreateTextureGenerator();
    CreateScene();

    // Disable back-face culling.
    mNoCullingState.reset(new RasterizerState());
    mNoCullingState->cullMode = RasterizerState::CULL_NONE;
    mEngine->SetRasterizerState(mNoCullingState);

    mPerformance.SaveCounterInformation("AMD7970Counters.txt");
    mPerformance.Register(Listener);
    mPerformance.SetAllCounters();
}