Merge remote-tracking branch 'remotes/upstrem/master' into hd-textures-option

Conflicts:
	data/gui/custom_video_settings.stkgui
	src/states_screens/dialogs/custom_video_settings.cpp
This commit is contained in:
Guillaume P
2014-05-03 10:32:47 +02:00
7 changed files with 64 additions and 11 deletions

View File

@@ -125,12 +125,30 @@
<spacer height="4" width="10" />
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="dof"/>
<spacer width="10" height="10"/>
<label text="Depth of field" I18N="Video settings"/>
</div>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="hd-textures"/>
<spacer width="10" height="10"/>
<label text="Use high definition textures" I18N="Video settings"/>
</div>
<spacer height="4" width="10" />
<!--
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="anim_gfx"/>
<spacer width="10" height="10"/>
<label text="Animated Scenery" I18N="Video settings"/>
</div>
-->
</div>
<spacer height="20" width="10" />

View File

@@ -463,6 +463,7 @@ void IrrDriver::initDevice()
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
gl_driver->extGlGenQueries(1, &m_lensflare_query);
gl_driver->extGlGenQueries(Q_LAST, m_perf_query);
m_query_issued = false;
scene::IMesh * const sphere = m_scene_manager->getGeometryCreator()->createSphereMesh(1, 16, 16);

View File

