@@ -8,6 +8,7 @@ import { isBuiltin } from '../../data/attributes.ts';
88import { type Disarray , getCustomLocation } from '../../data/dataTypes.ts' ;
99import { sizeOf } from '../../data/sizeOf.ts' ;
1010import { type ResolvedSnippet , snip } from '../../data/snippet.ts' ;
11+ import type { WgslTexture } from '../../data/texture.ts' ;
1112import {
1213 type AnyWgslData ,
1314 isWgslData ,
@@ -46,7 +47,12 @@ import type { TgpuVertexFn } from '../function/tgpuVertexFn.ts';
4647import { namespace } from '../resolve/namespace.ts' ;
4748import type { ExperimentalTgpuRoot } from '../root/rootTypes.ts' ;
4849import type { TgpuSlot } from '../slot/slotTypes.ts' ;
49- import { isTexture , type TgpuTexture } from '../texture/texture.ts' ;
50+ import {
51+ isTexture ,
52+ isTextureView ,
53+ type TgpuTexture ,
54+ type TgpuTextureView ,
55+ } from '../texture/texture.ts' ;
5056import type { RenderFlag } from '../texture/usageExtension.ts' ;
5157import { connectAttributesToShader } from '../vertexLayout/connectAttributesToShader.ts' ;
5258import {
@@ -155,7 +161,10 @@ export interface ColorAttachment {
155161 * A {@link GPUTextureView} describing the texture subresource that will be output to for this
156162 * color attachment.
157163 */
158- view : ( TgpuTexture & RenderFlag ) | GPUTextureView ;
164+ view :
165+ | ( TgpuTexture & RenderFlag )
166+ | GPUTextureView
167+ | TgpuTextureView < WgslTexture > ;
159168 /**
160169 * Indicates the depth slice index of {@link GPUTextureViewDimension#"3d"} {@link GPURenderPassColorAttachment#view}
161170 * that will be output to for this color attachment.
@@ -506,6 +515,13 @@ class TgpuRenderPipelineImpl implements TgpuRenderPipeline {
506515 } ;
507516 }
508517
518+ if ( isTextureView ( attachment . view ) ) {
519+ return {
520+ ...attachment ,
521+ view : branch . unwrap ( attachment . view ) ,
522+ } ;
523+ }
524+
509525 return attachment ;
510526 } ) as GPURenderPassColorAttachment [ ]
511527 : [ null ] ;
0 commit comments