mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 07:09:47 +00:00
LibWeb/WebGL2: Implement EXT_color_buffer_float extension
This makes the Point Of Sale model on https://www.shopify.com/ have colour instead of being completely black.
This commit is contained in:
parent
31853c13d3
commit
9ca25eed7f
Notes:
github-actions[bot]
2025-03-06 12:00:25 +00:00
Author: https://github.com/Lubrsi
Commit: 9ca25eed7f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3820
8 changed files with 99 additions and 0 deletions
42
Libraries/LibWeb/WebGL/Extensions/EXTColorBufferFloat.cpp
Normal file
42
Libraries/LibWeb/WebGL/Extensions/EXTColorBufferFloat.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/Bindings/EXTColorBufferFloatPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/WebGL/Extensions/EXTColorBufferFloat.h>
|
||||
#include <LibWeb/WebGL/OpenGLContext.h>
|
||||
#include <LibWeb/WebGL/WebGL2RenderingContext.h>
|
||||
|
||||
namespace Web::WebGL::Extensions {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(EXTColorBufferFloat);
|
||||
|
||||
JS::ThrowCompletionOr<GC::Ptr<EXTColorBufferFloat>> EXTColorBufferFloat::create(JS::Realm& realm, GC::Ref<WebGL2RenderingContext> context)
|
||||
{
|
||||
return realm.create<EXTColorBufferFloat>(realm, context);
|
||||
}
|
||||
|
||||
EXTColorBufferFloat::EXTColorBufferFloat(JS::Realm& realm, GC::Ref<WebGL2RenderingContext> context)
|
||||
: PlatformObject(realm)
|
||||
, m_context(context)
|
||||
{
|
||||
m_context->context().request_extension("GL_EXT_color_buffer_float");
|
||||
}
|
||||
|
||||
void EXTColorBufferFloat::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(EXTColorBufferFloat);
|
||||
}
|
||||
|
||||
void EXTColorBufferFloat::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_context);
|
||||
}
|
||||
|
||||
}
|
31
Libraries/LibWeb/WebGL/Extensions/EXTColorBufferFloat.h
Normal file
31
Libraries/LibWeb/WebGL/Extensions/EXTColorBufferFloat.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::WebGL::Extensions {
|
||||
|
||||
class EXTColorBufferFloat : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(EXTColorBufferFloat, Bindings::PlatformObject);
|
||||
GC_DECLARE_ALLOCATOR(EXTColorBufferFloat);
|
||||
|
||||
public:
|
||||
static JS::ThrowCompletionOr<GC::Ptr<EXTColorBufferFloat>> create(JS::Realm&, GC::Ref<WebGL2RenderingContext>);
|
||||
|
||||
protected:
|
||||
void initialize(JS::Realm&) override;
|
||||
void visit_edges(Visitor&) override;
|
||||
|
||||
private:
|
||||
EXTColorBufferFloat(JS::Realm&, GC::Ref<WebGL2RenderingContext>);
|
||||
|
||||
GC::Ref<WebGL2RenderingContext> m_context;
|
||||
};
|
||||
|
||||
}
|
11
Libraries/LibWeb/WebGL/Extensions/EXTColorBufferFloat.idl
Normal file
11
Libraries/LibWeb/WebGL/Extensions/EXTColorBufferFloat.idl
Normal file
|
@ -0,0 +1,11 @@
|
|||
#import <WebGL/Types.idl>
|
||||
|
||||
// https://registry.khronos.org/webgl/extensions/EXT_color_buffer_float/
|
||||
// NOTE: Original EXT_color_buffer_float name is changed to title case,
|
||||
// so it matches corresponding C++ class name, and does not require
|
||||
// IDL generator to handle snake_case to TitleCase conversion.
|
||||
// Having a different name is totally fine, because LegacyNoInterfaceObject
|
||||
// prevents the name from being exposed to JavaScript.
|
||||
[Exposed=(Window,Worker), LegacyNoInterfaceObject]
|
||||
interface EXTColorBufferFloat {
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue