hlsl SV_POSITION
今绘制三角形一直不显示:
后对比给出的例子发现是 PixelShader输入的Position应定义为 SV_POSITION而不是POSITION
msdn上SV_POSITION的描述:
1.When used in a pixel shader, SV_Position describes the pixel location.
2.Available for read/write in the vertex shader and geometry shader.
3.The pixel shader can use it as read only to get the pixel center with a 0.5 offset.
1:SV_POSITION描述像素点的位置。 疑问:从VSShader变换World\View\Projection,投影矩阵变换后, 归一化裁剪, 映射匹配长宽都是系统做的了?
2.geometry shader的作用?
3.在Pixel shader里权限是只读sv_position, 得到像素中心点(position的0.5偏移)
读写是在vertexShader和geometryShader