mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Diffuse map bit and _prprograminfo for storing possible uniform and attributes locations.
git-svn-id: https://svn.eduke32.com/eduke32@1162 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
3faee810e5
commit
b8c7125222
2 changed files with 35 additions and 4 deletions
|
@ -132,6 +132,7 @@ typedef struct s_prlight {
|
||||||
#define PR_INFO_LOG_BUFFER_SIZE 512
|
#define PR_INFO_LOG_BUFFER_SIZE 512
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
PR_BIT_DIFFUSE_MAP,
|
||||||
PR_BIT_DIFFUSE_MODULATION,
|
PR_BIT_DIFFUSE_MODULATION,
|
||||||
PR_BIT_DEFAULT, // must be just before last
|
PR_BIT_DEFAULT, // must be just before last
|
||||||
PR_BIT_COUNT // must be last
|
PR_BIT_COUNT // must be last
|
||||||
|
@ -145,6 +146,10 @@ typedef struct s_prprogrambit {
|
||||||
char* frag_prog;
|
char* frag_prog;
|
||||||
} _prprogrambit;
|
} _prprogrambit;
|
||||||
|
|
||||||
|
typedef struct s_prrograminfo {
|
||||||
|
GLhandleARB handle;
|
||||||
|
} _prprograminfo;
|
||||||
|
|
||||||
// CONTROL
|
// CONTROL
|
||||||
extern int updatesectors;
|
extern int updatesectors;
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,20 @@ int lightcount;
|
||||||
|
|
||||||
// PROGRAMS
|
// PROGRAMS
|
||||||
_prprogrambit prprogrambits[PR_BIT_COUNT] = {
|
_prprogrambit prprogrambits[PR_BIT_COUNT] = {
|
||||||
|
{
|
||||||
|
1 << PR_BIT_DIFFUSE_MAP,
|
||||||
|
// vert_def
|
||||||
|
"",
|
||||||
|
// vert_prog
|
||||||
|
"gl_TexCoord[0] = gl_MultiTexCoord0;\n"
|
||||||
|
"\n",
|
||||||
|
// frag_def
|
||||||
|
"uniform sampler2D diffuseMap;\n"
|
||||||
|
"\n",
|
||||||
|
// frag_prog
|
||||||
|
" result *= texture2D(diffuseMap, gl_TexCoord[0].st);\n"
|
||||||
|
"\n",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
1 << PR_BIT_DIFFUSE_MODULATION,
|
1 << PR_BIT_DIFFUSE_MODULATION,
|
||||||
// vert_def
|
// vert_def
|
||||||
|
@ -157,7 +171,7 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
GLhandleARB prprograms[1 << PR_BIT_COUNT];
|
_prprograminfo prprograms[1 << PR_BIT_COUNT];
|
||||||
|
|
||||||
// CONTROL
|
// CONTROL
|
||||||
GLdouble spritemodelview[16];
|
GLdouble spritemodelview[16];
|
||||||
|
@ -1039,6 +1053,8 @@ static void polymer_drawplane(short sectnum, short wallnum, _prplane* pl
|
||||||
OMGDRAWSHIT;
|
OMGDRAWSHIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bglUseProgramObjectARB(0);
|
||||||
|
|
||||||
// if ((depth < 1) && (plane->plane != NULL) &&
|
// if ((depth < 1) && (plane->plane != NULL) &&
|
||||||
// (wallnum >= 0) && (wall[wallnum].overpicnum == 560)) // insert mirror condition here
|
// (wallnum >= 0) && (wall[wallnum].overpicnum == 560)) // insert mirror condition here
|
||||||
// {
|
// {
|
||||||
|
@ -2591,17 +2607,27 @@ static void polymer_bindmaterial(_prmaterial material)
|
||||||
|
|
||||||
// --------- bit validation
|
// --------- bit validation
|
||||||
|
|
||||||
|
// PR_BIT_DIFFUSE_MAP
|
||||||
|
if (material.diffusemap)
|
||||||
|
programbits |= prprogrambits[PR_BIT_DIFFUSE_MAP].bit;
|
||||||
|
|
||||||
// PR_BIT_DIFFUSE_MODULATION
|
// PR_BIT_DIFFUSE_MODULATION
|
||||||
if ((material.diffusemodulation[0] != 1.0f) || (material.diffusemodulation[1] != 1.0f) ||
|
if ((material.diffusemodulation[0] != 1.0f) || (material.diffusemodulation[1] != 1.0f) ||
|
||||||
(material.diffusemodulation[2] != 1.0f) || (material.diffusemodulation[3] != 1.0f))
|
(material.diffusemodulation[2] != 1.0f) || (material.diffusemodulation[3] != 1.0f))
|
||||||
programbits |= prprogrambits[PR_BIT_DIFFUSE_MODULATION].bit;
|
programbits |= prprogrambits[PR_BIT_DIFFUSE_MODULATION].bit;
|
||||||
|
|
||||||
// --------- program compiling
|
// --------- program compiling
|
||||||
if (!prprograms[programbits])
|
if (!prprograms[programbits].handle)
|
||||||
polymer_compileprogram(programbits);
|
polymer_compileprogram(programbits);
|
||||||
|
|
||||||
// --------- bit setup
|
// --------- bit setup
|
||||||
|
|
||||||
|
// PR_BIT_DIFFUSE_MAP
|
||||||
|
if (programbits & prprogrambits[PR_BIT_DIFFUSE_MAP].bit)
|
||||||
|
{
|
||||||
|
bglBindTexture(GL_TEXTURE_2D, material.diffusemap);
|
||||||
|
}
|
||||||
|
|
||||||
// PR_BIT_DIFFUSE_MODULATION
|
// PR_BIT_DIFFUSE_MODULATION
|
||||||
if (programbits & prprogrambits[PR_BIT_DIFFUSE_MODULATION].bit)
|
if (programbits & prprogrambits[PR_BIT_DIFFUSE_MODULATION].bit)
|
||||||
{
|
{
|
||||||
|
@ -2611,7 +2637,7 @@ static void polymer_bindmaterial(_prmaterial material)
|
||||||
material.diffusemodulation[3]);
|
material.diffusemodulation[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bglUseProgramObjectARB(prprograms[programbits]);
|
bglUseProgramObjectARB(prprograms[programbits].handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void polymer_compileprogram(int programbits)
|
static void polymer_compileprogram(int programbits)
|
||||||
|
@ -2675,7 +2701,7 @@ static void polymer_compileprogram(int programbits)
|
||||||
|
|
||||||
bglGetInfoLogARB(program, PR_INFO_LOG_BUFFER_SIZE, NULL, infobuffer);
|
bglGetInfoLogARB(program, PR_INFO_LOG_BUFFER_SIZE, NULL, infobuffer);
|
||||||
|
|
||||||
prprograms[programbits] = program;
|
prprograms[programbits].handle = program;
|
||||||
|
|
||||||
if (pr_verbosity >= 1) OSD_Printf("Compiling GPU program with bits %i...\n", programbits);
|
if (pr_verbosity >= 1) OSD_Printf("Compiling GPU program with bits %i...\n", programbits);
|
||||||
if (infobuffer[0])
|
if (infobuffer[0])
|
||||||
|
|
Loading…
Reference in a new issue