Jump to content

  • Log In with Google      Sign In   
  • Create Account


SamplerState within shader sn't working in D3D10


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 jkolb_wsi   Members   -  Reputation: 100

Like
0Likes
Like

Posted 29 July 2009 - 04:35 AM

If I specify this in my shader (I am not using the effects system): Texture2D fullscreenTex; SamplerState fullscreenS { AddressU = CLAMP; AddressV = CLAMP; AddressW = CLAMP; Filter = MIN_MAG_MIP_POINT; }; And then later sample via: outColor = fullscreenTex.Sample(fullscreenS, inTexture); The runtime complains that I don't have a sampler bound to slot 0. I don't want to bind a sampler: since the state is declared in the shader it should use that shouldn't it? Can someone shed some light on this problem? If I do have to bind a sampler than: A) what's the point of specifying the state in the shader. And B) I can't seem to get the initial state via reflection. Thanks, Jeremy

Sponsor:

#2 Demirug   Members   -  Reputation: 884

Like
0Likes
Like

Posted 29 July 2009 - 05:19 AM

Setting values to state objects works only when you use the effect framework. If you only compile the shaders these information is lost.

#3 jkolb_wsi   Members   -  Reputation: 100

Like
0Likes
Like

Posted 29 July 2009 - 05:31 AM

Quote:
Original post by Demirug
Setting values to state objects works only when you use the effect framework. If you only compile the shaders these information is lost.


Then can I get the sampler state using shader reflection and create the sampler based on that?

#4 Demirug   Members   -  Reputation: 884

Like
0Likes
Like

Posted 29 July 2009 - 05:40 AM

Even if you compile it to an effect the data are stored in the compiled effect but there is no method to read it from the compiled effect.

If you don’t want to use the effect framework you need to write your own parser or a custom format.


#5 DieterVW   Members   -  Reputation: 700

Like
0Likes
Like

Posted 29 July 2009 - 05:44 AM

Using Effects is the only way to do state assignment in shader code. Using HLSL directly means that you have to manage the state objects yourself. So, in this instance the code you wrote in the shader is doing nothing other then indicating that a sampler needs to be bound for the shader to work.

A) The assignment is maintained in reflection, but ignored from a code standpoint.
B) Samplers are resources and have bindings. There is currently no way to get the state info for the default assignment from it. The default value would only be available for variables.

EDIT: Turns out that there is a bug and that the DefaultValue in the D3DXX_SHADER_VARIABLE_DESC currently never gets filled in.

[Edited by - DieterVW on July 29, 2009 12:44:14 PM]

#6 darkelf2k5   Members   -  Reputation: 286

Like
0Likes
Like

Posted 29 July 2009 - 07:42 AM

You can compile an effect and use the result to get the samplers, and other non-shader states, values etc. It works even without a shader. I could pass a string containing only a raster state description to the effect compile function and then could get a valid version of it in C++.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS