   HLSL SetValue of an IDirect3DTexture9
  Hi,I'm currently developping a small-sized rendering-framework for which I'm currently using DX9. Ssince the framework is meant to go along for some time, I made abstractions of all API-dependent structures (such as textures, effects, ...), so I can easily update to DX11 or OpenGL whenever I feel the need.In the recent days I've found lots of usefull stuff on these forums, but my current problem seems to be a bit tricky.When I read the data from an X-file, I'm able to retrieve the EFFECTDEFAULTVALUES. Based on these values, I can pass an LPCVOID together with the size of the data to ID3DXEffect::SetValue(...)Due to the nature of my framework-design, I would like to use the same SetValue-method to set the data of my texture-objectSo here is my question: How can i retrieve the pointer and bytesize from a IDirect3DTexture9-instance wich I can pass on to my effect-instance ??Note1: I know of the existence of ID3DXEffect::SetTexture(...) but the abstraction of my current software-design does not allow me to use this without messing it upNote2: I know how to lock and retrieve the pixel-data of a texture, but IDirect3DTexture9::LockRect(...) seems to ask directly for the actual mip-level :s   
  You don't pass the actual texture data to an ID3DXEffect, you pass the pointer to the IDirect3DTexture9 interface.  Then all the Effect does is it looks up which sampler register the HLSL texture is bound to (it will keep track of this in an internal constant table), and binds the texture to the corresponding register using IDirect3DDevice9::SetTexture.  ;  Hi, tnx for the quick replySo let me make sure I have this right:- ID3DXEffect::SetTexture(...) does something completly diferrent than Set/-int/-float/...- In case you would ever try ... it would not be possible to set a none-IDirect3DTexture9 instance as texture on a ID3DXEffect comming from DX9 ?   ;Quote:Original post by supmagcSo let me make sure I have this right:- ID3DXEffect::SetTexture(...) does something completly diferrent than Set/-int/-float/...Yes. An ID3DXEffect doesn't just deal with shaders and shader constants, it abstracts out the entire pipeline.  This means that it might set textures through IDirect3DDevice9::SetTexture, it might set shader constants through IDirect3DDevice9::SetPixelShaderConstantF and IDirect3DDevice9::SetVertexShaderConstantF, it might set render states through IDirect3DDevice9::SetRenderState, it might set sampler states through IDirect3DDevice9::SetSamplerState, and it might set shaders using IDirect3DDevice9::SetVertexShader/IDirect3DDevice9::SetPixelShader.Which of these happens depends on your .fx code and what's defined in there.  It's important to keep in mind the effects framework does NOT do anything that you couldn't do yourself through normal Direct3D calls...if you ever suspect that there's some sort of "magic" going on, then you're making an incorrect assumption.You might find it helpful to run your app through PIX and expand a few ID3DXEffect::Begin and ID3DXEffect::BeginPass calls to see what native D3D calls are being made behind the scenes.Quote:Original post by supmagc- In case you would ever try ... it would not be possible to set a none-IDirect3DTexture9 instance as texture on a ID3DXEffect comming from DX9 ?Yup.  If you want to set an effect parameter that corresponds to a "texture" in your .fx file, then you need to use something that derives from IDirect3DBaseTexture9.