summaryrefslogtreecommitdiff
path: root/scene/resources/shader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/shader.cpp')
-rw-r--r--scene/resources/shader.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index 862669ecd8..a9376faf62 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -36,7 +36,7 @@
Shader::Mode Shader::get_mode() const {
- return (Mode)VisualServer::get_singleton()->shader_get_mode(shader);
+ return mode;
}
void Shader::set_code( const String& p_vertex, const String& p_fragment, const String& p_light,int p_fragment_ofs,int p_light_ofs) {
@@ -203,6 +203,7 @@ void Shader::_bind_methods() {
Shader::Shader(Mode p_mode) {
+ mode=p_mode;
shader = VisualServer::get_singleton()->shader_create(VS::ShaderMode(p_mode));
params_cache_dirty=true;
}
@@ -218,7 +219,10 @@ Shader::~Shader() {
-RES ResourceFormatLoaderShader::load(const String &p_path,const String& p_original_path) {
+RES ResourceFormatLoaderShader::load(const String &p_path, const String& p_original_path, Error *r_error) {
+
+ if (r_error)
+ *r_error=ERR_FILE_CANT_OPEN;
String fragment_code;
String vertex_code;
@@ -234,6 +238,8 @@ RES ResourceFormatLoaderShader::load(const String &p_path,const String& p_origin
ERR_FAIL_COND_V(err,RES());
String base_path = p_path.get_base_dir();
+ if (r_error)
+ *r_error=ERR_FILE_CORRUPT;
Ref<Shader> shader;//( memnew( Shader ) );
@@ -434,6 +440,8 @@ RES ResourceFormatLoaderShader::load(const String &p_path,const String& p_origin
f->close();
memdelete(f);
+ if (r_error)
+ *r_error=OK;
return shader;
}