【发布时间】:2016-02-11 19:52:28
【问题描述】:
我的渲染器支持 2 种顶点格式:
typedef struct
{
packed_float3 position;
packed_float2 texcoord;
packed_float3 normal;
packed_float4 tangent;
packed_float4 color;
} vertex_ptntc;
typedef struct
{
packed_float3 position;
packed_float2 texcoord;
packed_float4 color;
} vertex_ptc;
我的着色器库的一个顶点着色器签名如下:
vertex ColorInOut unlit_vertex(device vertex_ptc* vertex_array [[ buffer(0) ]],
constant uniforms_t& uniforms [[ buffer(1) ]],
unsigned int vid [[ vertex_id ]])
此着色器渲染的一些网格将使用一种格式,而另一些则使用另一种格式。我如何支持这两种格式?此着色器仅使用 vertex_ptc 中的属性。我必须编写另一个顶点着色器吗?
【问题讨论】:
标签: ios macos graphics 3d metal