PDA

View Full Version : No texture fetching on Radeon 4850?



mosen
11-26-2008, 10:55 AM
I am currently writing a vertex program in Cg that makes a lookup in a texture which looks something like this:




struct vertex_input
{
float4 position : POSITION;
float4 normal : NORMAL;
float2 uv : TEXCOORD0;
};

struct vertex_output
{
float4 position : POSITION;
float tex1 : TEXCOORD1;
};

vertex_output main(
vertex_input IN
, uniform float4x4 ModelViewProj
, uniform float du
, uniform float dv
, uniform sampler2D heightMap
)
{
vertex_output OUT;

// Get value from heightmap.
float h = tex2D(heightMap, IN.uv);

float4 new_pos = IN.position + IN.normal*h;


// Transfer displaced position to clip-space.
OUT.position = mul(ModelViewProj, new_pos);
OUT.tex1 = h;
return OUT;
}


But even passing the texture makes the program crash! I have tried to put my old GF7600 in the machine and it works fine. Is it really a fact that ATI 4850 still does not support vertex texture fetching?

IneQuation.pl
11-26-2008, 12:45 PM
Even if it wouldn't, it shouldn't crash but fall back to software rendering instead. If it's crashing, it's probably due to a wrong pointer/size/offset you're feeding GL or Cg. Check your vertex arrays/VBOs (if you're using them) and shader source uploading.

V-man
11-26-2008, 08:07 PM
What do you mean by passing the texture makes it crash?
If you call glTexImage2D and it crashes, then most likely the problem is your code.
Also, you have Cg code. To what profile are you compiling to? ARB_vertex_program or GLSL?

Groovounet
11-27-2008, 02:58 AM
Radeon from X1*** support vertex texture fetching ... but drivers are available from august only.

If it is really the issue, bue I don't really think it is, just update the drivers.

mosen
11-27-2008, 04:37 AM
When I run the application it returns the following info on the profiles: arbvp1 and arbfp1.

EDIT: Passing the texture is not the issue (my bad). It only goes wrong when the following statement is run:

float h = tex2D(height_texture, IN.uv);

Groovounet
11-27-2008, 05:07 AM
I can't use those profile for vertex texture fetch.
Use GLSL profile instead.

Those profiles are very old and never been updated since GeForce 5 or Radeon 95xx. There are some extensions by nVidia and for nVidia, that's all.

mosen
11-27-2008, 05:21 AM
Ok but how to I force the application to use another profile?

When I inserted my old GF 7600 GS it automatically changed to VP40 and FP40 (which worked) so it seems that the application that I am using automatically uses the best found profile.

Groovounet
11-27-2008, 06:01 AM
Don't you use cgCreateProgram at some point? Forth parameter is here for that ...

Groovounet
11-27-2008, 06:04 AM
CGprofile Profile = cgGetProfile("glslv");