简体   繁体   English

如何将一半传递给顶点着色器?

[英]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.

相关问题 如何将顶点位置传递给我的顶点着色器。 我写了一个不会在屏幕上绘制任何内容的着色器 - How can I pass the vertices position to my vertex shader. I wrote a shader that is not drawing anything to the screen 我如何从wavefront .obj文件获取索引的顶点位置和索引的顶点法线到OpenGL顶点着色器中? - How do I get indexed vertex positions AND indexed vertex normals from wavefront .obj file into an OpenGL vertex shader? 使用 glDrawElements 时如何将法线传递给 GLSL 中的顶点着色器 - How to pass normals to a Vertex Shader in GLSL when using glDrawElements 如何将每个顶点属性传递给GLSL Shader - How To Pass Per-Vertex Attributes to GLSL Shader 如何在JOGL中编辑顶点着色器 - How to edit vertex shader in JOGL 如何传递适用于所有顶点的顶点着色器动态数据? - How to pass to a vertex-shader dynamic data that should apply for all vertices? 如何将变量(非均匀)浮点值从C ++传递到顶点着色器OpenGL ES 2.0 - How pass a variable ( not uniform) float value from c++ to a vertex shader OpenGL ES 2.0 在这种情况下我应该使用顶点着色器吗? - Should I use a vertex shader in this situation? 如何在不更改数据的情况下将 3D VkImage 传递给计算着色器? - How do I pass a 3D VkImage to a compute shader without the data changing? 如何在顶点着色器中使用LookAt矩阵 - How to use LookAt matrix in vertex shader
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM