Jump to content

Error shader max indexes hit


Recommended Posts

i know only 3 way for fix it.

1 - remove the SHADER file of the mud trooper

2 - use openjk , should have raise the limit of buffer of shader fuck crash

3 - edit the source code of JKA for uncheck the line of command that cause the crash and fire the error. (i did that on my edited code)

Link to comment
  • 2 months later...

i know only 3 way for fix it.

1 - remove the SHADER file of the mud trooper

2 - use openjk , should have raise the limit of buffer of shader fuck crash

3 - edit the source code of JKA for uncheck the line of command that cause the crash and fire the error. (i did that on my edited code)

Do not tell me, but how can I make 3 option. I will be very grateful.

Link to comment

Do not tell me, but how can I make 3 option. I will be very grateful.

 

if openjk developer not changed it, you can find into tr_shade.cpp of the vanilla renderers code

 

void RB_EndSurface( void ) {
    shaderCommands_t *input;

    input = &tess;

    if (input->numIndexes == 0) {
        return;
    }

    if (input->indexes[SHADER_MAX_INDEXES-1] != 0) {
        Com_Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_INDEXES hit");
    }    
    if (input->xyz[SHADER_MAX_VERTEXES-1][0] != 0) {
        Com_Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_VERTEXES hit");
    }

for deactivate set as commented out the strings of error, like in that way:

/*

  if (input->indexes[sHADER_MAX_INDEXES-1] != 0) {

        Com_Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_INDEXES hit");

    }  */

 

 here is the source of the trouble: q_files.h

#define    SHADER_MAX_VERTEXES    1000

#define    SHADER_MAX_INDEXES    (6*SHADER_MAX_VERTEXES)

as you can see, here is set the infamous limit of mesh complexity. a mesh cannot have more of 1000 vertexes, and this is valid on default JKA, for MD3 models and for GLM too.

the shader indexes on my code is about 6000 as max value, but for what i know into the new versions of openjk, the limit should be doubled, at least for Multiplayer, not sure about single player.

CAREFUL: comment out only the comment that cause the crash Com_Error. this code affect the game rendering. Edit that without know exactly what are you doing can have unpredictable effects on the game!

i reccomand you to make a back up of all game executables and dll before override with the edited code.

 

 

 

 

 

this not solve the issue cause HD models can cause annoying lags, but at least you shut down this boring error message.

Artemisuss likes this
Link to comment

if openjk developer not changed it, you can find into tr_shade.cpp of the vanilla renderers code

void RB_EndSurface( void ) {
    shaderCommands_t *input;

    input = &tess;

    if (input->numIndexes == 0) {
        return;
    }

    if (input->indexes[SHADER_MAX_INDEXES-1] != 0) {
        Com_Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_INDEXES hit");
    }    
    if (input->xyz[SHADER_MAX_VERTEXES-1][0] != 0) {
        Com_Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_VERTEXES hit");
    }

for deactivate set as commented out the strings of error, like in that way:

/*

  if (input->indexes[sHADER_MAX_INDEXES-1] != 0) {

        Com_Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_INDEXES hit");

    }  */

 

 here is the source of the trouble: q_files.h

#define    SHADER_MAX_VERTEXES    1000

#define    SHADER_MAX_INDEXES    (6*SHADER_MAX_VERTEXES)

as you can see, here is set the infamous limit of mesh complexity. a mesh cannot have more of 1000 vertexes, and this is valid on default JKA, for MD3 models and for GLM too.

the shader indexes on my code is about 6000 as max value, but for what i know into the new versions of openjk, the limit should be doubled, at least for Multiplayer, not sure about single player.

CAREFUL: comment out only the comment that cause the crash Com_Error. this code affect the game rendering. Edit that without know exactly what are you doing can have unpredictable effects on the game!

i reccomand you to make a back up of all game executables and dll before override with the edited code.

 

 

 

 

 

this not solve the issue cause HD models can cause annoying lags, but at least you shut down this boring error message.

Thank you, kindness, love and prosperity.

Link to comment

for deactivate set as commented out the strings of error, like in that way:

/*

  if (input->indexes[sHADER_MAX_INDEXES-1] != 0) {

        Com_Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_INDEXES hit");

    }  */

 

 here is the source of the trouble: q_files.h

#define    SHADER_MAX_VERTEXES    1000

#define    SHADER_MAX_INDEXES    (6*SHADER_MAX_VERTEXES)

as you can see, here is set the infamous limit of mesh complexity.

More likely you'll cause the game to crash or render weird things.

That error is a precaution, because if you index an array out of bounds and write to it you may write to a protected memory page and cause an access violation/segfault, probably the most common type of crash.

 

Let's look at how these indexes are stored:

struct shaderCommands_s
{
glIndex_t indexes[SHADER_MAX_INDEXES] QALIGN(16);
vec4_t xyz[SHADER_MAX_VERTEXES] QALIGN(16);
vec4_t normal[SHADER_MAX_VERTEXES] QALIGN(16);
vec2_t texCoords[SHADER_MAX_VERTEXES][NUM_TEX_COORDS] QALIGN(16);
// ...
}

You haven't actually raised the limit on how many indices, vertices, normals or UV coords a model can use, you've just stopped it alerting you when you load a model that's too big to fit in the pre-allocated memory.

So if you do manage to load that model and it has too many indices for basejk, you'll start overwriting the positions of your vertices (because that's the next item in the struct). You probably won't get a crash in this case but your models will get royally fucked up.

 

Note there is no "error" or bug or issue here, everything is working 100% as intended. There is only a certain amount of memory allocated for loading models. It errors out instead of loading/rendering corrupted data.

A better solution would be to increase the amount of memory allocated (e.g. by increasing that define) or rewrite how models are loaded entirely (e.g. sparse/lazy allocation instead of pre-allocated chunks).

Link to comment

More likely you'll cause the game to crash or render weird things.

That error is a precaution, because if you index an array out of bounds and write to it you may write to a protected memory page and cause an access violation/segfault, probably the most common type of crash.

 

Let's look at how these indexes are stored:

struct shaderCommands_s
{
glIndex_t indexes[SHADER_MAX_INDEXES] QALIGN(16);
vec4_t xyz[SHADER_MAX_VERTEXES] QALIGN(16);
vec4_t normal[SHADER_MAX_VERTEXES] QALIGN(16);
vec2_t texCoords[SHADER_MAX_VERTEXES][NUM_TEX_COORDS] QALIGN(16);
// ...
}

You haven't actually raised the limit on how many indices, vertices, normals or UV coords a model can use, you've just stopped it alerting you when you load a model that's too big to fit in the pre-allocated memory.

So if you do manage to load that model and it has too many indices for basejk, you'll start overwriting the positions of your vertices (because that's the next item in the struct). You probably won't get a crash in this case but your models will get royally fucked up.

 

