1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

TrueDyanmicBranchその2

Posted at

小改良したので備忘録

#Falseブロック

条件分岐のelseブロックを処理できるようにしてみた。
処理結果

	float4  Local0 = ProcessMaterialColorTextureLookup(Texture2DSampleBias(Material_Texture2D_0,Material_Texture2D_0Sampler,Parameters.TexCoords[0].xy,View_MaterialTextureMipBias));
	float  Local1 = (Local0.r - 0.50000000);
	float3  Local7 = 0.0;
	[branch]
	if(Local1 > 0.0){
	float4  Local2 = ProcessMaterialColorTextureLookup(Texture2DSampleBias(Material_Texture2D_1,Material_Texture2D_1Sampler,Parameters.TexCoords[0].xy,View_MaterialTextureMipBias));
	float4  Local3 = ProcessMaterialColorTextureLookup(Texture2DSampleBias(Material_Texture2D_2,Material_Texture2D_2Sampler,Parameters.TexCoords[0].xy,View_MaterialTextureMipBias));
	float3  Local4 = (Local2.rgb + Local3.rgb);
	float3  Local8 = 0.0;
	Local7 = Local4;
	}
	else{
	float4  Local5 = ProcessMaterialColorTextureLookup(Texture2DSampleBias(Material_Texture2D_3,Material_Texture2D_3Sampler,Parameters.TexCoords[0].xy,View_MaterialTextureMipBias));
	float3  Local6 = (Local5.rgb * Local0.rgb);
	Local7 = Local6;
	};
	float3  Local9 = (Local7 + Material_VectorExpressions[1].rgb);
	float4  Local10 = ProcessMaterialColorTextureLookup(Texture2DSampleBias(Material_Texture2D_4,Material_Texture2D_4Sampler,Parameters.TexCoords[0].xy,View_MaterialTextureMipBias));
	float  Local11 = (Local10.r - 0.20000000);

#divergent gradient error回避

仕組みの問題なので最適化を回避する

FRegexPattern TextureSampleUsingGradientPattern(TEXT("Texture.*SampleBias"));

で検索してさらに右辺値にローカル変数があるものを最適化から除外した

image.png

#計測

LandScapeのマテリアルからMIP0固定のテクスチャフェッチがなくなったのでちょっと引き気味のカメラで
DyanmicBranchのありなしで計測

画像のランドスケープだと茶色い部分がベースのレイヤーで動的分岐によって処理が端折られている部分です。

##ブランチなし

image.png

##ブランチあり

image.png

BasePassが4.5msから3.5msになった。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?