[Mesa-dev] [PATCH] mesa: don't enable NV_fragment_program_option with swrast

Dieter Nützel Dieter at nuetzel-hh.de
Mon Feb 16 09:59:31 PST 2015


Am 16.02.2015 18:13, schrieb Brian Paul:
> On 02/16/2015 08:11 AM, Roland Scheidegger wrote:
>> Am 16.02.2015 um 00:36 schrieb Matt Turner:
>>> On Sat, Feb 14, 2015 at 2:33 PM, Roland Scheidegger 
>>> <sroland at vmware.com> wrote:
>>>> Am 14.02.2015 um 21:12 schrieb Kenneth Graunke:
>>>>> On Saturday, February 14, 2015 04:37:25 PM sroland at vmware.com 
>>>>> wrote:
>>>>>> From: Roland Scheidegger <sroland at vmware.com>
>>>>>> 
>>>>>> Since dropping some NV_fragment_program opcodes (commits
>>>>>> 868f95f1da74cf6dd7468cba1b56664aad585ccb, 
>>>>>> a3688d686f147f4252d19b298ae26d4ac72c2e08)
>>>>>> we can no longer parse all opcodes necessary for this extension, 
>>>>>> leading
>>>>>> to bugs 
>>>>>> (https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D86980&d=AwICAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=WR7M0CMoTs3KQMrLGbBd33mSg7pYv21Om0yOzq27Swg&s=VVYgQUmxDRQ8b-H-36lfDVGUw4SFuqAVM1qfxbB71pc&e= 
>>>>>> ).
>>>>>> Hence don't announce support for it in swrast.
>>>>>> (The rest of the infrastructure ranging from dead opcodes (TXP_NV) 
>>>>>> to
>>>>>> parsing condition codes along with the NV_fragment_program_option 
>>>>>> variable
>>>>>> in the context could probably nuked too this is just a minimal fix 
>>>>>> appropriate
>>>>>> for stable too.)
>>>>>> ---
>>>>>>   src/mesa/main/extensions.c | 1 -
>>>>>>   1 file changed, 1 deletion(-)
>>>>>> 
>>>>>> diff --git a/src/mesa/main/extensions.c 
>>>>>> b/src/mesa/main/extensions.c
>>>>>> index 220b220..c94009f 100644
>>>>>> --- a/src/mesa/main/extensions.c
>>>>>> +++ b/src/mesa/main/extensions.c
>>>>>> @@ -511,7 +511,6 @@ _mesa_enable_sw_extensions(struct gl_context 
>>>>>> *ctx)
>>>>>>      ctx->Extensions.NV_point_sprite = GL_TRUE;
>>>>>>      ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
>>>>>>      ctx->Extensions.NV_texture_rectangle = GL_TRUE;
>>>>>> -   ctx->Extensions.NV_fragment_program_option = GL_TRUE;
>>>>>>      ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE;
>>>>>>      ctx->Extensions.OES_standard_derivatives = GL_TRUE;
>>>>>>      ctx->Extensions.TDFX_texture_compression_FXT1 = GL_TRUE;
>>>>>> 
>>>>> 
>>>>> Nuking this extension would make some compiler work I'm planning to 
>>>>> do
>>>>> easier, so I'd definitely be interested to hear whether you still 
>>>>> need
>>>>> it.
>>>>> 
>>>> 
>>>> Well, according to the git log specviewperf11 catia test won't run
>>>> correctly without supporting some bits from NV_program_option and
>>>> NV_fragment_program2 - obviously the benchmark doesn't care one bit 
>>>> if
>>>> the extension is actually officially supported by a driver or not.
> 
> Just to clarify, this is because the viewperf tests are basically
> application traces which get replayed, and unfortunately, viewperf
> doesn't even bother to check if the OpenGL driver supports the
> extensions which are used by the trace.  The traces were created with
> nvidia drivers.
> 
> 
>>>> I suspect this is something which we still need to be able to run,
>>>> though Brian would probably know the definitive answer.
>>> 
>>> If we knew specifically what it uses, maybe we can just support that
>>> instead of the whole extension? Not having to handle the condition
>>> code bits of the extension would be nice, for instance.
>>> 
>> 
>> There's definitely some bits around condition codes with IF/ELSE/ENDIF
>> needed (with NV_fp2/NV_vp3 even), though it seems there's some
>> differences to our private code there to make it work. Apart from that
>> I'm not entirely sure. Maybe we could expose it as an ordinary quirk 
>> to
>> make things more obvious but I've never dealt with that viewperf 
>> issue.
> 
> Here's an example of a fragment program from the catia-03 #3 test:
> 
> !!ARBfp1.0
> OPTION NV_fragment_program2;
> # cgc version 1.5.0023, build date Sep 26 2007 08:51:03
> # command line args:
> #vendor NVIDIA Corporation
> #version 1.5.0.23
> #profile fp40
> #program AdvancedHighlightPS
> #semantic AdvancedHighlightPS.iOutlineColor
> #semantic AdvancedHighlightPS.iHaloSize
> #semantic AdvancedHighlightPS.iHaloIntensity
> #semantic AdvancedHighlightPS.iHaloColor
> #semantic AdvancedHighlightPS.iScanEffectIntensity
> #semantic AdvancedHighlightPS.iScanEffectColor
> #semantic AdvancedHighlightPS.iInputTexture
> #semantic outlineColor
> #semantic haloColor
> #semantic haloIntensity
> #semantic haloSize
> #semantic scanEffectColor
> #semantic scanEffectIntensity
> #semantic inputTexture
> #semantic filterBlurData
> #semantic filterBlurDataLow
> #var float4 IN.ScreenPosition : $vin.TEXCOORD0 : TEX0 : 0 : 1
> #var float4 iOutlineColor :  : c[0] : 1 : 1
> #var float iHaloSize :  : c[1] : 2 : 1
> #var float iHaloIntensity :  : c[2] : 3 : 1
> #var float4 iHaloColor :  : c[3] : 4 : 1
> #var float iScanEffectIntensity :  :  : 5 : 0
> #var float4 iScanEffectColor :  : c[4] : 6 : 1
> #var samplerRECT iInputTexture :  : texunit 0 : 7 : 1
> #var float4 outlineColor :  :  : -1 : 0
> #var float4 haloColor :  :  : -1 : 0
> #var float haloIntensity :  :  : -1 : 0
> #var float haloSize :  :  : -1 : 0
> #var float4 scanEffectColor :  :  : -1 : 0
> #var float scanEffectIntensity :  :  : -1 : 0
> #var samplerRECT inputTexture :  :  : -1 : 0
> #var float2 filterBlurData[0] :  : c[5] : -1 : 1
> #var float2 filterBlurData[1] :  : c[6] : -1 : 1
> #var float2 filterBlurData[2] :  : c[7] : -1 : 1
> #var float2 filterBlurData[3] :  : c[8] : -1 : 1
> #var float2 filterBlurData[4] :  : c[9] : -1 : 1
> #var float2 filterBlurData[5] :  : c[10] : -1 : 1
> #var float2 filterBlurData[6] :  : c[11] : -1 : 1
> #var float2 filterBlurData[7] :  : c[12] : -1 : 1
> #var float2 filterBlurData[8] :  : c[13] : -1 : 1
> #var float2 filterBlurData[9] :  : c[14] : -1 : 1
> #var float2 filterBlurData[10] :  : c[15] : -1 : 1
> #var float2 filterBlurData[11] :  : c[16] : -1 : 1
> #var float2 filterBlurDataLow[0] :  :  : -1 : 0
> #var float2 filterBlurDataLow[1] :  :  : -1 : 0
> #var float2 filterBlurDataLow[2] :  :  : -1 : 0
> #var float2 filterBlurDataLow[3] :  :  : -1 : 0
> #var float2 filterBlurDataLow[4] :  :  : -1 : 0
> #var float2 filterBlurDataLow[5] :  :  : -1 : 0
> #var float4 AdvancedHighlightPS : $vout.COLOR : COL : -1 : 1
> #const c[17] = 0.08333334 1 2 0.6
> #const c[18] = 0.2
> #default outlineColor = 0 1 0 1
> #default haloColor = 0 0 1 1
> #default haloIntensity = 1
> #default haloSize = 3
> #default scanEffectColor = 0 0 1 1
> #default scanEffectIntensity = 1
> #default filterBlurData[0] = -0.326212 -0.405805
> #default filterBlurData[1] = -0.840144 -0.07358
> #default filterBlurData[2] = -0.695914 0.457137
> #default filterBlurData[3] = -0.203345 0.620716
> #default filterBlurData[4] = 0.96234 -0.194983
> #default filterBlurData[5] = 0.473434 -0.480026
> #default filterBlurData[6] = 0.519456 0.767022
> #default filterBlurData[7] = 0.185461 -0.893124
> #default filterBlurData[8] = 0.507431 0.064425
> #default filterBlurData[9] = 0.89642 0.412458
> #default filterBlurData[10] = -0.32194 -0.932615
> #default filterBlurData[11] = 0.791559 -0.597705
> #default filterBlurDataLow[0] = -0.326212 -0.405805
> #default filterBlurDataLow[1] = -0.840144 -0.07358
> #default filterBlurDataLow[2] = -0.695914 0.457137
> #default filterBlurDataLow[3] = -0.203345 0.620716
> #default filterBlurDataLow[4] = 0.96234 -0.194983
> #default filterBlurDataLow[5] = 0.473434 -0.480026
> PARAM c[19] = { program.local[0..16],
> 		{ 0.083333336, 1, 2, 0.60000002 },
> 		{ 0.2 } };
> TEMP R0;
> TEMP R1;
> TEMP R2;
> TEMP RC;
> TEMP HC;
> OUTPUT oCol = result.color;
> TEX   R1.xy, fragment.texcoord[0], texture[0], RECT;
> MOVXC RC.x, R1;
> IF    NE.x;
> MOVR  R0.xy, c[6];
> MADR  R0.xy, R0, c[1].x, fragment.texcoord[0];
> MOVR  R0.zw, c[5].xyxy;
> MADR  R0.zw, R0, c[1].x, fragment.texcoord[0].xyxy;
> TEX   R2.x, R0.zwzw, texture[0], RECT;
> TEX   R0.x, R0, texture[0], RECT;
> ADDR  R1.w, R2.x, R0.x;
> MOVR  R0.xy, c[7];
> MADR  R0.xy, R0, c[1].x, fragment.texcoord[0];
> TEX   R0.x, R0, texture[0], RECT;
> MOVR  R0.zw, c[8].xyxy;
> MADR  R0.zw, R0, c[1].x, fragment.texcoord[0].xyxy;
> TEX   R2.x, R0.zwzw, texture[0], RECT;
> ADDR  R0.x, R1.w, R0;
> ADDR  R1.w, R0.x, R2.x;
> MOVR  R0.xy, c[9];
> MADR  R0.xy, R0, c[1].x, fragment.texcoord[0];
> TEX   R0.x, R0, texture[0], RECT;
> MOVR  R0.zw, c[10].xyxy;
> MADR  R0.zw, R0, c[1].x, fragment.texcoord[0].xyxy;
> TEX   R2.x, R0.zwzw, texture[0], RECT;
> ADDR  R0.x, R1.w, R0;
> ADDR  R1.w, R0.x, R2.x;
> MOVR  R0.xy, c[11];
> MADR  R0.xy, R0, c[1].x, fragment.texcoord[0];
> TEX   R0.x, R0, texture[0], RECT;
> MOVR  R0.zw, c[12].xyxy;
> MADR  R0.zw, R0, c[1].x, fragment.texcoord[0].xyxy;
> TEX   R2.x, R0.zwzw, texture[0], RECT;
> ADDR  R0.x, R1.w, R0;
> ADDR  R1.w, R0.x, R2.x;
> MOVR  R0.xy, c[13];
> MADR  R0.xy, R0, c[1].x, fragment.texcoord[0];
> TEX   R0.x, R0, texture[0], RECT;
> MOVR  R0.zw, c[14].xyxy;
> MADR  R0.zw, R0, c[1].x, fragment.texcoord[0].xyxy;
> TEX   R2.x, R0.zwzw, texture[0], RECT;
> ADDR  R0.x, R1.w, R0;
> ADDR  R1.w, R0.x, R2.x;
> MOVR  R0.xy, c[15];
> MADR  R0.xy, R0, c[1].x, fragment.texcoord[0];
> TEX   R0.x, R0, texture[0], RECT;
> MOVR  R0.zw, c[16].xyxy;
> MADR  R0.zw, R0, c[1].x, fragment.texcoord[0].xyxy;
> ADDR  R0.x, R1.w, R0;
> TEX   R2.x, R0.zwzw, texture[0], RECT;
> ADDR  R0.x, R0, R2;
> MOVR  R0.y, c[2].x;
> MULR  R0.x, -R0, c[2];
> MOVR  R1.xyz, c[3];
> MADR  R1.w, R0.x, c[17].x, R0.y;
> ELSE;
> ADDR  R1.zw, fragment.texcoord[0].xyyx, -c[17].y;
> ADDR  R0.zw, R1, c[17].z;
> ADDR  R0.x, -R1.y, c[17].y;
> ADDR  R2.y, R0.z, -c[17];
> MOVR  R1.x, R1.w;
> MOVR  R2.w, R1.z;
> MOVR  R1.z, R0.w;
> MOVR  R2.z, fragment.texcoord[0].x;
> MULR  R0.y, R0.x, R0.x;
> MOVR  R1.y, R2;
> TEX   R0.x, R1, texture[0], RECT;
> MOVR  R1.y, R0.z;
> MOVR  R1.x, fragment.texcoord[0];
> TEX   R1.x, R1, texture[0], RECT;
> TEX   R2.x, R2.zwzw, texture[0], RECT;
> ADDR  R0.z, R2.x, R1.x;
> ADDR  R1.x, R0.z, R0;
> MOVR  R1.w, R2.y;
> TEX   R0.x, R1.zwzw, texture[0], RECT;
> SNERC HC.x, R1, -R0;
> MOVR  R1.xyz, c[0];
> MOVR  R0.z, c[0].w;
> MOVR  R0.w, c[18].x;
> MADR  R0.z(EQ.x), R0.y, c[17].w, R0.w;
> MOVR  R1.xyz(EQ.x), c[4];
> MOVR  R1.w, R0.z;
> ENDIF;
> MOVR  oCol, R1;
> END
> 
> So, it uses a condition code, IF/ELSE/ENDIF and the instruction
> precison modifiers.
> 
> Also, the catia-03 #4 test uses GL_NV_vertex_program3:
> 
> !ARBvp1.0
> OPTION NV_vertex_program3;
> # cgc version 1.5.0023, build date Sep 26 2007 08:51:03
> # command line args:
> #vendor NVIDIA Corporation
> #version 1.5.0.23
> #profile vp40
> #program GraphicMaterialVS
> #semantic GraphicMaterialVS.iWorldViewProj
> #semantic Ground
> #semantic ColSky
> #semantic ColSkyMin
> #semantic wvp : WORLDVIEWPROJECTION
> #semantic world : WORLD
> #semantic viewIT : VIEWIT
> #var float3 IN.Position : $vin.POSITION : POSITION : 0 : 1
> #var float4x4 iWorldViewProj :  : c[0], 4 : 1 : 1
> #var float4 Ground :  :  : -1 : 0
> #var float4 ColSky :  :  : -1 : 0
> #var float4 ColSkyMin :  :  : -1 : 0
> #var float4x4 wvp : WORLDVIEWPROJECTION : , 4 : -1 : 0
> #var float4x4 world : WORLD : , 4 : -1 : 0
> #var float4x4 viewIT : VIEWIT : , 4 : -1 : 0
> #var float4 GraphicMaterialVS.HPosition : $vout.POSITION : HPOS : -1 : 
> 1
> #var float3 GraphicMaterialVS.Position : $vout.TEXCOORD5 : TEX5 : -1 : 
> 1
> #const c[4] = 1
> #default Ground = 0 0 1 0
> #default ColSky = 0 0 1 1
> #default ColSkyMin = 1 1 1 1
> PARAM c[5] = { program.local[0..3],
> 		{ 1 } };
> TEMP R0;
> TEMP RC, HC;
> BB1:
> MOV   R0.w, c[4].x;
> MOV   R0.xyz, vertex.position;
> DP4   result.position.w, R0, c[3];
> DP4   result.position.z, R0, c[2];
> DP4   result.position.y, R0, c[1];
> DP4   result.position.x, R0, c[0];
> MOV   result.texcoord[5].xyz, vertex.position;
> END
> 
> But AFAICT, the program just declares a label (BB1:) that's unused.
> 
> I'm kind of on the fence about keeping enough of these extensions to
> keep viewperf happy.  On one hand, viewperf is kind of a hack and has
> so many issues that it's not worth supporting.  On the other hand,
> people do sometimes run viewperf and if it doesn't work we're sure to
> get complaints and/or bug reports.
> 
> -Brian

Sorry that I step in but what about GL_NV_vertex_program* in general?
There are several Mesa-demos (e.g. in tests) which do not work any 
longer.

mesa-demos/tests> ./vptest1
Sorry, this program requires GL_NV_vertex_program

-Dieter



More information about the mesa-dev mailing list