ps_bestindex.fx

来自「about the basic GA in the VC++ using GPU」· FX 代码 · 共 40 行

FX
40
字号


float4 PS_Sub_Max(float2 pos: TEXCOORD0) : COLOR
{ 
	
	float2 Tex = pos + float2(0.0019607843 , 0.0019607843);
	float temp1 = tex2D(ColorMapSamplerSub,Tex).r;
	float temp2 = tex2D(ColorMapSamplerSub,Tex + float2(pw,0)).r;
	float temp3 = tex2D(ColorMapSamplerSub,Tex + float2(0,ph)).r;
	float temp4 = tex2D(ColorMapSamplerSub,Tex + float2(pw,ph)).r;
	
	float3 temp = tex2D(ColorMapSamplerSub,Tex).rgb;

	if(temp1 < temp2)
	{
		temp = tex2D(ColorMapSamplerSub,Tex + float2(pw,0)).rgb;
		temp1 = temp2;
	}
	if(temp1 < temp3)
	{
		temp = tex2D(ColorMapSamplerSub,Tex + float2(0,ph)).rgb;
		temp1 = temp3;
	}
	if(temp1 < temp4)
	{
		temp = tex2D(ColorMapSamplerSub,Tex + float2(pw,ph)).rgb;
		temp1 = temp4;
	}
    return float4(temp,0);
}

technique TShader_Sub
{
    pass P0
    {
        Sampler[0] = (ColorMapSamplerSub);		
        PixelShader  = compile ps_2_0 PS_Sub_Max();
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?