Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused "mNormal" uniform to fix crash on GLES2 with shaders #13843

Merged
merged 1 commit into from
Sep 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/client/shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ class MainShaderConstantSetter : public IShaderConstantSetter
CachedVertexShaderSetting<float, 16> m_world_view;
// Texture matrix
CachedVertexShaderSetting<float, 16> m_texture;
// Normal matrix
CachedVertexShaderSetting<float, 9> m_normal;

public:
MainShaderConstantSetter() :
Expand All @@ -256,7 +254,6 @@ class MainShaderConstantSetter : public IShaderConstantSetter
, m_perspective_zbias_pixel("zPerspectiveBias")
, m_world_view("mWorldView")
, m_texture("mTexture")
, m_normal("mNormal")
{}
~MainShaderConstantSetter() = default;

Expand All @@ -283,16 +280,6 @@ class MainShaderConstantSetter : public IShaderConstantSetter
core::matrix4 texture = driver->getTransform(video::ETS_TEXTURE_0);
m_world_view.set(*reinterpret_cast<float(*)[16]>(worldView.pointer()), services);
m_texture.set(*reinterpret_cast<float(*)[16]>(texture.pointer()), services);

core::matrix4 normal;
worldView.getTransposed(normal);
sanity_check(normal.makeInverse());
float m[9] = {
normal[0], normal[1], normal[2],
normal[4], normal[5], normal[6],
normal[8], normal[9], normal[10],
};
m_normal.set(m, services);
}

// Set uniforms for Shadow shader
Expand Down Expand Up @@ -639,7 +626,6 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
uniform highp mat4 mWorldView;
uniform highp mat4 mWorldViewProj;
uniform mediump mat4 mTexture;
uniform mediump mat3 mNormal;

attribute highp vec4 inVertexPosition;
attribute lowp vec4 inVertexColor;
Expand All @@ -662,7 +648,6 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
#define mWorldView gl_ModelViewMatrix
#define mWorldViewProj gl_ModelViewProjectionMatrix
#define mTexture (gl_TextureMatrix[0])
#define mNormal gl_NormalMatrix

#define inVertexPosition gl_Vertex
#define inVertexColor gl_Color
Expand Down