Jump to content
Eternal Lands Official Forums
Florian

Vertex shaders on Mac

Recommended Posts

With just one changed line of code

 

actor_init.cpp:543

// ELglGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_PARAMETERS_ARB, &t0);

ELglGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, &t0);

 

 

I get all shaders loaded successfully:

 

Loading vertex programs

Max bones per mesh: 71

GL_MAX_PROGRAM_INSTRUCTIONS_ARB: 262144

GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB: 256

GL_MAX_PROGRAM_TEMPORARIES_ARB: 65535

GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB: 32

GL_MAX_PROGRAM_PARAMETERS_ARB: 1024

GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB: 256

GL_MAX_PROGRAM_ATTRIBS_ARB: 32

GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB: 18

GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB: 2

GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: 1

GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB: 1024

GL_MAX_PROGRAM_ENV_PARAMETERS_ARB: 256

'shaders/anim.vert' GL_PROGRAM_INSTRUCTIONS_ARB: 158

'shaders/anim.vert' GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: 0

'shaders/anim.vert' GL_PROGRAM_TEMPORARIES_ARB: 5

'shaders/anim.vert' GL_PROGRAM_NATIVE_TEMPORARIES_ARB: 0

'shaders/anim.vert' GL_PROGRAM_PARAMETERS_ARB: 251

'shaders/anim.vert' GL_PROGRAM_NATIVE_PARAMETERS_ARB: 0

'shaders/anim.vert' GL_PROGRAM_ATTRIBS_ARB: 6

'shaders/anim.vert' GL_PROGRAM_NATIVE_ATTRIBS_ARB: 0

'shaders/anim.vert' GL_PROGRAM_ADDRESS_REGISTERS_ARB: 1

'shaders/anim.vert' GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: 0

'shaders/anim_depth.vert' GL_PROGRAM_INSTRUCTIONS_ARB: 27

'shaders/anim_depth.vert' GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: 50

'shaders/anim_depth.vert' GL_PROGRAM_TEMPORARIES_ARB: 3

'shaders/anim_depth.vert' GL_PROGRAM_NATIVE_TEMPORARIES_ARB: 4

'shaders/anim_depth.vert' GL_PROGRAM_PARAMETERS_ARB: 218

'shaders/anim_depth.vert' GL_PROGRAM_NATIVE_PARAMETERS_ARB: 218

'shaders/anim_depth.vert' GL_PROGRAM_ATTRIBS_ARB: 4

'shaders/anim_depth.vert' GL_PROGRAM_NATIVE_ATTRIBS_ARB: 4

'shaders/anim_depth.vert' GL_PROGRAM_ADDRESS_REGISTERS_ARB: 1

'shaders/anim_depth.vert' GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: 0

'shaders/anim_shadow.vert' GL_PROGRAM_INSTRUCTIONS_ARB: 116

'shaders/anim_shadow.vert' GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: 211

'shaders/anim_shadow.vert' GL_PROGRAM_TEMPORARIES_ARB: 5

'shaders/anim_shadow.vert' GL_PROGRAM_NATIVE_TEMPORARIES_ARB: 8

'shaders/anim_shadow.vert' GL_PROGRAM_PARAMETERS_ARB: 255

'shaders/anim_shadow.vert' GL_PROGRAM_NATIVE_PARAMETERS_ARB: 243

'shaders/anim_shadow.vert' GL_PROGRAM_ATTRIBS_ARB: 6

'shaders/anim_shadow.vert' GL_PROGRAM_NATIVE_ATTRIBS_ARB: 6

'shaders/anim_shadow.vert' GL_PROGRAM_ADDRESS_REGISTERS_ARB: 1

'shaders/anim_shadow.vert' GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: 0

'shaders/anim_ghost.vert' GL_PROGRAM_INSTRUCTIONS_ARB: 32

'shaders/anim_ghost.vert' GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: 52

'shaders/anim_ghost.vert' GL_PROGRAM_TEMPORARIES_ARB: 3

'shaders/anim_ghost.vert' GL_PROGRAM_NATIVE_TEMPORARIES_ARB: 4

'shaders/anim_ghost.vert' GL_PROGRAM_PARAMETERS_ARB: 225

'shaders/anim_ghost.vert' GL_PROGRAM_NATIVE_PARAMETERS_ARB: 219

'shaders/anim_ghost.vert' GL_PROGRAM_ATTRIBS_ARB: 5

