1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:07:45 +00:00

LibGL: Return white texel when sampling uninitialized texture

This commit is contained in:
Stephan Unverwerth 2021-08-16 18:22:06 +02:00 committed by Andreas Kling
parent 894d81c1b8
commit 59998ff0b2
2 changed files with 5 additions and 2 deletions

View file

@ -42,8 +42,8 @@ public:
} }
private: private:
GLsizei m_width; GLsizei m_width { 0 };
GLsizei m_height; GLsizei m_height { 0 };
Vector<u32> m_pixel_data; Vector<u32> m_pixel_data;
}; };
} }

View file

@ -57,6 +57,9 @@ FloatVector4 Sampler2D::sample(FloatVector2 const& uv) const
MipMap const& mip = m_texture.mipmap(lod); MipMap const& mip = m_texture.mipmap(lod);
if (mip.width() < 1 || mip.height() < 1)
return { 1, 1, 1, 1 };
float x = wrap(uv.x(), m_wrap_t_mode); float x = wrap(uv.x(), m_wrap_t_mode);
float y = wrap(uv.y(), m_wrap_s_mode); float y = wrap(uv.y(), m_wrap_s_mode);