Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / Game Design & Programming / High Level Shader Language(HLSL) Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
erbolat

March 12, 2005, 03:22 PM

Hi,

I use an HLSL document for my 3D application.

I can set a parameter but i cant get it back. When i call the paramater the value i send before is returned.

Do you know how can i get parameters from HLSL document. If you want i can send the used code block .

Thanks...

 
Moe

March 12, 2005, 04:04 PM

You send parameters to the HLSL-file so it knows with witch actual values to perform its current task. You can not get them back and most likely you donít need to. The only way to get some values out of a shader is by rendering to textures witch might not be enough, depending on how complex your output would require it.

 
erbolat

March 13, 2005, 07:35 AM

But there is a command, GetParameter in HLSL. and it is work but the return value is not correct. it returns the value which i set before, that is, i cant get the changed value.

 
Illco

March 13, 2005, 07:44 AM

GetParameter gives you the handle to the parameter, not the parameter itself. If you want the value, pass the handle to functions like GetFloat(), GetArray(), GetMatrix(), etc.

 
erbolat

March 13, 2005, 11:01 AM

I did it. But I got the value which i set before the running HLSL. After finishing the HLSL code i call back the value with this way. But the value is not correct. I am sure that the value is changed in HLSL document. I got the first value of the parameter.

 
Axel

March 13, 2005, 11:06 AM

A shader cannot change its parameters, what do you mean by "I am sure that the value is changed in HLSL document"

 
erbolat

March 13, 2005, 01:29 PM

I am trying to get a float parameter.



For example;

I have a box. And i give it a color by randomly.

There is a paramater lets say


float x;

At first i set it 0 from my .cpp code( with SetParamater command);


if any of the pixels get a red color the parameter x becomes 1. And of the HLSL running i want to check if there is any red color and according to this i want do something else...


After the setting parameter and HLSL running i call bac it with GetParameter command (I know it is an handle). But the value is always 0 which i assign before. I can see that my application has red colors, too.


How can i solve this porblem?

 
[-WD40-]

March 13, 2005, 01:54 PM

you cannot do this simply because you cannot read back from a pixel or vertex shader, except through a render target I guess. What does this means? you have to read back the result from a texture.

how to solve your problem? it really depends on your problem...maybe you should explain some more what you're trying to do with this "red color" thing.

HLSL has the same restrictions as the ASM equivalents do. It's not because you can name a variable that you can read back from it, simply because the input registers in a pixel or vertex shader are write only.

just look at it as a one way train...


Your Inputs ---> HLSL ---> GPU ---> screen or render target

but oops, your inputs never change. Think about them as "pass by value" instead of "pass by reference" or taking the "address of". Once they're in the train, they never go back.

 
This thread contains 8 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.