Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions packages/typegpu/src/core/pipeline/renderPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { isBuiltin } from '../../data/attributes.ts';
import { type Disarray, getCustomLocation } from '../../data/dataTypes.ts';
import { sizeOf } from '../../data/sizeOf.ts';
import { type ResolvedSnippet, snip } from '../../data/snippet.ts';
import type { WgslTexture } from '../../data/texture.ts';
import {
type AnyWgslData,
isWgslData,
Expand Down Expand Up @@ -46,7 +47,12 @@ import type { TgpuVertexFn } from '../function/tgpuVertexFn.ts';
import { namespace } from '../resolve/namespace.ts';
import type { ExperimentalTgpuRoot } from '../root/rootTypes.ts';
import type { TgpuSlot } from '../slot/slotTypes.ts';
import { isTexture, type TgpuTexture } from '../texture/texture.ts';
import {
isTexture,
isTextureView,
type TgpuTexture,
type TgpuTextureView,
} from '../texture/texture.ts';
import type { RenderFlag } from '../texture/usageExtension.ts';
import { connectAttributesToShader } from '../vertexLayout/connectAttributesToShader.ts';
import {
Expand Down Expand Up @@ -155,7 +161,10 @@ export interface ColorAttachment {
* A {@link GPUTextureView} describing the texture subresource that will be output to for this
* color attachment.
*/
view: (TgpuTexture & RenderFlag) | GPUTextureView;
view:
| (TgpuTexture & RenderFlag)
| GPUTextureView
| TgpuTextureView<WgslTexture>;
/**
* Indicates the depth slice index of {@link GPUTextureViewDimension#"3d"} {@link GPURenderPassColorAttachment#view}
* that will be output to for this color attachment.
Expand Down Expand Up @@ -506,6 +515,13 @@ class TgpuRenderPipelineImpl implements TgpuRenderPipeline {
};
}

if (isTextureView(attachment.view)) {
return {
...attachment,
view: branch.unwrap(attachment.view),
};
}

return attachment;
}) as GPURenderPassColorAttachment[]
: [null];
Expand Down