Keith Whitwell wrote:
> Rune Petersen wrote:
>> Rune Petersen wrote:
>>> Roland Scheidegger wrote:
>>>> Rune Petersen wrote:
>>>>> I hit a problem constructing this:
>>>>>
>>>>> - In order to do range mapping in the vertex shader (if I so choose)
>>>>> I will need a constant (0.5), but how to add it?
>>>> I think this might work similar to what is used for position invariant
>>>> programs, instead of using _mesa_add_state_reference you could try
>>>> _mesa_add_named_parameter. Otherwise, you could always "construct" 0.5
>>>> in the shader itself, since you always have the constants 0 and 1
>>>> available thanks to the powerful swizzling capabilities, though
>>>> surprsingly it seems somewhat complicated. Either use 2 instructions
>>>> (ADD 1+1, RCP). Or try EX2/EXP though I'm not sure about performance of
>>>> these, but I guess the approximated EXP should do (2^-1).
>>>>
>>> This math in this patch appear sound. the doom3-demo issue appear
>>> unrelated to fragment.position.
>>>
>>> This version makes use of existing instructions to calculate
>>> result.position.
>>>
>>> split into 2 parts:
>>>     - select_vertex_shader changes
>>>     - The actual fragment.position changes
>>>
>>> This patch assumes that:
>>>
>>> - That the temp used to calculate result.position is safe to use (true
>>> for std. use).
>>>
>>> - That fragment.position.x & y wont be used (mostly true, except for
>>> exotic programs.)
>>>    In order to fix this, I'll need to know the window size, but how?
> 
> Surely it's right there in radeon->dri.drawable ?
> 

Now I remember why I can't use radeon->dri.drawable, at least not
directly when the shader code is added:

When the window size changes the constants have to be updated.

Is there a way for the driver to update a constant after construction?


Rune Petersen

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to