'shaders/anim_ghost.vert' GL_PROGRAM_NATIVE_ATTRIBS_ARB: 5

'shaders/anim_ghost.vert' GL_PROGRAM_ADDRESS_REGISTERS_ARB: 1

'shaders/anim_ghost.vert' GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: 0

'shaders/anim_ghost_shadow.vert' GL_PROGRAM_INSTRUCTIONS_ARB: 33

'shaders/anim_ghost_shadow.vert' GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: 53

'shaders/anim_ghost_shadow.vert' GL_PROGRAM_TEMPORARIES_ARB: 3

'shaders/anim_ghost_shadow.vert' GL_PROGRAM_NATIVE_TEMPORARIES_ARB: 4

'shaders/anim_ghost_shadow.vert' GL_PROGRAM_PARAMETERS_ARB: 225

'shaders/anim_ghost_shadow.vert' GL_PROGRAM_NATIVE_PARAMETERS_ARB: 219

'shaders/anim_ghost_shadow.vert' GL_PROGRAM_ATTRIBS_ARB: 5

'shaders/anim_ghost_shadow.vert' GL_PROGRAM_NATIVE_ATTRIBS_ARB: 5

'shaders/anim_ghost_shadow.vert' GL_PROGRAM_ADDRESS_REGISTERS_ARB: 1

'shaders/anim_ghost_shadow.vert' GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: 0

Loading vertex programs done

 

Result is this:

 

http://www.eternal-lands.com/forum/index.p...=si&img=496

 

(some actors aren't black, but no actor has textures)

 

/EDIT

old selection works on those actors, new selection doesn't

 

/EDIT2

:)

make clean && make solved the texture problem ...

Now the client crashes on the main server with something that looks like a NULL pointer

Program received signal EXC_BAD_ACCESS, Could not access memory.

Reason: KERN_PROTECTION_FAILURE at address: 0x00000000

0x2889627e in ?? ()

Edited by Florian

Share this post


Link to post
Share on other sites

You mean that you are able to get textures while running with UVP = 1? Or is this something else? I tried the suggested NATIVE change, but I still get no textures on the actors.

Share this post


Link to post
Share on other sites
You mean that you are able to get textures while running with UVP = 1? Or is this something else? I tried the suggested NATIVE change, but I still get no textures on the actors.

Yes, I get it to load the vertex shaders, UVP: 1 is displayed and I get textures.

NEW_SELECTION does not work, old selection does.

Works only on the test server, on main it crashes right after the first few frames with the NULL pointer exception above. Maybe my el.ini in the main profile is f'ed up...

 

I did a complete code cleanup, after that the textures work. Incremental make didn't :P

 

/EDIT

copied my test el.ini to the main profile, no crash, no textures ...

I don't get it ...

Edited by Florian

Share this post


Link to post
Share on other sites
Try to disable the fog, etc.

I copied my el.ini and el.cfg from my test profile to my main profile, why does it work on the test server and not on the main server?

Share this post


Link to post
Share on other sites
Anything relevant in the errors or info log?

Nothing :P

 

This is new but unrelated I think

error.log:

Data Error in dragon3(78): Already loaded dragon1(78)

Share this post


Link to post
Share on other sites

Did you get the latest files that I posted in the Final RC thread?

 

Oh, BTW, I know what the problem is.

The time is different, and the vertex programs are different as well (shadows and now shadows). Try again later and see if this is the issue.

Share this post


Link to post
Share on other sites
Did you get the latest files that I posted in the Final RC thread?

 

Yes, copied the files from my windows final RC directory. Latest *.vert from CVS.

 

The time is different, and the vertex programs are different as well (shadows and now shadows). Try again later and see if this is the issue.

 

Ah, right.

Test server: 3:37 (night): no textures

Main server: 5:31 (night): no textures

Share this post


Link to post
Share on other sites

As a test, and as a test alone (be careful not to commit it in the CVS by mistake), in anim.vert remove the following:

 

MAD R1.xyz, R0.xyzx, -light_position_1.w, light_position_1.xyzx;
DP3 R2.x, R1.xyzx, R1.xyzx;
RSQ R2.y, R2.x;
MUL R1.xyz, R1.xyzx, R2.y;
DST R2, R2.xxxx, R2.yyyy;
MUL R2.yz, R2.yzxx, light_position_1.wwww;
DP3 R2.w, R2, attenuation_1;
DP3 R1.x, R1.xyzx, R3.xyzx;
MAX R1.x, R1.x, constant.z;
RCP R2.w, R2.w;
MUL R1.x, R1.x, R2.w;
MAD R4, R1.xxxx, diffuse_1, R4;

 

