CG编程中的语义是什么? [英] What are the semantics in CG programming?

查看:49
本文介绍了CG编程中的语义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

msdn 陈述语义是附加到着色器输入或输出的字符串,用于传达有关参数预期用途的信息

msdn stated A semantic is a string attached to a shader input or output that conveys information about the intended use of a parameter

unity 声明Semantics 是 Cg 的一个特殊子句,用于定义片段/顶点着色器的默认输入值

unity stated Semantics is a special clause of Cg to define the default input values of a fragment/vertex Shader

实际语义是什么?我们为什么用它?有必要吗?

What are the actually semantics? why do we use it? It is necessary?

推荐答案

基本上它说明了存储在某个字段中的数据类型——位置、法线、纹理坐标等等.

Basically it tells what kind of data stored in certain field - position, normal, texture coordinates et cetera.

在固定函数管道中描述顶点格式很有用,但在可编程管道中语义是由着色器描述的,所以它在顶点格式中的定义可能没有意义(例如,着色器可能使用 TEXCOORD0 作为法线)但它仍然需要通过编译器.

It was useful to describe vertex format in fixed-function pipeline but in programmable pipeline semantics is described by shader, so its definition in vertex format may have no sense (for example, shader may use TEXCOORD0 as normals) yet it still required by compiler.

这篇关于CG编程中的语义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