Fix compile errors for build with Cg enabled

This commit is contained in:
rdb 2009-07-02 15:12:17 +00:00
parent 2fe72f7a6b
commit dc6ccc27a1

View File

@ -1126,10 +1126,7 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps, ShaderType typ
CGprogram prog; CGprogram prog;
CGerror err; CGerror err;
const char *compiler_args[100]; const char *compiler_args[100];
const string text; const string text = get_text(type);
if (!_text->_separate) {
text = _text->_shared;
}
int nargs = 0; int nargs = 0;
int active, ultimate; int active, ultimate;
@ -1138,25 +1135,16 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps, ShaderType typ
case ST_vertex: case ST_vertex:
active = caps._active_vprofile; active = caps._active_vprofile;
ultimate = caps._ultimate_vprofile; ultimate = caps._ultimate_vprofile;
if (_text->_separate) {
text = _text._vertex;
}
break; break;
case ST_fragment: case ST_fragment:
active = caps._active_fprofile; active = caps._active_fprofile;
ultimate = caps._ultimate_fprofile; ultimate = caps._ultimate_fprofile;
if (_text->_separate) {
text = _text._fragment;
}
break; break;
case ST_geometry: case ST_geometry:
active = caps._active_gprofile; active = caps._active_gprofile;
ultimate = caps._ultimate_gprofile; ultimate = caps._ultimate_gprofile;
if (_text->_separate) {
text = _text._geometry;
}
break; break;
}; };
@ -1239,15 +1227,15 @@ cg_compile_shader(const ShaderCaps &caps) {
return false; return false;
} }
if (!_text->_separate || !_text._vertex.empty()) { if (!_text->_separate || !_text->_vertex.empty()) {
_cg_vprogram = cg_compile_entry_point("vshader", caps, ST_vertex); _cg_vprogram = cg_compile_entry_point("vshader", caps, ST_vertex);
} }
if (!_text->_separate || !_text._fragment.empty()) { if (!_text->_separate || !_text->_fragment.empty()) {
_cg_fprogram = cg_compile_entry_point("fshader", caps, ST_fragment); _cg_fprogram = cg_compile_entry_point("fshader", caps, ST_fragment);
} }
if ((_text->_separate && !_text._geometry.empty()) || (!_text->_separate && _text.find("gshader") != -1)) { if ((_text->_separate && !_text->_geometry.empty()) || (!_text->_separate && _text->_shared.find("gshader") != -1)) {
_cg_gprogram = cg_compile_entry_point("gshader", caps, ST_geometry); _cg_gprogram = cg_compile_entry_point("gshader", caps, ST_geometry);
} }