/* * Decompiled with CFR 0.152. */ package com.mojang.blaze3d.resource; import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.pipeline.TextureTarget; import com.mojang.blaze3d.resource.ResourceDescriptor; import com.mojang.blaze3d.systems.RenderSystem; public record RenderTargetDescriptor(int width, int height, boolean useDepth, int clearColor) implements ResourceDescriptor { @Override public RenderTarget allocate() { return new TextureTarget(null, this.width, this.height, this.useDepth); } @Override public void prepare(RenderTarget resource) { if (this.useDepth) { RenderSystem.getDevice().createCommandEncoder().clearColorAndDepthTextures(resource.getColorTexture(), this.clearColor, resource.getDepthTexture(), 1.0); } else { RenderSystem.getDevice().createCommandEncoder().clearColorTexture(resource.getColorTexture(), this.clearColor); } } @Override public void free(RenderTarget resource) { resource.destroyBuffers(); } @Override public boolean canUsePhysicalResource(ResourceDescriptor other) { if (other instanceof RenderTargetDescriptor) { RenderTargetDescriptor descriptor = (RenderTargetDescriptor)other; return this.width == descriptor.width && this.height == descriptor.height && this.useDepth == descriptor.useDepth; } return false; } }