Merge remote-tracking branch 'origin/master' into walldriving

This commit is contained in:
Benau 2016-09-04 11:56:28 +08:00
commit 23a49d5245
4 changed files with 23 additions and 16 deletions

View File

@ -1,5 +1,7 @@
#version 300 es
precision mediump float;
in vec3 Position;
in vec2 Texcoord;
out vec2 uv;

View File

@ -535,7 +535,8 @@ void IrrDriver::initDevice()
// pipeline doesn't work for them. For example some radeon drivers
// support only GLSL 1.3 and it causes STK to crash. We should force to use
// fixed pipeline in this case.
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FORCE_LEGACY_DEVICE))
if (!ProfileWorld::isNoGraphics() &&
GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FORCE_LEGACY_DEVICE))
{
Log::warn("irr_driver", "Driver doesn't support shader-based pipeline. "
"Re-creating device to workaround the issue.");

View File

@ -62,7 +62,7 @@ const std::string& ShaderBase::getHeader()
GLuint ShaderBase::loadShader(const std::string &file, unsigned type)
{
GLuint id = glCreateShader(type);
std::ostringstream code;
#if !defined(USE_GLES2)
code << "#version " << CVS->getGLSLVersion()<<"\n";
@ -87,13 +87,13 @@ GLuint ShaderBase::loadShader(const std::string &file, unsigned type)
code << "#extension GL_ARB_arrays_of_arrays : enable\n";
}
#endif
if (CVS->isAMDVertexShaderLayerUsable())
code << "#extension GL_AMD_vertex_shader_layer : enable\n";
if (CVS->isARBExplicitAttribLocationUsable())
code << "#extension GL_ARB_explicit_attrib_location : enable\n";
if (CVS->isAZDOEnabled())
{
code << "#extension GL_ARB_bindless_texture : enable\n";
@ -110,7 +110,11 @@ GLuint ShaderBase::loadShader(const std::string &file, unsigned type)
//shader compilation fails with some drivers if there is no precision qualifier
if (type == GL_FRAGMENT_SHADER)
code << "precision mediump float;\n";
#if defined(USE_GLES2)
else if (type == GL_VERTEX_SHADER)
code << "precision mediump float;\n";
#endif
code << getHeader();
std::ifstream stream(file_manager->getShader(file), std::ios::in);
@ -129,31 +133,31 @@ GLuint ShaderBase::loadShader(const std::string &file, unsigned type)
Log::error("shader", "Invalid #stk_include line: '%s'.", Line.c_str());
continue;
}
std::string filename = Line.substr(pos+1);
pos = filename.find("\"");
if (pos == std::string::npos)
{
Log::error("shader", "Invalid #stk_include line: '%s'.", Line.c_str());
continue;
}
filename = filename.substr(0, pos);
std::ifstream include_stream(file_manager->getShader(filename), std::ios::in);
if (!include_stream.is_open())
{
Log::error("shader", "Couldn't open included shader: '%s'.", filename.c_str());
continue;
}
std::string include_line = "";
while (getline(include_stream, include_line))
{
code << "\n" << include_line;
}
include_stream.close();
}
else
@ -161,7 +165,7 @@ GLuint ShaderBase::loadShader(const std::string &file, unsigned type)
code << "\n" << Line;
}
}
stream.close();
}
else
@ -201,7 +205,7 @@ GLuint ShaderBase::loadShader(const std::string &file, unsigned type)
/** Loads a transform feedback buffer shader with a given number of varying
* parameters.
*/
int ShaderBase::loadTFBProgram(const std::string &shader_name,
int ShaderBase::loadTFBProgram(const std::string &shader_name,
const char **varyings,
unsigned varying_count)
{
@ -250,7 +254,7 @@ void ShaderBase::bypassUBO() const
glUniformMatrix4fv(IPM, 1, GL_FALSE, irr_driver->getInvProjMatrix().pointer());
GLint Screen = glGetUniformLocation(m_program, "screen");
glUniform2f(Screen, irr_driver->getCurrentScreenSize().X,
glUniform2f(Screen, irr_driver->getCurrentScreenSize().X,
irr_driver->getCurrentScreenSize().Y);
GLint bLmn = glGetUniformLocation(m_program, "blueLmn[0]");

View File

@ -1007,7 +1007,7 @@ void World::update(float dt)
m_physics->update(dt);
}
PROFILER_PUSH_CPU_MARKER("World::update (Kart::upate)", 0x40, 0x7F, 0x00);
PROFILER_PUSH_CPU_MARKER("World::update (Kart::update)", 0x40, 0x7F, 0x00);
const int kart_amount = (int)m_karts.size();
for (int i = 0 ; i < kart_amount; ++i)
{