[][src]Module web_glitz::extensions::color_buffer_float

Allows images that use a floating point internal format to be attached to render targets.

Allows images that use the following internal formats to be attached to a [RenderTargetDescriptor] or [MultisampleRenderTargetDescriptor]:

This extension uses an Extended wrapper type to act as a type proof for the availability of this extension without requiring additional runtime checks when attaching extended images.

Example

use web_glitz::extensions::color_buffer_float::Extension as ColorBufferFloatExtension;
use web_glitz::image::MipmapLevels;
use web_glitz::image::format::RGBA32F;
use web_glitz::image::texture_2d::Texture2DDescriptor;
use web_glitz::rendering::{RenderTargetDescriptor, LoadOp, StoreOp};

let extension: Option<ColorBufferFloatExtension> = context.get_extension();

if let Some(extension) = extension {
    let mut texture = context.try_create_texture_2d(&Texture2DDescriptor{
        format: RGBA32F,
        width: 500,
        height: 500,
        levels: MipmapLevels::Partial(1)
    }).unwrap();

    let render_target_descriptor = RenderTargetDescriptor::new()
        .attach_color_float(
            extension.extend(texture.base_level_mut()), // Extend the image reference
            LoadOp::Load,
            StoreOp::Store
        );

    let render_target = context.create_render_target(render_target_descriptor);
}

Here context is a [RenderingContext].

Structs

Extended

Wrapper type for attachable images that acts as a type proof for the availability of this extension, allowing the attachment of images that use a floating point internal format.

Extension

Extension object for the [color_buffer_float] extension.

Traits

FloatRenderable

Marker trait for internal image format types for which this extension enables rendering.