project-navigation
Personal tools

Author Topic: GLSL shaders NOT available -- what happens?  (Read 7960 times)

Offline keybounce

  • Sergeant
  • *****
  • Posts: 330
    • View Profile
GLSL shaders NOT available -- what happens?
« on: May 25, 2010, 10:04:25 pm »
When GLSL shaders are not available, what happens, code-wise?

On PC's, or Linux, when GLSL shaders are turned off, do the graphics work properly?

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: GLSL shaders NOT available -- what happens?
« Reply #1 on: May 26, 2010, 08:04:29 am »
the short answer is: yes - but not so nice of course.

Offline keybounce

  • Sergeant
  • *****
  • Posts: 330
    • View Profile
Re: GLSL shaders NOT available -- what happens?
« Reply #2 on: May 26, 2010, 04:36:45 pm »
So the lighting and shadows are OK?

What's the code path? What section of code is executed to create the map view?

EDIT: More specifically, lets say I wanted to re-display the map after each triangle of "ground" was placed. Where is the ground loaded from the file, and the triangle added to the map?
« Last Edit: May 26, 2010, 04:38:33 pm by keybounce »

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: GLSL shaders NOT available -- what happens?
« Reply #3 on: May 26, 2010, 07:56:25 pm »
the map is loaded in src/client/renderer/r_model_brush.c/h, the bsp is build up in src/client/renderer/r_bsp.c and the surfaces are rendered in src/client/renderer/r_surface.c

Offline keybounce

  • Sergeant
  • *****
  • Posts: 330
    • View Profile
Re: GLSL shaders NOT available -- what happens?
« Reply #4 on: May 27, 2010, 05:05:54 am »
Alright, is this reasonable?
Code: [Select]
(gdb) list
60 static void R_ModLoadLighting (const lump_t *l, qboolean day)
61 {
62 r_worldmodel->bsp.lightdata = Mem_PoolAlloc(l->filelen, vid_lightPool, 0);
63 r_worldmodel->bsp.lightquant = *(const byte *) (mod_base + l->fileofs);
64 memcpy(r_worldmodel->bsp.lightdata, mod_base + l->fileofs, l->filelen);
65 debug(r_worldmodel->bsp.lightdata);
66 }
67
68 static void R_ModLoadVertexes (const lump_t *l)
69 {
(gdb) p l->fileofs
$2 = 1426600
(gdb) p l->filelen
$3 = 286387
(gdb) p r_worldmodel->bsp.lightdata
$4 = (byte *) 0x2d57202c "\006BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?????BBB?^^L~?BBB?BBB~?CCB~?BBB?BBB?BBB?BBB?BBB?BBB?DDC~?JJE~???~~?BBB?BBB?BBB?BBB?BBB?BBB?BBB?????BBB?B"...
(gdb)
I'm loading the wilderness map. If I'm reading this correctly, then memcpy has just copies 286,000 bytes for the lightmap data. Is that a reasonable size for light information? Does that look like valid lighting information?

What really makes this odd: I'm still getting the occasional "perfect" load, and about 75-90% odd shadow. That spectacular failure isn't repeating.

(debug() is just a convenient place to put a gdb breakpoint)

===
What is done by the GLSL shaders when they are available, and where is that action triggered?
What fallback path happens when they are not?

Is there an "if (glsl_shaders) {foo} else {bar}" point?

Offline keybounce

  • Sergeant
  • *****
  • Posts: 330
    • View Profile
Re: GLSL shaders NOT available -- what happens?
« Reply #5 on: May 27, 2010, 05:24:30 am »
Ok, a little farther:
Code: [Select]
131 * @brief Use the vertex, texture and normal arrays to draw a surface
132 * @sa R_DrawSurfaces
133 */
134 static inline void R_DrawSurface (const mBspSurface_t *surf)
135 {
136 debug(0);
137 glDrawArrays(GL_POLYGON, surf->index, surf->numedges);
138
139 if (r_showbox->integer == 2)
140 R_DrawBoundingBox(surf->mins, surf->maxs);
(gdb) p surf->index
$7 = 18763
(gdb) p surf->numedges
$8 = 4
(gdb) p surf
$9 = (const mBspSurface_t *) 0x2e552c8c
(gdb) p *$
$10 = {
  plane = 0x2d5c102c,
  flags = 2,
  tile = 0,
  frame = 2,
  firstedge = 18763,
  numedges = 4,
  stmins = {4992, -2688},
  stmaxs = {6080, -2304},
  stcenter = {5536, -2496},
  stextents = {1088, 384},
  mins = {1486.40002, 768, 6},
  maxs = {1788.80005, 856, 6},
  center = {1637.6001, 812, 6},
  color = {0, 0, 0, 1},
  normal = {0, 0, 1},
  light_s = 1941,
  light_t = 14,
  lightmap_scale = 64,
  index = 18763,
  tracenum = 0,
  texinfo = 0x2b15d02c,
  flare = 0x0,
  lightmap_texnum = 1024,
  deluxemap_texnum = 1280,
  samples = 0x2d5a7d4b "BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BBB?BB"...,
  lightmap = 0x2b06ea6c '?' <repeats 200 times>...,
  lightframe = 0,
  lights = 0,
  isOriginBrushModel = qfalse
}
glDrawArrays looks interesting. It is being given a type (polygon), an index, and number of corners (4; so much for my thought that everything was triangles), but it isn't given a list of verticies, only index and count.

"Samples" and "lightmap": Are those values reasonable? Should they be initialized by this point?

Offline keybounce

  • Sergeant
  • *****
  • Posts: 330
    • View Profile
Re: GLSL shaders NOT available -- what happens?
« Reply #6 on: June 07, 2010, 07:06:37 am »
Bump

What is done by the GLSL shaders when they are available, and where is that action triggered?
What fallback path happens when they are not?

Is there an "if (glsl_shaders) {foo} else {bar}" point?

As I said, I've got one PPC machine with GLSL support, and it displays fine, but at 25 seconds per frame is unplayable. We know that the PPC compiled maps work fine on i386, so it's probably not the map editor or the map compiler (yet i386 compiled maps are so much worse on the PPC); we know that i386 with GLSL turned off looks good, so that leaves something about PPC software light generation.

I am out of my league here; I don't know what to look for, or what values are reasonable. Can someone who knows this please add some debugging output to the code so this can be identified? Thank you.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: GLSL shaders NOT available -- what happens?
« Reply #7 on: June 07, 2010, 10:07:59 am »
it would be nice if you could open a bug tracker item and assign it to arisian - maybe he knows more.

Offline keybounce

  • Sergeant
  • *****
  • Posts: 330
    • View Profile
Re: GLSL shaders NOT available -- what happens?
« Reply #8 on: June 13, 2010, 03:28:14 am »
Done -- 3015331

Offline steve1234

  • Cannon Fodder
  • **
  • Posts: 1
    • View Profile
Re: GLSL shaders NOT available -- what happens?
« Reply #9 on: January 06, 2011, 07:17:07 am »
its very strange and unexpected error i read in this post..... so far i'm not troubled by the    
GLSL shaders and its available on my pc....... but thanks for the advance error solution if i face this problem in future then i will go through with this thread..... thanks