1
在我的應用程序中,沒有截錐體剔除,無論如何都沒有繪製相機看不到的對象。當相機沒有看物體時,我的fps在我的android設備上接近60。當它看着這些物體時,我的fps下降到大約15.在Android上使用像素着色器時,巨大的FPS下降
因此我認爲這是我的像素着色器的問題。因爲我使用monogame,所以着色器實際上是用directx着色器模型3.0編寫的。以下是我的紋理採樣器聲明和我的像素着色器。 (這是唯一使用的像素着色器)
texture2D tex1;
sampler2D tex1Sampler = sampler_state
{
Texture = <tex1>;
MinFilter = Point;
MagFilter = Point;
MipFilter = Point;
AddressU = Clamp;
AddressV = Clamp;
};
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
float4 color = tex2D(tex1Sampler,input.Texture);
clip(color.a - .12f);
color *= input.Tint;
return color;
}
什麼導致這個FPS下降?其他一些信息:使用的紋理大小爲250 x 250,這是我測試中使用的唯一紋理。
這也不是什麼荒謬的事情,就像十億個三角形都排在後面並且沒有啓用背面剔除。它只有1000個小三角形在場景中,這不應該是不合理的。