Then remove the next few ones as well (each paragraph is a light). See if it makes a difference (this is the night/insides vertex program).

Share this post


Link to post
Share on other sites
Did you get the latest files that I posted in the Final RC thread?

 

Oh, BTW, I know what the problem is.

The time is different, and the vertex programs are different as well (shadows and now shadows). Try again later and see if this is the issue.

I have the data files that Florian gave to me.

When I turn off shadows (or shadow mapping) then my textures show up again. My frame rate is pretty abysmal. 35fps in the open and 5-15fps at Raven with 3 other people around. I have not tried your shader edit yet. This was all in the daytime outside.

Edited by 0ctane

Share this post


Link to post
Share on other sites

Okay, this is odd.

 

- If I have shadows enabled (solid color actors) and quit the game, then restart, I get solid actors, but I can turn off shadows and get textures back.

 

- If I have shadows disabled now and I quit the game, restart, I get solid actors (?!), but turning on and off the shadows has no effect now. The actors remain solid.

 

Nothing suspicious in my logs (other than audio stream error). infos.log says that all the verts were compiled.

Share this post


Link to post
Share on other sites
Well, I guess it's a driver issue, not much we can do about it.

Not really. I have other vertex shader programs working just fine on my Mac. The problem is somewhere in EL's use of OpenGL (or the use of SDL on top of OpenGL).

Share this post


Link to post
Share on other sites

As I said before, those are not shaders, but vertex programs (different stuff).

Although it could be an Ati problem too, there are some issues on some older ATI cards.

Share this post


Link to post
Share on other sites
\As I said before, those are not shaders, but vertex programs (different stuff).

Although it could be an Ati problem too, there are some issues on some older ATI cards.

Okay, I will rewrite it.

 

Not really. I have other vertex programs working just fine on my Mac. The problem is somewhere in EL's use of OpenGL (or the use of SDL on top of OpenGL).

 

I have an ATI X1600.

 

A while back I noticed that we would sometimes drop into software rendering. I wonder if that is happening again...

Edited by 0ctane

Share this post


Link to post
Share on other sites
As a test, and as a test alone (be careful not to commit it in the CVS by mistake), in anim.vert remove the following:

 

MAD R1.xyz, R0.xyzx, -light_position_1.w, light_position_1.xyzx;
DP3 R2.x, R1.xyzx, R1.xyzx;
RSQ R2.y, R2.x;
MUL R1.xyz, R1.xyzx, R2.y;
DST R2, R2.xxxx, R2.yyyy;
MUL R2.yz, R2.yzxx, light_position_1.wwww;
DP3 R2.w, R2, attenuation_1;
DP3 R1.x, R1.xyzx, R3.xyzx;
MAX R1.x, R1.x, constant.z;
RCP R2.w, R2.w;
MUL R1.x, R1.x, R2.w;
MAD R4, R1.xxxx, diffuse_1, R4;

 

Then remove the next few ones as well (each paragraph is a light). See if it makes a difference (this is the night/insides vertex program).

 

I removed all but light_position_0 and now it works at night too.

 

anim and anim_shadow seem to be the critical ones, I'll try to find out how many light can stay in there for my X1600.

Share this post


Link to post
Share on other sites
Okay, I will rewrite it.

 

Not really. I have other vertex programs working just fine on my Mac. The problem is somewhere in EL's use of OpenGL (or the use of SDL on top of OpenGL).

 

I have an ATI X1600.

 

A while back I noticed that we would sometimes drop into software rendering. I wonder if that is happening again...

 

I am sure they work fine on your Mac, but this is not because the vertex programs we have are bad. It's because the video card you have can not handle long enough vertex programs (cheap/old hardware). Same problem with the Intel cards.

Share this post


Link to post
Share on other sites
I am sure they work fine on your Mac, but this is not because the vertex programs we have are bad. It's because the video card you have can not handle long enough vertex programs (cheap/old hardware). Same problem with the Intel cards.

By this logic, the latest MacBook Pro with NVIDIA GeForce 8600M GT should run EL just fine? I might be able to test this on a friends computer. The GPU was upgraded in June 2007 for the MacBook Pro line.

 

