mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWeb/WebGL: Implement getShaderPrecisionFormat
This commit is contained in:
parent
a14cd5dab8
commit
bf2b8c5f2b
Notes:
github-actions[bot]
2024-12-05 20:42:25 +00:00
Author: https://github.com/Lubrsi
Commit: bf2b8c5f2b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2791
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/shannonbooth
8 changed files with 59 additions and 11 deletions
|
@ -13,5 +13,6 @@ namespace Web::WebGL {
|
|||
|
||||
using GLenum = unsigned int;
|
||||
using GLuint = unsigned int;
|
||||
using GLint = int;
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#import <WebGL/WebGLObject.idl>
|
||||
#import <WebGL/WebGLProgram.idl>
|
||||
#import <WebGL/WebGLShader.idl>
|
||||
#import <WebGL/WebGLShaderPrecisionFormat.idl>
|
||||
#import <WebGL/WebGLTexture.idl>
|
||||
#import <WebGL/WebGLUniformLocation.idl>
|
||||
#import <WebGL/WebGLRenderbuffer.idl>
|
||||
|
@ -119,7 +120,7 @@ interface mixin WebGLRenderingContextBase {
|
|||
DOMString? getProgramInfoLog(WebGLProgram program);
|
||||
[FIXME] any getRenderbufferParameter(GLenum target, GLenum pname);
|
||||
any getShaderParameter(WebGLShader shader, GLenum pname);
|
||||
[FIXME] WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
|
||||
WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
|
||||
DOMString? getShaderInfoLog(WebGLShader shader);
|
||||
|
||||
[FIXME] DOMString? getShaderSource(WebGLShader shader);
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/WebGLShaderPrecisionFormatPrototype.h>
|
||||
#include <LibWeb/WebGL/WebGLShaderPrecisionFormat.h>
|
||||
|
||||
|
@ -11,11 +14,25 @@ namespace Web::WebGL {
|
|||
|
||||
GC_DEFINE_ALLOCATOR(WebGLShaderPrecisionFormat);
|
||||
|
||||
WebGLShaderPrecisionFormat::WebGLShaderPrecisionFormat(JS::Realm& realm)
|
||||
: WebGLObject(realm, 0)
|
||||
GC::Ref<WebGLShaderPrecisionFormat> WebGLShaderPrecisionFormat::create(JS::Realm& realm, GLint range_min, GLint range_max, GLint precision)
|
||||
{
|
||||
return realm.create<WebGLShaderPrecisionFormat>(realm, range_min, range_max, precision);
|
||||
}
|
||||
|
||||
WebGLShaderPrecisionFormat::WebGLShaderPrecisionFormat(JS::Realm& realm, GLint range_min, GLint range_max, GLint precision)
|
||||
: Bindings::PlatformObject(realm)
|
||||
, m_range_min(range_min)
|
||||
, m_range_max(range_max)
|
||||
, m_precision(precision)
|
||||
{
|
||||
}
|
||||
|
||||
WebGLShaderPrecisionFormat::~WebGLShaderPrecisionFormat() = default;
|
||||
|
||||
void WebGLShaderPrecisionFormat::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLShaderPrecisionFormat);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,24 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/WebGL/WebGLObject.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/WebGL/Types.h>
|
||||
|
||||
namespace Web::WebGL {
|
||||
|
||||
class WebGLShaderPrecisionFormat final : public WebGLObject {
|
||||
WEB_PLATFORM_OBJECT(WebGLShaderPrecisionFormat, WebGLObject);
|
||||
class WebGLShaderPrecisionFormat final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(WebGLShaderPrecisionFormat, Bindings::PlatformObject);
|
||||
GC_DECLARE_ALLOCATOR(WebGLShaderPrecisionFormat);
|
||||
|
||||
public:
|
||||
virtual ~WebGLShaderPrecisionFormat();
|
||||
static GC::Ref<WebGLShaderPrecisionFormat> create(JS::Realm& realm, GLint range_min, GLint range_max, GLint precision);
|
||||
|
||||
virtual ~WebGLShaderPrecisionFormat() override;
|
||||
|
||||
GLint range_min() const { return m_range_min; }
|
||||
GLint range_max() const { return m_range_max; }
|
||||
GLint precision() const { return m_precision; }
|
||||
|
||||
protected:
|
||||
explicit WebGLShaderPrecisionFormat(JS::Realm&);
|
||||
explicit WebGLShaderPrecisionFormat(JS::Realm&, GLint range_min, GLint range_max, GLint precision);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
private:
|
||||
GLint m_range_min { 0 };
|
||||
GLint m_range_max { 0 };
|
||||
GLint m_precision { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// https://registry.khronos.org/webgl/specs/latest/1.0/#5.12
|
||||
[Exposed=(Window,Worker)]
|
||||
interface WebGLShaderPrecisionFormat {
|
||||
[FIXME] readonly attribute GLint rangeMin;
|
||||
[FIXME] readonly attribute GLint rangeMax;
|
||||
[FIXME] readonly attribute GLint precision;
|
||||
readonly attribute GLint rangeMin;
|
||||
readonly attribute GLint rangeMax;
|
||||
readonly attribute GLint precision;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue