Author Topic: PS3.0 testers needed  (Read 25197 times)

0 Members and 1 Guest are viewing this topic.

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: PS3.0 testers needed
« Reply #40 on: May 16, 2007 »
yeahh ... it just works fine on NVIDIA GeForce 6800 GT !!! Rulez!
Very well done, Chris !!!

Excuse me here but ... oh thank god. That was *hard* to debug.
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: PS3.0 testers needed
« Reply #41 on: May 17, 2007 »
cool i know you need nvidia testers but it still works on my x1550 so good stuff.

so what was causing the problem taj?
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: PS3.0 testers needed
« Reply #42 on: May 17, 2007 »
Loops using a variable instead of a constant as the loop limit, by the sounds of things.

->Shockwave, been looking at graphics cards for myself recently, and was going to get a 7600GT, but now they've all vanished from the computer shops to be replaced with 8600GT for only a couple of quid extra.

Jim
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: PS3.0 testers needed
« Reply #43 on: May 17, 2007 »
Nino,

thanks for testing! It was a cracking problem I have to say. Jims basically right with the caveat that I must have a variable loop (or performance dies) so I had to find a way to do a variable loop on Nvidia hardware. The solution was easy once I knew the problem.

Heres the original code snippet that caused the problem:

Code: [Select]
float t=0.0;
do{
  t+=0.01;
  v = fract (p+0.5+t*d);
} while ( t<4.0 && length(v.xyz-0.5)<0.6 );

That while is the problem because the Nvidia cannot make branching decisions based on run time conditions.
The new version:

float t=0.0;
Code: [Select]
for ( int i=0; i<200; i++ ){
 t+=0.02;
 v = fract (p+0.5+t*d);
 if (length(v.xyz-0.5)>0.65) i=200;
}

The surprise for me was that the "if" worked fine. Strictly this is dynamic branching but it seems that because the loop
can be completely unrolled and the total instruction count known, this if is ok. The second surprise was that I could "fake" dynamic looping decisions by setting i=200 in the middle of the code. Very dirty of course but I think it works because it doesnt affect the number of instructions in a completely unrolled loop.

The new version is about 10 more bytes after compression so I needed to drop colour and texture :-(.

In the end what I now know is I need an Nvidia and an ATi card...thanks to everyone here who tested for me to help me understand all this.

Chris
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: PS3.0 testers needed
« Reply #44 on: May 17, 2007 »
Neat :)  You fail my software engineering course, but you pass the interview to be a games programmer!

Jim
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: PS3.0 testers needed
« Reply #45 on: May 17, 2007 »
cool! i guess sometimes you gota do what you gota do.
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: PS3.0 testers needed
« Reply #46 on: May 20, 2007 »
Works fine here (Geforce 6600GT), just a little bit slow but I guess I need a new PC and gfx board.

Well done man  :)




Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: PS3.0 testers needed
« Reply #47 on: May 20, 2007 »
Yeah baby! OK Ill work on speed too.

Thanks RB, U know u r the best at 1k so respect and thanks.
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: PS3.0 testers needed
« Reply #48 on: May 22, 2007 »
Ah, it pleases me to say that I have been able to run this now :D

Runs fine (about 20fps) Radeon X1650 256mb, P4 3.0 Ghz 512mb ram.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: PS3.0 testers needed
« Reply #49 on: May 22, 2007 »
Ah, it pleases me to say that I have been able to run this now :D

Runs fine (about 20fps) Radeon X1650 256mb, P4 3.0 Ghz 512mb ram.

And? Did u like it or not?
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: PS3.0 testers needed
« Reply #50 on: May 23, 2007 »
No, I didn't like it... I loved it.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: PS3.0 testers needed
« Reply #51 on: June 30, 2007 »

Here is a version that packs in a lot more which I hope works on NVIDIA. Can anyone with NVIDIA check?

- Requires GOOD ps3.0, so 5XXX and 6XXX series simply wont get good results if anything (but I hope 6XXX runs).


Its really experimental and pushes my x1800 to the limits. God knows if it will run anywhere else.

Chris
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: PS3.0 testers needed
« Reply #52 on: June 30, 2007 »
not nvidia here but works on X1650

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: PS3.0 testers needed
« Reply #53 on: June 30, 2007 »
StoneMonkey,

thanks for the test. I'm curious - on 1650 - I guess its < 10 frames per second yes? I know you have to guess as there is no counter.

Chris
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: PS3.0 testers needed
« Reply #54 on: June 30, 2007 »
Nice!

Run around 10 fps when the view is far from structure (like that image) and pretty fast when it's close.

GeForce 6600 GT
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: PS3.0 testers needed
« Reply #55 on: June 30, 2007 »
Thanks Rbraz for the test. I'm really pleased it runs on NVidia also, seems I'm getting the hang of shaders finally.
I'm impressed it runs on 6XXX series. Perhaps I underestimated Nvidia cards.

Chris
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: PS3.0 testers needed
« Reply #56 on: June 30, 2007 »
Will check this out later on the desktop :) The screenie looks nice though
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: PS3.0 testers needed
« Reply #57 on: June 30, 2007 »
The framerate went from about 15 fps right up to about 60 - 80 fps the lower frame rates happened when the scene was more zoomed out, as it zoomed in it became really smooth.

Colours look nice too, I am a big fan of Orange :D

(X1650 256mb)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: PS3.0 testers needed
« Reply #58 on: July 03, 2007 »
Just to let you know, I've finally got my new PC with an nVidia 8600GT and all the demos in this thread run OK.  The original version runs, is a bit choppy, and doesn't exit properly.  The B&W one works fine, and the latest one runs pretty much like Shockie describes.  I'm a very happy chap!

Jim
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: PS3.0 testers needed
« Reply #59 on: July 06, 2007 »
Thanks Jim.

