Fix scissoring crash. Also prevent crash when GLSL is not supported.

This commit is contained in:
rdb 2014-10-27 16:09:33 +00:00
parent d7b21c9aeb
commit d3947d4b01
1 changed files with 10 additions and 14 deletions

View File

@ -4357,16 +4357,19 @@ prepare_shader(Shader *se) {
ShaderContext *result = NULL;
switch (se->get_language()) {
case Shader::SL_GLSL:
result = new CLP(ShaderContext)(this, se);
break;
#if defined(HAVE_CG) && !defined(OPENGLES)
case Shader::SL_Cg:
result = new CLP(CgShaderContext)(this, se);
break;
#endif
case Shader::SL_GLSL:
if (_supports_glsl) {
result = new CLP(ShaderContext)(this, se);
break;
}
// Fall through.
default:
GLCAT.error()
<< "Tried to load shader with unsupported shader language!\n";
@ -11710,16 +11713,9 @@ void CLP(GraphicsStateGuardian)::
do_issue_scissor() {
const ScissorAttrib *target_scissor = DCAST(ScissorAttrib, _target_rs->get_attrib_def(ScissorAttrib::get_class_slot()));
if (target_scissor->is_off() && !_current_display_region->get_scissor_enabled()) {
if (_scissor_enabled) {
if (GLCAT.is_spam()) {
GLCAT.spam()
<< "glDisable(GL_SCISSOR_TEST)\n";
}
glDisable(GL_SCISSOR_TEST);
_scissor_enabled = false;
}
} else {
if (!target_scissor->is_off()) {
// A non-off ScissorAttrib means to override the scissor setting
// that was specified by the DisplayRegion.
if (!_scissor_enabled) {
if (GLCAT.is_spam()) {
GLCAT.spam()