Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Vertex shader constants & shared effect parameters  (Read 499 times)
Zaknafein
Customers
Community Member
*****
Posts: 2599


WWW
« on: March 24, 2008, 06:39:05 PM »

I've been trying to set a vertex shader constant or a shared effect parameter in a TVShader and both seem to fail...

For vertex shader constants there is no API so I tried with MDX and TVInternalObjects, but no effect :

Code:
Device dev = new Device(InternalObjects.GetDevice3D());
float[] before = dev.GetVertexShaderSingleConstant(0, 4);
dev.SetVertexShaderConstant(0, new Vector4(texelSize.x, texelSize.y, 0, 0));
float[] after = dev.GetVertexShaderSingleConstant(0, 4);

The "after" array gives me the correct values, but as soon as I try to use them in a shader like so :

Code:
uniform float2 texelSize : register(c0);

I get 0 all over. And I'm sure that the vertex shader constant gets run at least once.

So I tried shared shader parameters, which I know works in DX9 because I got them working in Fez in XNA. So I just used this syntax in the shader :

Code:
shared float2 texelSize;

And replicated that variable in every shader I needed it, but just set it in one shader, it should then propagate to all loaded shaders that use it. But it doesn't, every other shader keeps having {0, 0}...

So in short...

VS constants questions :
- Is there any specific time I should set vertex shader constants?
- Should I not be using the 0th constant?
- Why isn't there any API to set them in TVScene or TVEngine?

Shared params : I suspect they don't work because TVShaders aren't in the same effect pool... so is it possible to create them inside a common pool, or if not, why?

Thanks!
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
Zaknafein
Customers
Community Member
*****
Posts: 2599


WWW
« Reply #1 on: March 28, 2008, 10:22:27 AM »

Bump? Grin
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
SylvainTV
Administrator
Community Member
*****
Posts: 4436


WWW
« Reply #2 on: March 28, 2008, 07:29:41 PM »

Well obviously setting vertex shader constants won't work because TV overwrites them for internal shaders etc.. and even your .fx shader can write to these constants if you're not specifying all of them. Not a good idea Smiley

About parameter sharing, yea they're not in the same pool. That could be a good new feature to have i guess Smiley It is simple to add.
However would all user effects would go in the same pool ? Or do you need the ability to have several pools ?
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Zaknafein
Customers
Community Member
*****
Posts: 2599


WWW
« Reply #3 on: March 28, 2008, 09:50:59 PM »

Thanks for the precision about VS constants!
And about pools... I honestly don't see much use to having more than one pool. And since there's only one TVScene with one factory, there's no concept of resource grouping elsewhere in TV3D, so it would make sense to use a single pool IMO.
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
SylvainTV
Administrator
Community Member
*****
Posts: 4436


WWW
« Reply #4 on: March 29, 2008, 09:37:36 AM »

Anyway parameters are not shared unless you set the "shared" keyword if I have read well ?
So you would use them only if wanted.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Zaknafein
Customers
Community Member
*****
Posts: 2599


WWW
« Reply #5 on: March 29, 2008, 09:46:48 AM »

Yup, that is right. Smiley
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks