Godot: Accessing transform matrices data in shader breaks it.

Created on 14 May 2017  路  8Comments  路  Source: godotengine/godot

Godot version: 3.0

Issue description:

vec4 test = WORLD_MATRIX.x;

When I type this line mesh transforms into big white artifact :)

bug rendering

Most helpful comment

ok, so, the problem is not the access to the WORLD_MATRIX but that autocomplete suggest all available things for the shader type without looking the function (vertex,fragment,etc.)?

All 8 comments

What I see (on ed6baffc7) fragment is 1200 lines of code in the terminal then:

ERROR: _display_error_with_code: SceneShaderGLES3: Fragment Program Compilation Failed:
0(882) : error C1008: undefined variable "world_transform"

   At: drivers/gles3/shader_gles3.cpp:167.
ERROR: get_current_version: SceneShaderGLES3: Fragment Program Compilation Failed:
0(882) : error C1008: undefined variable "world_transform"

   At: drivers/gles3/shader_gles3.cpp:455.
ERROR: get_current_version: Method/Function Failed, returning: __null
   At: drivers/gles3/shader_gles3.cpp:463.
ERROR: bind: Condition ' !version ' is true. returned: false
   At: drivers/gles3/shader_gles3.cpp:122.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
   At: drivers/gles3/shader_gles3.h:376.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
   At: drivers/gles3/shader_gles3.h:376.

Finally the classic spam:

mesege
ERROR: _gl_debug_print: GL ERROR: Source: OpenGL    Type: Error ID: 1282Severity: High  Message: GL_INVALID_OPERATION error generated. No active program.

Related to #8731 (missing shader variables)

in Godot 2.x, World Matrix can only use in Vertex Shader
http://docs.godotengine.org/en/stable/learning/features/shading/shading_language.html

I think it is same in Godot 3. ^^

@ippan but is there https://github.com/godotengine/godot/blob/4286aef69313e048fa91710c35456c08a252fd3c/servers/visual/shader_types.cpp#L72

So either should not be there or the shader compiler does not have the correct setup to use it (incorrect name or something).

shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["WORLD_MATRIX"] = ShaderLanguage::TYPE_MAT4;

WORLD_MATRIX is in the Vertex Shader, and the error is happen in Fragment Shader

Fragment Program Compilation Failed

@ippan I think you are right, I'm hitting again the "new shader" crash :upside_down_face:

ok, so, the problem is not the access to the WORLD_MATRIX but that autocomplete suggest all available things for the shader type without looking the function (vertex,fragment,etc.)?

in 3.0 it's in a UBO, so it can be accessed from everywhere

was just checking and this is fixed, so closing.

Was this page helpful?
0 / 5 - 0 ratings