@@ -74,6 +74,15 @@ enum STKRenderingPass
PASS_COUNT,
};
enum QueryPerf
{
Q_SOLID_PASS1,
Q_SOLID_PASS2,
Q_LIGHT,
Q_SHADOWS,
Q_LAST
};
/**
* \brief class that creates the irrLicht device and offers higher-level
* ways to manage the 3D scene
@@ -211,6 +220,7 @@ private:
unsigned object_count[PASS_COUNT];
u32 m_renderpass;
u32 m_lensflare_query;
u32 m_perf_query[Q_LAST];
bool m_query_issued;
class STKMeshSceneNode *m_sun_interposer;
scene::CLensFlareSceneNode *m_lensflare;

View File

@@ -124,7 +124,7 @@ void IrrDriver::renderGLSL(float dt)
RaceGUIBase *rg = world->getRaceGUI();
if (rg) rg->update(dt);
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
for(unsigned int cam = 0; cam < Camera::getNumCameras(); cam++)
{
@@ -238,8 +238,6 @@ void IrrDriver::renderGLSL(float dt)
const bool hasgodrays = World::getWorld()->getTrack()->hasGodRays();
if (UserConfigParams::m_light_shaft && hasgodrays)//hasflare || hasgodrays)
{
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
GLuint res = 0;
if (m_query_issued)
gl_driver->extGlGetQueryObjectuiv(m_lensflare_query, GL_QUERY_RESULT, &res);
@@ -301,6 +299,13 @@ void IrrDriver::renderGLSL(float dt)
glDisable(GL_FRAMEBUFFER_SRGB);
PROFILER_POP_CPU_MARKER();
GLuint perf_query_res[Q_LAST];
for (unsigned i = 0; i < Q_LAST; i++)
{
gl_driver->extGlGetQueryObjectuiv(m_perf_query[i], GL_QUERY_RESULT, &perf_query_res[i]);
Log::info("GPU Perf", "Phase %d : %d us\n", i, perf_query_res[i] / 1000);
}
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
@@ -440,6 +445,8 @@ void IrrDriver::renderSolidFirstPass()
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::reset();
GroupedFPSM<FPSM_NORMAL_MAP>::reset();
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
gl_driver->extGlBeginQuery(GL_TIME_ELAPSED, m_perf_query[Q_SOLID_PASS1]);
m_scene_manager->drawAll(scene::ESNRP_SOLID);
if (!UserConfigParams::m_dynamic_lights)
@@ -460,6 +467,7 @@ void IrrDriver::renderSolidFirstPass()
{
drawNormalPass(*GroupedFPSM<FPSM_NORMAL_MAP>::MeshSet[i], GroupedFPSM<FPSM_NORMAL_MAP>::MVPSet[i], GroupedFPSM<FPSM_NORMAL_MAP>::TIMVSet[i]);
}
gl_driver->extGlEndQuery(GL_TIME_ELAPSED);
}
void IrrDriver::renderSolidSecondPass()
@@ -492,6 +500,8 @@ void IrrDriver::renderSolidSecondPass()
setTexture(0, m_rtts->getRenderTarget(RTT_TMP1), GL_NEAREST, GL_NEAREST);
setTexture(1, m_rtts->getRenderTarget(RTT_TMP2), GL_NEAREST, GL_NEAREST);
setTexture(2, m_rtts->getRenderTarget(RTT_SSAO), GL_NEAREST, GL_NEAREST);
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
gl_driver->extGlBeginQuery(GL_TIME_ELAPSED, m_perf_query[Q_SOLID_PASS2]);
m_scene_manager->drawAll(scene::ESNRP_SOLID);
glUseProgram(MeshShader::ObjectPass2Shader::Program);
@@ -525,6 +535,7 @@ void IrrDriver::renderSolidSecondPass()
glUseProgram(MeshShader::UntexturedObjectShader::Program);
for (unsigned i = 0; i < GroupedSM<SM_UNTEXTURED>::MeshSet.size(); i++)
drawUntexturedObject(*GroupedSM<SM_UNTEXTURED>::MeshSet[i], GroupedSM<SM_UNTEXTURED>::MVPSet[i]);
gl_driver->extGlEndQuery(GL_TIME_ELAPSED);
}
void IrrDriver::renderTransparent()
@@ -673,7 +684,10 @@ void IrrDriver::renderShadows(//ShadowImportanceProvider * const sicb,
glDrawBuffer(GL_NONE);
glBindBufferBase(GL_UNIFORM_BUFFER, 0, SharedObject::ViewProjectionMatrixesUBO);
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
gl_driver->extGlBeginQuery(GL_TIME_ELAPSED, m_perf_query[Q_SHADOWS]);
m_scene_manager->drawAll(scene::ESNRP_SOLID);
gl_driver->extGlEndQuery(GL_TIME_ELAPSED);
glDisable(GL_POLYGON_OFFSET_FILL);
@@ -893,6 +907,7 @@ void IrrDriver::renderLights(const core::aabbox3df& cambox,
const core::vector3df &campos =
irr_driver->getSceneManager()->getActiveCamera()->getAbsolutePosition();
gl_driver->extGlBeginQuery(GL_TIME_ELAPSED, m_perf_query[Q_LIGHT]);
std::vector<LightNode *> BucketedLN[15];
for (unsigned int i = 0; i < lightcount; i++)
{
@@ -972,6 +987,7 @@ void IrrDriver::renderLights(const core::aabbox3df& cambox,
irr_driver->getFBO(FBO_HALF1), irr_driver->getRenderTargetTexture(RTT_HALF1), UserConfigParams::m_width / 2, UserConfigParams::m_height / 2);
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
}
gl_driver->extGlEndQuery(GL_TIME_ELAPSED);
}
static void getXYZ(GLenum face, float i, float j, float &x, float &y, float &z)

View File

@@ -1627,6 +1627,7 @@ namespace MeshShader
void GrassShadowShader::init()
{
return;
Program = LoadProgram(
GL_VERTEX_SHADER, file_manager->getAsset("shaders/grass_pass.vert").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_unlit.frag").c_str());

View File

@@ -52,6 +52,7 @@ void CustomVideoSettingsDialog::beforeAddingWidgets()
getWidget<CheckBoxWidget>("anim_gfx")->setState( UserConfigParams::m_graphical_effects );
getWidget<CheckBoxWidget>("weather_gfx")->setState( UserConfigParams::m_weather_effects );
getWidget<CheckBoxWidget>("ubo")->setState(!UserConfigParams::m_ubo_disabled);
getWidget<CheckBoxWidget>("dof")->setState(UserConfigParams::m_dof);
getWidget<CheckBoxWidget>("hd-textures")->setState(UserConfigParams::m_high_definition_textures);
SpinnerWidget* kart_anim = getWidget<SpinnerWidget>("steering_animations");
@@ -103,12 +104,14 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
bool dynamic_light = getWidget<CheckBoxWidget>("dynamiclight")->getState();
UserConfigParams::m_dynamic_lights = dynamic_light;
UserConfigParams::m_graphical_effects =
UserConfigParams::m_graphical_effects =
getWidget<CheckBoxWidget>("anim_gfx")->getState();
UserConfigParams::m_weather_effects =
UserConfigParams::m_weather_effects =
getWidget<CheckBoxWidget>("weather_gfx")->getState();
UserConfigParams::m_ubo_disabled =
!getWidget<CheckBoxWidget>("ubo")->getState();
UserConfigParams::m_dof =
getWidget<CheckBoxWidget>("dof")->getState();
UserConfigParams::m_high_definition_textures =
getWidget<CheckBoxWidget>("hd-textures")->getState();

View File

@@ -59,6 +59,8 @@ struct GFXPreset
bool animatedScenery;
int animatedCharacters;
int anisotropy;
/** Depth of field */
bool dof;
};
static GFXPreset GFX_PRESETS[] =
@@ -66,31 +68,31 @@ static GFXPreset GFX_PRESETS[] =
{
false /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, false /* weather */,
false /* animatedScenery */, 0 /* animatedCharacters */, 0 /* anisotropy */
false /* animatedScenery */, 0 /* animatedCharacters */, 0 /* anisotropy */, false /* depth of field */
},
{
false /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, false /* weather */,
true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */
true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */, false /* depth of field */
},
{
true /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, true /* weather */,
true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */
true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */, false /* depth of field */
},
{
true /* light */, 0 /* shadow */, false /* bloom */, true /* motionblur */,
true /* lightshaft */, true /* glow */, true /* mlaa */, false /* ssao */, true /* weather */,
true /* animatedScenery */, 1 /* animatedCharacters */, 8 /* anisotropy */
true /* animatedScenery */, 1 /* animatedCharacters */, 8 /* anisotropy */, false /* depth of field */
},
{
true /* light */, 2 /* shadow */, true /* bloom */, true /* motionblur */,
true /* lightshaft */, true /* glow */, true /* mlaa */, true /* ssao */, true /* weather */,
true /* animatedScenery */, 2 /* animatedCharacters */, 8 /* anisotropy */
true /* animatedScenery */, 2 /* animatedCharacters */, 8 /* anisotropy */, true /* depth of field */
}
};
@@ -359,7 +361,8 @@ void OptionsScreenVideo::updateGfxSlider()
//GFX_PRESETS[l].shaders == UserConfigParams::m_pixel_shaders
GFX_PRESETS[l].shadows == UserConfigParams::m_shadows &&
GFX_PRESETS[l].ssao == UserConfigParams::m_ssao &&
GFX_PRESETS[l].weather == UserConfigParams::m_weather_effects)
GFX_PRESETS[l].weather == UserConfigParams::m_weather_effects &&
GFX_PRESETS[l].dof == UserConfigParams::m_dof)
{
gfx->setValue(l + 1);
found = true;
@@ -523,6 +526,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
UserConfigParams::m_shadows = GFX_PRESETS[level].shadows;
UserConfigParams::m_ssao = GFX_PRESETS[level].ssao;
UserConfigParams::m_weather_effects = GFX_PRESETS[level].weather;
UserConfigParams::m_dof = GFX_PRESETS[level].dof;
updateGfxSlider();
}