I am not accusing the vertex programs of being bad. I am saying that I think there is a fundamental problem with how OpenGL is being setup on the Macs with respect to SDL. I just updated all my SDL libraries to see if that makes a difference. Although performance is poor, I do get textures now when Shadow Mapping is enabled. Trying to change screen resolution crashed the game though.

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread:  0

Thread 0 Crashed:
0   GLEngine						  0x16449d07 gleRunVertexSubmitImmediate + 407
1   GLEngine						  0x16447eca gleLLVMArrayFunc + 90
2   GLEngine						  0x16447e57 gleSetVertexArrayFunc + 151
3   GLEngine						  0x164233ea gleDrawArraysOrElements_ExecCore + 266
4   GLEngine						  0x164258dd gleDrawArraysOrElements_VBO_Exec + 1341
5   libGL.dylib				   	0x90747b08 glDrawElements + 120
6   net.0ctane.EternalLands	   	0x00109d6d render_mesh_shader(actor_types*, actor*, int, HardwareMeshData const&, bool) + 825
7   net.0ctane.EternalLands	   	0x0010a188 cal_render_actor_shader + 650
8   net.0ctane.EternalLands	   	0x00014e1c draw_actor_without_banner + 453
9   net.0ctane.EternalLands	   	0x00014f79 display_actors + 303
10  net.0ctane.EternalLands	   	0x000dc543 display_shadows + 236
11  net.0ctane.EternalLands	   	0x000dcf02 render_light_view + 791
12  net.0ctane.EternalLands	   	0x00094935 display_game_handler + 439
13  net.0ctane.EternalLands	   	0x0003b25b draw_window + 394
14  net.0ctane.EternalLands	   	0x0003b351 display_windows + 94
15  net.0ctane.EternalLands	   	0x000326d6 draw_scene + 264
16  net.0ctane.EternalLands	   	0x000b72c6 start_rendering + 350
17  net.0ctane.EternalLands	   	0x000b75a6 SDL_main + 47
18  net.0ctane.EternalLands	   	0x00002f05 -[SDLMain applicationDidFinishLaunching:] + 56

Share this post


Link to post
Share on other sites
By this logic, the latest MacBook Pro with NVIDIA GeForce 8600M GT should run EL just fine? I might be able to test this on a friends computer. The GPU was upgraded in June 2007 for the MacBook Pro line.

On the other OSes, this card works fine, so I would assume it should work on Mac too, but the Mac drivers might be not so updated, so i don't know.

 

I am not accusing the vertex programs of being bad. I am saying that I think there is a fundamental problem with how OpenGL is being setup on the Macs with respect to SDL. I just updated all my SDL libraries to see if that makes a difference. Although performance is poor, I do get textures now when Shadow Mapping is enabled.

That's strange, because SDL is supossed to just start the OpenGL, and sort of get out of the way, if it interferes with the vertex programs then something is really wrong, either with SDL or with the OpenGL drivers.

 

 

Trying to change screen resolution crashed the game though.

This is a known problem, happens on most of the videocards/OSes, but it's such a big and nasty problem that it would take a lot of time to fix (maybe weeks, if not more), so we decided to just ignore it for now (changing resolutions is not a really big deal, you do it once and that's it).

Disabling VBO does help though.

Share this post


Link to post
Share on other sites

Night (anim.vert): removed lights 5, 6, 7, shaders work.

 

Day (anim_shadow.vert): original CVS with lights 0, 5,6,7, shaders work.

 

/EDIT

night&day: anim.vert with light 0, 5,6,7 enabled also works.

 

Very wild guess: maybe the lights used in the shaders must also be enabled in the scene?

Edited by Florian

Share this post


Link to post
Share on other sites

No, the problem is not with the lights, the problem is with the code (too big with those lights). Some video cards have lower limits on how big the code can be.

Anyway, the day lights can be removed safely, except for 0, 5 6 and 7 (0 is the sun, the last 3 is for eye candy).

At night though, removing any lights will cause issues (like your char not being lit properly and stuff). So better to disable the last (eye candy) lights.

Share this post


Link to post
Share on other sites

BTW, I disabled vertex programs on my windows box, too (removed the *.vert files) and now EL runs much smoother, especially in crowded areas.

 

Maybe the option to turn off vertex programs should be in all clients.

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×