Note there is no "error" or bug or issue here, everything is working 100% as intended. There is only a certain amount of memory allocated for loading models. It errors out instead of loading/rendering corrupted data.

A better solution would be to increase the amount of memory allocated (e.g. by increasing that define) or rewrite how models are loaded entirely (e.g. sparse/lazy allocation instead of pre-allocated chunks).

Thanks for the better explanation. honestly i had not a minimal idea or how to solve this trouble so i warned artemis that i was not sure that is the correct solution. i am fighting from years with the memory buffer allocations trouble. cause it is a pain in the ass for me, expecially the weapons number and force power limit to 32 bit slots and the menu limitations. i raised up NPC, SAB,  visual FX and Menu buffer memory... but only 3 days ago i see how to replace the STAT_WEAPONS for raise the weapon limit and now i am testing how may weapons can effectly store the engine. i never gone deep on the issue of HD models, probabliy cause i'm loving vintage games so for me is not a big deal not have HD photorealistic modles into JKA. 

 

mmm so

 

 

struct shaderCommands_s
{
glIndex_t indexes[SHADER_MAX_INDEXES] QALIGN(32);
vec4_t xyz[SHADER_MAX_VERTEXES] QALIGN(32);
vec4_t normal[SHADER_MAX_VERTEXES] QALIGN(32);
vec2_t texCoords[SHADER_MAX_VERTEXES][NUM_TEX_COORDS] QALIGN(32);
// ...
}
 
this edit can solve the problem of artemis? it should allow to models to double the numbers of vertex and shader indexes... not sure of that, honestly i not understand much of bit math. 
 
 
Link to comment

The QALIGN there is to do with https://en.wikipedia.org/wiki/Data_structure_alignment so increasing that won't help. You need to increase the value of SHADER_MAX_INDEXESSHADER_MAX_VERTEXESNUM_TEX_COORDS

uuuh, all limits of JKA code are related to bit maths... i fought for years with the bit maths of weapons and only recently i raise the limit to the max that can really support the engine (256 weapon slots.)

mmm...,so is necessary to change to another value, like 32, the value of the max indexes of shader and vertexes, and also to fix the q_algin value for match with this edit? (for example, they shoould be both on 32, i guess)...

sorry if i am shooting silly things, but i confess that i not understand much the bit math code related things.

consider that i never finished high schools, so i lack of a lot of match knowledge. i have just the basic algebra knowledges of polinomes expressions.

Link to comment

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
×
×
  • Create New...