wined3d/arb_program_shader: Small optimization in state_texfactor_arbfp().

Stefan Dösinger stefandoesinger at gmx.at
Fri Feb 4 03:41:35 CST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Actually I am afraid the patch isn't quite correct. If e.g. ps constant 220 is dirty, and  no others are, then highest_dirty_ps_const is 220, and pshader_const_dirty[ARB_FFP_CONST_TFACTOR] is 0. After setting the texfactor you still have to reload constant nr. ARB_FFP_CONST_TFACTOR, so you have to set it to 1 in the array.

If managing the dirty constant array is expensive you could try to replace it by a bitmap where you just store 1 bit per dirty constant. That reduces the memory size(helps with the CPU cache) and you can skip 8, 16 or 32 clean constants at once in shader_arb_load_constantsF but it adds some overhead because extra operations are needed to test for single bits.

> +    /* TODO: this call is actually very expensive, figure out a better way... */
>      GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_TFACTOR, col));
There's no real alternative, except hardcoding the texfactor into the shader, and I doubt that is cheaper.  Maybe local constants are cheaper, but I doubt this as well. That also means you have to reload the texfactor every time you switch between fixed function pipeline replacement shaders.

Am 04.02.2011 um 10:27 schrieb Stefan Dösinger:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> Am 03.02.2011 um 23:01 schrieb Adam Martinson:
> 
>> 
>> Oddly enough this gives us an average 1.8% boost in the 3DMark06 batch size tests.
> Impressive.
> 
> One more thing you could investigate(but that doesn't affect this patch): Try to figure out why this code is called in the first place. The only situation when this should happen is if the app is using fixed function fragment processing. I wouldn't expect that 3Dmark06 does that.
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> 
> iQIcBAEBAgAGBQJNS8aYAAoJEN0/YqbEcdMwI1AQAJder+8LZILzdT+8tA2YiwZ+
> ZEVOi4S2voFASHUVJbYuWIXkzzVu6fQlZXw/KCyvdQaslpTWQFFc/cOMXcCVjVs5
> puJJDydjCyI8FZF7ec8dCIjCHqBH4S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ZbSIWVVRXdYt3O5Znvtyta2tThxW/QK7HyK3Jq3l7P+EZgzfWlQt
kjkJgVXVtPox441cvr3R8oV2M57iwBhsYWwXsusC0BCD/WKFCRb/FDwY6f2G6L2p
pFkKMhhC7nIaB6CBjPailQHfMC9tlhq/vB951Ir3UVIOAUuEHrKHK9L0jercnTfd
QPym37IygBdAFjNKOvPI2b8DmVFKUAkkDGdaNZSU1Z8IMCogzs9bqf6L2JFF97U3
mH1PG6/tJnsBMUfUhnA8xreg7FyqIpmn53XV14q2XFtiAWY8IRhF97p8N71oSAUJ
jhUnwEL1Tw51/p6GIIu7
=dmun
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list