2025-01-28 18:25:26 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2026-03-04 22:46:06 +01:00
|
|
|
#include <GLES2/gl2.h>
|
|
|
|
|
#include <GLES2/gl2ext.h>
|
|
|
|
|
|
2025-01-28 18:25:26 +00:00
|
|
|
#include <LibJS/Runtime/Realm.h>
|
|
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
|
|
|
#include <LibWeb/Bindings/WebGLCompressedTextureS3tcPrototype.h>
|
|
|
|
|
#include <LibWeb/WebGL/Extensions/WebGLCompressedTextureS3tc.h>
|
|
|
|
|
#include <LibWeb/WebGL/OpenGLContext.h>
|
2026-03-05 19:37:33 +01:00
|
|
|
#include <LibWeb/WebGL/WebGLRenderingContextBase.h>
|
2025-01-28 18:25:26 +00:00
|
|
|
|
|
|
|
|
namespace Web::WebGL::Extensions {
|
|
|
|
|
|
|
|
|
|
GC_DEFINE_ALLOCATOR(WebGLCompressedTextureS3tc);
|
|
|
|
|
|
2026-03-05 20:47:29 +01:00
|
|
|
JS::ThrowCompletionOr<GC::Ref<JS::Object>> WebGLCompressedTextureS3tc::create(JS::Realm& realm, GC::Ref<WebGLRenderingContextBase> context)
|
2025-01-28 18:25:26 +00:00
|
|
|
{
|
|
|
|
|
return realm.create<WebGLCompressedTextureS3tc>(realm, context);
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-01 22:01:17 +01:00
|
|
|
WebGLCompressedTextureS3tc::WebGLCompressedTextureS3tc(JS::Realm& realm, GC::Ref<WebGLRenderingContextBase> context)
|
2025-01-28 18:25:26 +00:00
|
|
|
: PlatformObject(realm)
|
|
|
|
|
, m_context(context)
|
|
|
|
|
{
|
2026-03-04 22:46:06 +01:00
|
|
|
m_context->enable_compressed_texture_format(GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
|
|
|
|
|
m_context->enable_compressed_texture_format(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT);
|
|
|
|
|
m_context->enable_compressed_texture_format(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT);
|
|
|
|
|
m_context->enable_compressed_texture_format(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT);
|
2025-01-28 18:25:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WebGLCompressedTextureS3tc::initialize(JS::Realm& realm)
|
|
|
|
|
{
|
|
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLCompressedTextureS3tc);
|
2025-04-20 16:22:57 +02:00
|
|
|
Base::initialize(realm);
|
2025-01-28 18:25:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WebGLCompressedTextureS3tc::visit_edges(Visitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
Base::visit_edges(visitor);
|
2025-12-01 22:01:17 +01:00
|
|
|
visitor.visit(m_context);
|
2025-01-28 18:25:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|