Sign in to follow this  
CadeF

[Resolved][HLSL, PS 1.3]Cannot sample cube map

Recommended Posts

CadeF    421
Hey everyone, In the process of porting my ps 2.0 shaders to ps 1.3 (for Geforce 4 support), I came across this problem. Every time I try to read from a cube texture set in my app by effect.setvalue, I get this error error X4523: cannot map this dependent texture read to ps_1_3 ID3DXEffectCompiler::CompileEffect: There was an error compiling I've made a test shader, with the cubemap set up as follows texture cubesampletex; samplerCUBE texSamplerCUBETEX : TEXUNIT3 = sampler_state { Texture = (cubesampletex); MIPFILTER = ANISOTROPIC; MAGFILTER = ANISOTROPIC; MINFILTER = ANISOTROPIC; }; The code in which I sample the cubemap is float zLight = distance(lightPos, IN.UTposition); float3 vLight = lightPos.xyz - IN.UTposition.xyz; float fdepth = dot(vLight, vLight); float3 shadowsample = texCUBE(texSamplerCUBETEX, -vLight); float fshadow = (fdepth - shadowsample < fdepth * 0.1f) ? 1.0f : 0.0f; Can anyone tell me how to get this right? Thanks :) [Edited by - CadeF on March 13, 2006 4:43:59 AM]

Share this post


Link to post
Share on other sites
kovacsp    306
hey,

look what i've found in the DX SDK, "texld - ps_2_0 and up" page:
Quote:
A second-order dependent texture instruction is defined as a texture instruction that reads or writes to a Temporary Register (r#) whose contents, before executing the texture instruction, depend (perhaps indirectly) on the outcome of a first-order dependent texture instruction. An (n)th-order dependent texture instruction derives from an (n - 1)th-order texture instruction.


That is, a dependent texture read is a texture read that depends on the outcome of a previous texture read. Somewhere your shader does this, and the compiler says it cannot generate valid code to a ps13 target. You either has to simplify your shader not to do dependent reads, or not use this technique on those targets (maybe a lower quality version?)

When converting shaders to lower targets, you may want to read "Pixel Shader Differences" in the DX SDK docs, and sometimes have a look at the asm code that the compiler generates, to understand the limitations, so you'll be able to overcome them faster.

kp

Share this post


Link to post
Share on other sites
CadeF    421
Thanks, that cleared alot up. I guess I'll be sticking to ps 1.4, scince moving the code to calculate vLight from the PS into the VS gave me an error that I can only read and sample a cube texture from a texcoord in ps 1.4 and above.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this