[英]How do I pass half to a vertex shader?
The D3D11 Input Element Description
has a field that specifies the format. D3D11 Input Element Description
有一个指定格式的字段。
How can I pass half
s (eg DXGI_FORMAT_R16_FLOAT
) to the Input assembler when we have float
(ie 32 bit fp) only on the CPU side?当我们仅在 CPU 端有
float
(即 32 位 fp)时,如何将half
s(例如DXGI_FORMAT_R16_FLOAT
)传递给 Input 汇编程序?
The half-precision format used by Direct3D is pretty standard these days.现在 Direct3D 使用的半精度格式非常标准。
https://en.wikipedia.org/wiki/Half-precision_floating-point_format https://en.wikipedia.org/wiki/Half-precision_floating-point_format
The DirectXMath library has built-in functions for converting to/from half-precision: DirectXMath库具有用于转换为/从半精度转换的内置函数:
XMHALF and XMConvertHalfToFloat and XMConvertFloatToHalf XMHALF和 XMConvertHalfToFloat 和 XMConvertFloatToHalf
XMHALF2 and the Load/Store functions for it. XMHALF2及其加载/存储功能。
XMHALF4 and the Load/Store functions for it. XMHALF4及其加载/存储功能。
There is also a F16C (also known as CVT16) intrinsic for doing the conversions, but you can really only count on them with systems that support AVX2 (or fixed platforms like Xbox One which has AVX but also F16C).
还有一个 F16C(也称为 CVT16)用于进行转换,但你真的只能依靠支持 AVX2 的系统(或像 Xbox One 这样有 AVX 和 F16C 的固定平台)。 See this blog post for more details.
有关更多详细信息,请参阅此博客文章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.