As a sorta bonus for folks, here is the complete code of the intro. The program works by drawing a quad on the screen, the shader does almost all the rest of the work. Rbraz , you might be interested to note that I do a translate and rotate in my application code but I found its nearly twenty bytes smaller (!!!) to code that as glMultMatrixf with a static array of floats for the matrix than standard glRotate and glTranslate

Code: [Select]
// Chris Thornborrow (auld)... lalala credit would be nice ... lalala
// Example OGL + shaders in 1k
// Requires crinkler
// VS2005 modifications by benny!weltenkonstrukteur.de

#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "glext.h"

typedef void (*GenFP)(void); // any function ptr type would do
static GenFP glFP[7];

const static char* glnames[]={
      "glCreateShader", "glCreateProgram", "glShaderSource", "glCompileShader",
      "glAttachShader", "glLinkProgram", "glUseProgram"
};

// Draws the labyrinth using a pair of shaders...
// Vertex shader does NOT transform incoming vertex but stores that in p instead for later use
// The fragment shader is a complicated. It essentially raycasts into a constantly changing
// equation, similar in concept to chladni :-). Its carfully tuned so we dont crash into it as we move
// and so we get a feeling of depth. The for loop could be smaller when written as a do .. while but then
// it wouldnt work on NVidia cards of 7xxx series or below.
// Fragment shader has 2 lines for setup, 1 line for raycasting and function testing, 1 line for colour.

const char *labvsh="varying vec4 p;void main(){p=ftransform();gl_Position=gl_Vertex;}";
const char *labfsh="\
varying vec4 p;\
void main(){\
vec3 V=vec3(0,3.5*sin(p.z),p.z);\
vec3 D=vec3(p.x,p.y,0.5)*0.08;\
for(int i=800;i>0;i--,V+=D)if(length(fract(abs(sin(V))))>1.5+0.5*sin(V.z)*sin(p.z*0.4))i=0;\
gl_FragColor=vec4(1,0.8,0.8,0)*dot(vec3(0.4),fract(V))-length(V-p.xyz)*0.1;\
}";

static void setShaders() {
   //  19. April 2007: "(GenFP) cast" added by benny!weltenkonstrukteur.de
   for (int i=0; i<7; i++) glFP[i] = (GenFP)wglGetProcAddress(glnames[i]);

GLuint v = ((PFNGLCREATESHADERPROC)(glFP[0]))(GL_VERTEX_SHADER);
GLuint f = ((PFNGLCREATESHADERPROC)(glFP[0]))(GL_FRAGMENT_SHADER);
        GLuint p = ((PFNGLCREATEPROGRAMPROC)glFP[1])();
        ((PFNGLSHADERSOURCEPROC)glFP[2]) (v, 1, &labvsh, NULL);
((PFNGLSHADERSOURCEPROC)glFP[2]) (f, 1, &labfsh, NULL);
((PFNGLCOMPILESHADERPROC)glFP[3])(v);
((PFNGLCOMPILESHADERPROC)glFP[3])(f);
((PFNGLATTACHSHADERPROC)glFP[4])(p,v);
((PFNGLATTACHSHADERPROC)glFP[4])(p,f);
((PFNGLLINKPROGRAMPROC)glFP[5])(p);
((PFNGLUSEPROGRAMPROC) glFP[6])(p);
}


static PIXELFORMATDESCRIPTOR pfd;
static DEVMODE dmScreenSettings;

// This is an approximation to rotation by 1 degree round z axis
// because its an approximation, it deteriorates in time!!
// and a small translation (0.04) down the z axis

static const GLfloat m[16]={1,-0.01f,0,0,0.01f,1,0,0,0,0,1,0,0,0,0.04f,1};
 
void WINAPI WinMainCRTStartup()
{

   dmScreenSettings.dmSize=sizeof(dmScreenSettings);
   dmScreenSettings.dmPelsWidth = 640;
   dmScreenSettings.dmPelsHeight= 480;
   //dmScreenSettings.dmBitsPerPel = 32;
  // its risky to remove the flag and bits but probably safe on compo machine :-)
   dmScreenSettings.dmFields=DM_PELSWIDTH|DM_PELSHEIGHT;
   ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN); 
   
   // minimal windows setup code for opengl
   // risky but tested on 2xati cards and 1xnvidia8800
   //pfd.cColorBits = 32;
   pfd.dwFlags    = PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER;
   // "HDC hDC" changed 19. April 2007 by benny!weltenkonstrukteur.de
    HDC hDC = GetDC( CreateWindow("edit", 0, WS_POPUP|WS_VISIBLE|WS_MAXIMIZE, 0,0,0,0,0 0,0,0));
   SetPixelFormat ( hDC, ChoosePixelFormat ( hDC, &pfd) , &pfd );
   wglMakeCurrent ( hDC, wglCreateContext(hDC) );
   setShaders();
   ShowCursor(FALSE);
 
//**********************
// NOW THE MAIN LOOP...
//**********************
    // there is no depth test or clear  screen...as we draw in order and cover
    // the whole area of the screen. 
    do {
         //move forward and rotate slightly each frame
         //glMultMatrix is smaller (20 bytes) than glTranslatef and glRotatef!!
glMultMatrixf((const GLfloat*)&m);
         glRecti(-1,-1,1,1);
SwapBuffers(hDC);
    } while ( !GetAsyncKeyState(VK_ESCAPE) );
   // necessary under vista it seems... :-( extra bytes required.
   ExitProcess(0);
}

The cool thing is the intro works under XP/Vista, and all known Nvidia and ATi cards supporting PS3.0 (depsite all the quirks and bumps). Thats mostly thanks to help from DBF and some help from McZonk in Titan.

Chris
Challenge Trophies Won: