mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Move WebGL error variable to WebGLRenderingContextBase
Implementations in both WebGL1 and WebGL2 were the same and most probably will stay the same.
This commit is contained in:
parent
f6f238d15c
commit
e7aeb71d29
Notes:
github-actions[bot]
2025-11-06 18:04:42 +00:00
Author: https://github.com/cqundefine
Commit: e7aeb71d29
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6711
Reviewed-by: https://github.com/awesomekling
7 changed files with 15 additions and 27 deletions
|
|
@ -109,15 +109,6 @@ void WebGL2RenderingContext::needs_to_present()
|
|||
m_canvas_element->paintable()->set_needs_display();
|
||||
}
|
||||
|
||||
void WebGL2RenderingContext::set_error(GLenum error)
|
||||
{
|
||||
auto context_error = glGetError();
|
||||
if (context_error != GL_NO_ERROR)
|
||||
m_error = context_error;
|
||||
else
|
||||
m_error = error;
|
||||
}
|
||||
|
||||
bool WebGL2RenderingContext::is_context_lost() const
|
||||
{
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContext::is_context_lost()");
|
||||
|
|
|
|||
|
|
@ -82,8 +82,6 @@ private:
|
|||
// - clear, drawArrays, or drawElements has been called while the drawing buffer is the currently bound framebuffer
|
||||
bool m_should_present { true };
|
||||
|
||||
GLenum m_error { 0 };
|
||||
|
||||
Vector<WebIDL::UnsignedLong> m_enabled_compressed_texture_formats;
|
||||
|
||||
// Extensions
|
||||
|
|
@ -94,8 +92,6 @@ private:
|
|||
GC::Ptr<Extensions::EXTTextureNorm16> m_ext_texture_norm16;
|
||||
GC::Ptr<Extensions::WebGLCompressedTextureS3tc> m_webgl_compressed_texture_s3tc_extension;
|
||||
GC::Ptr<Extensions::WebGLCompressedTextureS3tcSrgb> m_webgl_compressed_texture_s3tc_srgb_extension;
|
||||
|
||||
virtual void set_error(GLenum error) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,15 +127,6 @@ void WebGLRenderingContext::needs_to_present()
|
|||
m_canvas_element->paintable()->set_needs_display();
|
||||
}
|
||||
|
||||
void WebGLRenderingContext::set_error(GLenum error)
|
||||
{
|
||||
auto context_error = glGetError();
|
||||
if (context_error != GL_NO_ERROR)
|
||||
m_error = context_error;
|
||||
else
|
||||
m_error = error;
|
||||
}
|
||||
|
||||
bool WebGLRenderingContext::is_context_lost() const
|
||||
{
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContext::is_context_lost()");
|
||||
|
|
|
|||
|
|
@ -81,8 +81,6 @@ private:
|
|||
// - clear, drawArrays, or drawElements has been called while the drawing buffer is the currently bound framebuffer
|
||||
bool m_should_present { true };
|
||||
|
||||
GLenum m_error { 0 };
|
||||
|
||||
Vector<WebIDL::UnsignedLong> m_enabled_compressed_texture_formats;
|
||||
|
||||
// Extensions
|
||||
|
|
@ -94,8 +92,6 @@ private:
|
|||
GC::Ptr<Extensions::WebGLCompressedTextureS3tc> m_webgl_compressed_texture_s3tc_extension;
|
||||
GC::Ptr<Extensions::WebGLCompressedTextureS3tcSrgb> m_webgl_compressed_texture_s3tc_srgb_extension;
|
||||
GC::Ptr<Extensions::WebGLDrawBuffers> m_webgl_draw_buffers_extension;
|
||||
|
||||
virtual void set_error(GLenum error) override;
|
||||
};
|
||||
|
||||
void fire_webgl_context_event(HTML::HTMLCanvasElement& canvas_element, FlyString const& type);
|
||||
|
|
|
|||
|
|
@ -195,4 +195,13 @@ Optional<WebGLRenderingContextBase::ConvertedTexture> WebGLRenderingContextBase:
|
|||
};
|
||||
}
|
||||
|
||||
void WebGLRenderingContextBase::set_error(GLenum error)
|
||||
{
|
||||
auto context_error = glGetError();
|
||||
if (context_error != GL_NO_ERROR)
|
||||
m_error = context_error;
|
||||
else
|
||||
m_error = error;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,6 +138,8 @@ protected:
|
|||
return result;
|
||||
}
|
||||
|
||||
void set_error(GLenum error);
|
||||
|
||||
// UNPACK_FLIP_Y_WEBGL of type boolean
|
||||
// If set, then during any subsequent calls to texImage2D or texSubImage2D, the source data is flipped along
|
||||
// the vertical axis, so that conceptually the last row is the first one transferred. The initial value is false.
|
||||
|
|
@ -149,6 +151,9 @@ protected:
|
|||
// if present, is multiplied into the color channels during the data transfer. The initial value is false.
|
||||
// Any non-zero value is interpreted as true.
|
||||
bool m_unpack_premultiply_alpha { false };
|
||||
|
||||
private:
|
||||
GLenum m_error { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
virtual void present() = 0;
|
||||
virtual void needs_to_present() = 0;
|
||||
virtual void set_error(GLenum) = 0;
|
||||
|
||||
void active_texture(WebIDL::UnsignedLong texture);
|
||||
void attach_shader(GC::Root<WebGLProgram> program, GC::Root<WebGLShader> shader);
|
||||
void bind_attrib_location(GC::Root<WebGLProgram> program, WebIDL::UnsignedLong index, String name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue