project-navigation
Personal tools

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - dodon

Pages: [1]
1
Bugs prior to release 2.4 / random map assembly not random
« on: July 17, 2010, 10:26:36 pm »
if the cvar "sv_threads" is not 0 (default since r03484) the layout of RMAs is always the same.

examples from ufoconsole.log:
Code: [Select]
2010/07/17 21:53:15 CM_LoadMap: "-africa/af_ +craft_ufo_scout +craft_drop_firebird +empty1 +empty2 +house1 +house2 +house3 +house4 +house5 +fence3 +misc1 +fence1 +misc1 +misc1" "0 -8 0 -24 -16 0 -24 8 0 16 8 0 16 0 0 -8 0 0 8 8 0 0 -16 0 -8 8 0 -16 8 0 -8 -8 0 -8 -16 0 16 -8 0 16 -16 0"
2010/07/17 21:53:42 CM_LoadMap: "-africa/af_ +craft_ufo_scout +craft_drop_firebird +empty1 +empty2 +house1 +house2 +house3 +house4 +house5 +fence3 +misc1 +fence1 +misc1 +misc1" "0 -8 0 -24 -16 0 -24 8 0 16 8 0 16 0 0 -8 0 0 8 8 0 0 -16 0 -8 8 0 -16 8 0 -8 -8 0 -8 -16 0 16 -8 0 16 -16 0"
2010/07/17 21:56:10 CM_LoadMap: "-africa/af_ +craft_ufo_scout +craft_drop_firebird +empty1 +empty2 +house1 +house2 +house3 +house4 +house5 +fence3 +misc1 +fence1 +misc1 +misc1" "0 -8 0 -24 -16 0 -24 8 0 16 8 0 16 0 0 -8 0 0 8 8 0 0 -16 0 -8 8 0 -16 8 0 -8 -8 0 -8 -16 0 16 -8 0 16 -16 0"

The reason for this behaviour is, that the threads, that create the maps always use the same sequence of random numbers due to a missing "srand" command.

I atached a quickfix for this problem.
It's a quickfix, because ...
  • it might break some testcode
  • with more than one thread the probability all threads use the same seed is high

 




2
Coding / Assertions in dbuffer.c
« on: July 07, 2010, 10:18:56 pm »
In the recent trunk versions I encountered several assertions in dbuffer.c while in battlescape. Most of the time in my second turn.

The location of the assertions change but the circumstances are similat to this code (I changed the code to highlight the problem):

Code: [Select]
static struct dbuffer_element * allocate_element (void)
{
struct dbuffer_element *e;

if (free_elements == 0) {
struct dbuffer_element *newBuf = Mem_PoolAlloc(sizeof(struct dbuffer_element), com_genericPool, 0);
newBuf->next = free_element_list;
free_element_list = newBuf;
free_elements++;
allocated_elements++;
} else {
assert(free_element_list);
}

...
}


The important detail is: when the assertions happens, the value of free_elements is 0 although it should not be 0.


The only way i came up to get such a result is a second thread which accesses an other function in dbuffer.c and channges free_elements. I did some other tests that confirm my assumption.


What's the general strategy to handle multiple thread access of resources in Ufo AI ?
What's the best way to secure the global data in dbuffer.c ?

3
Bugs prior to release 2.3 / Texture missing (r29530)
« on: April 25, 2010, 08:45:54 am »

In Geoscape the texture for the earth is missing.  :(

excerpt from Console.log:

Quote
2010/04/25 08:16:00 R_LoadShader: world_vs.glsl: Vertex shader failed to compile with the following errors:
ERROR: 0:10: '' :  #version must occur before any other statement in the program
ERROR: 1 compilation errors.  No code generated.


2010/04/25 08:16:00 R_LoadShader: world_fs.glsl: Fragment shader failed to compile with the following errors:
ERROR: 0:10: '' :  #version must occur before any other statement in the program
ERROR: 1 compilation errors.  No code generated.


2010/04/25 08:16:00 R_LoadProgram: world: Warning: No shaders attached to current program

2010/04/25 08:16:00 R_LoadShader: mesh_vs.glsl: Vertex shader failed to compile with the following errors:
ERROR: 0:10: '' :  #version must occur before any other statement in the program
ERROR: 1 compilation errors.  No code generated.


2010/04/25 08:16:00 R_LoadShader: mesh_fs.glsl: Fragment shader failed to compile with the following errors:
ERROR: 0:10: '' :  #version must occur before any other statement in the program
ERROR: 1 compilation errors.  No code generated.


2010/04/25 08:16:00 R_LoadProgram: mesh: Warning: No shaders attached to current program

2010/04/25 08:16:00 R_LoadProgram: 'warp' loaded.
2010/04/25 08:16:00 R_LoadShader: geoscape_vs.glsl: Vertex shader failed to compile with the following errors:
ERROR: 0:10: '' :  #version must occur before any other statement in the program
ERROR: 1 compilation errors.  No code generated.


2010/04/25 08:16:00 R_LoadShader: geoscape_fs.glsl: Fragment shader failed to compile with the following errors:
ERROR: 0:10: '' :  #version must occur before any other statement in the program
ERROR: 1 compilation errors.  No code generated.


2010/04/25 08:16:00 R_LoadProgram: geoscape: Warning: No shaders attached to current program

The *.glsl files are OK but dependen on the detectet graphiccard in R_PreprocessShader (r_program.c) sometimes (with ATI, Intel and NVidea) defines are added at the beginning of the files.

As a quick fix i removed the #version line  from the files.

Pages: [1]