package com.mojang.blaze3d.systems; import com.mojang.blaze3d.textures.GpuTextureView; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.OptionalDouble; import java.util.function.Supplier; import org.joml.Vector4fc; import org.jspecify.annotations.Nullable; public class RenderPassDescriptor { private final Supplier label; public List>> colorAttachments = new ArrayList(); @Nullable public RenderPassDescriptor.Attachment depthAttachment; @Nullable public RenderPass.RenderArea renderArea; public static RenderPassDescriptor create(final Supplier label) { return new RenderPassDescriptor(label); } private RenderPassDescriptor(final Supplier label) { this.label = label; } public RenderPassDescriptor withColorAttachment(final GpuTextureView textureView) { this.colorAttachments.add(new RenderPassDescriptor.Attachment<>(textureView, Optional.empty())); return this; } public RenderPassDescriptor withColorAttachment(final GpuTextureView textureView, final Optional clearValue) { this.colorAttachments.add(new RenderPassDescriptor.Attachment<>(textureView, clearValue)); return this; } public RenderPassDescriptor withUnusedColorAttachment() { this.colorAttachments.add(null); return this; } public RenderPassDescriptor withDepthAttachment(final GpuTextureView textureView) { this.depthAttachment = new RenderPassDescriptor.Attachment<>(textureView, OptionalDouble.empty()); return this; } public RenderPassDescriptor withDepthAttachment(final GpuTextureView textureView, final OptionalDouble clearValue) { this.depthAttachment = new RenderPassDescriptor.Attachment<>(textureView, clearValue); return this; } public RenderPassDescriptor withRenderArea(final RenderPass.RenderArea renderArea) { this.renderArea = renderArea; return this; } public Supplier label() { return this.label; } public List>> colorAttachments() { return this.colorAttachments; } @Nullable public RenderPassDescriptor.Attachment depthAttachment() { return this.depthAttachment; } public record Attachment(GpuTextureView textureView, T clearValue) { } }