NotTaken

I am trying to draw the FPS in a graph.

For that I want to pass the shader effect a 1D texture, but it isnt very simple.

I understand I need to use a sampler

Does the steps of passing and using a 1D texture (or sampler) similar to those of passing and using a 2D texture Or do I need to do it differently

For a 2D texture I have the SetTexture method for an effect, but I dont have the equivalent for a sampler or some sort of a 1D Texture which I dont know about.

How do I achieve this

Thank you.



Re: Game Technologies: Graphics Graph shader?

BLANC Guillaume

Yes you should use the generic SetTexture method to pass your texture object, this function does not make the difference between texture types (1D, 2D, ..) because it uses as argument an IDirect3DBaseTexture9 which is the common interface of all Dx9 textures.

A sampler object is a HLSL only type that can be either 1D, 2D, 3D and cube. It is used to map a texture with sampling settings like filtering and so on.

So basicaly treat 1D texture like if it was 2D but use a Sampler1D to sample the texture. It should work just fine.





Re: Game Technologies: Graphics Graph shader?

NotTaken

So I didnt understand what I should do.

How do I create a 1D texture in DX

Do I need to create a D3DTexture 2D texture and treat it as if it was a 1D texture

But then I have to allocate a texture with a width greater then 1, so its not really 1D.





Re: Game Technologies: Graphics Graph shader?

BLANC Guillaume

>> How do I create a 1D texture in DX
>>
Do I need to create a D3DTexture 2D texture and treat it as if it was a 1D texture

Yes, create it like any other 2D texture but with a height of 1. The only important thing is the sampler that must be 1D in order to use a simple scalar texture coordinate. Otherwise, you could use a 2D sampler and specify 0.f for the V coordinate. It would give the same result if we do not consider the filtering problem.

>>
But then I have to allocate a texture with a width greater then 1, so its not really 1D.
1D texture is not a 1*1 texture size, it's a n*1 texture. So with can be greater than 1, but height is equal to 1. Isn't it what you want : a 'width' long line of pixels





Re: Game Technologies: Graphics Graph shader?

NotTaken

I am sorry I didnt make myself clear.

What I ment is that, DirectX does not allow to

create a texture of height 1. There is a minimum height you can create a texture and it is greater then 1.

But anyway, I already implemented it with a normal 2D texture, only tried to create the height as small as possible.





Re: Game Technologies: Graphics Graph shader?

BLANC Guillaume

Sorry for the misunderstanding.
I've done some tests and I'm afraid I can not confirm what you're saying: I've got no problem creating a texture of 1 pixel height. Have you read something about it or only done some experiments





Re: Game Technologies: Graphics Graph shader?

NotTaken

Well, there is a possiblity of non power2 textures, but I think the way they are implemented is that they allocated a power2 texture that is bigger then the required texture.

And not all the graphics card support non power 2 textures.

Also, there is a capability settings you can check which tells what is the minimum ratio of a texture, so this confine the height or width of your texture.

My request was futile in the first place, because if there are no real height 1 textures for normal use, I wont be able to find any other technique to create such 1D texture.

 





Re: Game Technologies: Graphics Graph shader?

BLANC Guillaume

On my card, MaxTextureAspectRatio capability is equal to the MaxTextureWidth ones, so that's why I've got no problem creating a texture with a height of 1, even a 4096 * 1. Seems that's not the case for all drivers, so that's something to be aware of. Thank you very much for the tips...