Vulkan Specification(Vulkan规范):第十四章 14.3 片元输出接口

当管线中存在片元着色阶段,片元着色器输出与当前subpass的输出附件之间 形成了一个接口。 片元着色器输出变量通过Location 和Component 修饰,与颜色附件匹配, 颜色附件由VkSubpassDescription 类型的数组指定, 该数据类型描述了片元着色器执行所在的subpass。

通过Output存储类型修饰,被OpEntryPoint 列举的 片元着色器输出变量 形成了 片元输出接口。 这些变量必须被不同的Location所修饰。 它们也可以被ComponentIndex 联合唯一修饰。 为了接口匹配:没有Component 修饰的变量被认为其隐式的 Component 为0, 没有Index修饰的变量被认为其有一个隐式的 Index,值为0.

一个片元着色器输出变量有唯一的 Location i 修饰, 颜色附件由pColorAttachments[i] 表示,若其被启用了,如混合中所描述的 在传递万blending单元之后,将被定向到颜色附件, Locations 的情况如 Location Assignment所述。

可用的片元输出locations数量由VkPhysicalDeviceLimits 数据结构的maxFragmentOutputAttachments 所指定。

Components of the output variables are assigned as described in Component Assignment. Output components identified as 0, 1, 2, and 3 will be directed to the R, G, B, and A inputs to the blending unit, respectively, or to the output attachment if blending is disabled. If two variables are placed within the same location, they must have the same underlying type (floating-point or integer). The input to blending or color attachment writes is undefined for components which do not correspond to a fragment shader output.

Index为0的片元输出被导向关联的对应Location的第一个blending单元输入。 Index为1的输出被导向对应的blending单元输入。

No component aliasing of output variables is allowed, that is there must not be two output variables which have the same location, component, and index, either explicitly declared or implied.

Output values written by a fragment shader must be declared with either OpTypeFloat or OpTypeInt, and a Width of 32. Composites of these types are also permitted. If the color attachment has a signed or unsigned normalized fixed-point format, color values are assumed to be floating-point and are converted to fixed-point as described in Conversion from Normalized Fixed-Point to Floating-Point; otherwise no type conversion is applied. If the type of the values written by the fragment shader do not match the format of the corresponding color attachment, the result is undefined for those components.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值