我尝试编译一些像素着色器示例。但它们都给出相同的错误消息。

“无法将着色器模型 3.0 与早期着色器模型混合。如果顶点着色器或像素着色器被编译为 3.0,则它们都必须是。”

问题似乎是像素着色器使用 ps_3_0 并且 sprite 批处理具有早期版本。

technique MyTechnique
{
    pass
    {
        PixelShader = compile ps_3_0 Mandelbrot_PixelShader();
    }
}

http://blogs.msdn.com/b/shawnhar/archive/2006/12/11/sixty-fractals-per-second.aspx http://blogs.msdn.com/b/shawnhar/archive/2010/04/05/spritebatch-and-custom-shaders-in-xna-game-studio-4-0.aspx

有帮助吗?

解决方案

您必须使用 3.0 版本重新编译顶点着色器。您可以从以下位置获取 XNA 的默认着色器 http://create.msdn.com/en-US/education/catalog/sample/stock_effects 从那里复制代码,但将顶点着色器的版本设置为 vs_3_0。

大多数 GPU 都会默默地转换版本,所以你有点不走运。:)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top