Skip to content

Commit

Permalink
Update ioq3 from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoeppe committed Jan 5, 2017
1 parent f36e658 commit b48ce63
Show file tree
Hide file tree
Showing 19 changed files with 111 additions and 104 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ with those projects are best fixed upstream and then merged into *DeepMind Lab*.

* *ioquake3* is taken from
[github.com/ioquake/ioq3](https://github.com/ioquake/ioq3),
revision 1c1e1f61f180596c925a4ac0eddba4806d1369cd. The code contains extensive
revision 0672905ef1b8f6ca219341e7252044dd727753dd. The code contains extensive
modifications and additions. We aim to merge upstream changes occasionally.

We are very grateful to the maintainers of these repositories for all their hard
Expand Down
2 changes: 1 addition & 1 deletion engine/code/renderercommon/qgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
GLE(GLvoid, TextureParameteriEXT, GLuint texture, GLenum target, GLenum pname, GLint param) \
GLE(GLvoid, TextureImage2DEXT, GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) \
GLE(GLvoid, TextureSubImage2DEXT, GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) \
GLE(GLvoid, CopyTextureImage2DEXT, GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) \
GLE(GLvoid, CopyTextureSubImage2DEXT, GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) \
GLE(GLvoid, CompressedTextureImage2DEXT, GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) \
GLE(GLvoid, CompressedTextureSubImage2DEXT, GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) \
GLE(GLvoid, GenerateTextureMipmapEXT, GLuint texture, GLenum target) \
Expand Down
4 changes: 2 additions & 2 deletions engine/code/renderergl2/tr_animation.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface )

R_VaoPackNormal(tess.normal[baseVertex + j], tempNormal);

tess.texCoords[baseVertex + j][0][0] = v->texCoords[0];
tess.texCoords[baseVertex + j][0][1] = v->texCoords[1];
tess.texCoords[baseVertex + j][0] = v->texCoords[0];
tess.texCoords[baseVertex + j][1] = v->texCoords[1];

v = (mdrVertex_t *)&v->weights[v->numWeights];
}
Expand Down
24 changes: 13 additions & 11 deletions engine/code/renderergl2/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,29 +895,29 @@ const void *RB_StretchPic ( const void *data ) {
tess.xyz[ numVerts ][1] = cmd->y;
tess.xyz[ numVerts ][2] = 0;

tess.texCoords[ numVerts ][0][0] = cmd->s1;
tess.texCoords[ numVerts ][0][1] = cmd->t1;
tess.texCoords[ numVerts ][0] = cmd->s1;
tess.texCoords[ numVerts ][1] = cmd->t1;

tess.xyz[ numVerts + 1 ][0] = cmd->x + cmd->w;
tess.xyz[ numVerts + 1 ][1] = cmd->y;
tess.xyz[ numVerts + 1 ][2] = 0;

tess.texCoords[ numVerts + 1 ][0][0] = cmd->s2;
tess.texCoords[ numVerts + 1 ][0][1] = cmd->t1;
tess.texCoords[ numVerts + 1 ][0] = cmd->s2;
tess.texCoords[ numVerts + 1 ][1] = cmd->t1;

tess.xyz[ numVerts + 2 ][0] = cmd->x + cmd->w;
tess.xyz[ numVerts + 2 ][1] = cmd->y + cmd->h;
tess.xyz[ numVerts + 2 ][2] = 0;

tess.texCoords[ numVerts + 2 ][0][0] = cmd->s2;
tess.texCoords[ numVerts + 2 ][0][1] = cmd->t2;
tess.texCoords[ numVerts + 2 ][0] = cmd->s2;
tess.texCoords[ numVerts + 2 ][1] = cmd->t2;

tess.xyz[ numVerts + 3 ][0] = cmd->x;
tess.xyz[ numVerts + 3 ][1] = cmd->y + cmd->h;
tess.xyz[ numVerts + 3 ][2] = 0;

tess.texCoords[ numVerts + 3 ][0][0] = cmd->s1;
tess.texCoords[ numVerts + 3 ][0][1] = cmd->t2;
tess.texCoords[ numVerts + 3 ][0] = cmd->s1;
tess.texCoords[ numVerts + 3 ][1] = cmd->t2;

return (const void *)(cmd + 1);
}
Expand Down Expand Up @@ -971,7 +971,9 @@ const void *RB_DrawSurfs( const void *data ) {
else if (tr.renderFbo == NULL && tr.renderDepthImage)
{
// If we're rendering directly to the screen, copy the depth to a texture
qglCopyTextureImage2DEXT(tr.renderDepthImage->texnum, GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 0, 0, glConfig.vidWidth, glConfig.vidHeight, 0);
// This is incredibly slow on Intel Graphics, so just skip it on there
if (!glRefConfig.intelGraphics)
qglCopyTextureSubImage2DEXT(tr.renderDepthImage->texnum, GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight);
}

if (tr.hdrDepthFbo)
Expand Down Expand Up @@ -1475,14 +1477,14 @@ const void *RB_CapShadowMap(const void *data)
{
if (tr.shadowCubemaps[cmd->map])
{
qglCopyTextureImage2DEXT(tr.shadowCubemaps[cmd->map]->texnum, GL_TEXTURE_CUBE_MAP_POSITIVE_X + cmd->cubeSide, 0, GL_RGBA8, backEnd.refdef.x, glConfig.vidHeight - ( backEnd.refdef.y + PSHADOW_MAP_SIZE ), PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, 0);
qglCopyTextureSubImage2DEXT(tr.shadowCubemaps[cmd->map]->texnum, GL_TEXTURE_CUBE_MAP_POSITIVE_X + cmd->cubeSide, 0, 0, 0, backEnd.refdef.x, glConfig.vidHeight - ( backEnd.refdef.y + PSHADOW_MAP_SIZE ), PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE);
}
}
else
{
if (tr.pshadowMaps[cmd->map])
{
qglCopyTextureImage2DEXT(tr.pshadowMaps[cmd->map]->texnum, GL_TEXTURE_2D, 0, GL_RGBA8, backEnd.refdef.x, glConfig.vidHeight - (backEnd.refdef.y + PSHADOW_MAP_SIZE), PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, 0);
qglCopyTextureSubImage2DEXT(tr.pshadowMaps[cmd->map]->texnum, GL_TEXTURE_2D, 0, 0, 0, backEnd.refdef.x, glConfig.vidHeight - (backEnd.refdef.y + PSHADOW_MAP_SIZE), PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions engine/code/renderergl2/tr_dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ GLvoid APIENTRY GLDSA_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint
qglTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
}

GLvoid APIENTRY GLDSA_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level, GLenum internalformat,
GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
GLvoid APIENTRY GLDSA_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height)
{
GL_BindMultiTexture(glDsaState.texunit, target, texture);
qglCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
qglCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}

GLvoid APIENTRY GLDSA_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level, GLenum internalformat,
Expand Down
4 changes: 2 additions & 2 deletions engine/code/renderergl2/tr_dsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ GLvoid APIENTRY GLDSA_TextureImage2DEXT(GLuint texture, GLenum target, GLint lev
GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
GLvoid APIENTRY GLDSA_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
GLvoid APIENTRY GLDSA_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level, GLenum internalformat,
GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
GLvoid APIENTRY GLDSA_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height);
GLvoid APIENTRY GLDSA_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level, GLenum internalformat,
GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
GLvoid APIENTRY GLDSA_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
Expand Down
9 changes: 7 additions & 2 deletions engine/code/renderergl2/tr_extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ void GLimp_InitExtraExtensions()
ri.Error(ERR_FATAL, "OpenGL 2.0 required!");
ri.Printf(PRINT_ALL, "...using OpenGL %s\n", glConfig.version_string);

// Check if we need Intel graphics specific fixes.
glRefConfig.intelGraphics = qfalse;
if (strstr((char *)qglGetString(GL_RENDERER), "Intel"))
glRefConfig.intelGraphics = qtrue;

// set DSA fallbacks
#define GLE(ret, name, ...) qgl##name = GLDSA_##name;
QGL_EXT_direct_state_access_PROCS;
Expand Down Expand Up @@ -159,8 +164,8 @@ void GLimp_InitExtraExtensions()
{
glRefConfig.framebufferObject = !!r_ext_framebuffer_object->integer;

glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE_EXT, &glRefConfig.maxRenderbufferSize);
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &glRefConfig.maxColorAttachments);
qglGetIntegerv(GL_MAX_RENDERBUFFER_SIZE_EXT, &glRefConfig.maxRenderbufferSize);
qglGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &glRefConfig.maxColorAttachments);

QGL_EXT_framebuffer_object_PROCS;

Expand Down
8 changes: 7 additions & 1 deletion engine/code/renderergl2/tr_fbo.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ FBO_Bind
*/
void FBO_Bind(FBO_t * fbo)
{
if (!glRefConfig.framebufferObject)
{
ri.Printf(PRINT_WARNING, "FBO_Bind() called without framebuffers enabled!\n");
return;
}

if (glState.currentFBO == fbo)
return;

Expand Down Expand Up @@ -265,7 +271,7 @@ void FBO_Init(void)
R_IssuePendingRenderCommands();

hdrFormat = GL_RGBA8;
if (r_hdr->integer && glRefConfig.framebufferObject && glRefConfig.textureFloat)
if (r_hdr->integer && glRefConfig.textureFloat)
hdrFormat = GL_RGBA16F_ARB;

if (glRefConfig.framebufferMultisample)
Expand Down
16 changes: 8 additions & 8 deletions engine/code/renderergl2/tr_flares.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ void RB_RenderFlare( flare_t *f ) {
// FIXME: use quadstamp?
tess.xyz[tess.numVertexes][0] = f->windowX - size;
tess.xyz[tess.numVertexes][1] = f->windowY - size;
tess.texCoords[tess.numVertexes][0][0] = 0;
tess.texCoords[tess.numVertexes][0][1] = 0;
tess.texCoords[tess.numVertexes][0] = 0;
tess.texCoords[tess.numVertexes][1] = 0;
tess.color[tess.numVertexes][0] = iColor[0];
tess.color[tess.numVertexes][1] = iColor[1];
tess.color[tess.numVertexes][2] = iColor[2];
Expand All @@ -414,8 +414,8 @@ void RB_RenderFlare( flare_t *f ) {

tess.xyz[tess.numVertexes][0] = f->windowX - size;
tess.xyz[tess.numVertexes][1] = f->windowY + size;
tess.texCoords[tess.numVertexes][0][0] = 0;
tess.texCoords[tess.numVertexes][0][1] = 1;
tess.texCoords[tess.numVertexes][0] = 0;
tess.texCoords[tess.numVertexes][1] = 1;
tess.color[tess.numVertexes][0] = iColor[0];
tess.color[tess.numVertexes][1] = iColor[1];
tess.color[tess.numVertexes][2] = iColor[2];
Expand All @@ -424,8 +424,8 @@ void RB_RenderFlare( flare_t *f ) {

tess.xyz[tess.numVertexes][0] = f->windowX + size;
tess.xyz[tess.numVertexes][1] = f->windowY + size;
tess.texCoords[tess.numVertexes][0][0] = 1;
tess.texCoords[tess.numVertexes][0][1] = 1;
tess.texCoords[tess.numVertexes][0] = 1;
tess.texCoords[tess.numVertexes][1] = 1;
tess.color[tess.numVertexes][0] = iColor[0];
tess.color[tess.numVertexes][1] = iColor[1];
tess.color[tess.numVertexes][2] = iColor[2];
Expand All @@ -434,8 +434,8 @@ void RB_RenderFlare( flare_t *f ) {

tess.xyz[tess.numVertexes][0] = f->windowX + size;
tess.xyz[tess.numVertexes][1] = f->windowY - size;
tess.texCoords[tess.numVertexes][0][0] = 1;
tess.texCoords[tess.numVertexes][0][1] = 0;
tess.texCoords[tess.numVertexes][0] = 1;
tess.texCoords[tess.numVertexes][1] = 0;
tess.color[tess.numVertexes][0] = iColor[0];
tess.color[tess.numVertexes][1] = iColor[1];
tess.color[tess.numVertexes][2] = iColor[2];
Expand Down
2 changes: 1 addition & 1 deletion engine/code/renderergl2/tr_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -2766,7 +2766,7 @@ void R_CreateBuiltinImages( void ) {
height = glConfig.vidHeight;

hdrFormat = GL_RGBA8;
if (r_hdr->integer && glRefConfig.framebufferObject && glRefConfig.textureFloat)
if (r_hdr->integer && glRefConfig.textureFloat)
hdrFormat = GL_RGBA16F_ARB;

rgbFormat = GL_RGBA8;
Expand Down
4 changes: 3 additions & 1 deletion engine/code/renderergl2/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,9 @@ void GL_SetDefaultState( void )
qglColor4f (1,1,1,1);

GL_BindNullTextures();
GL_BindNullFramebuffers();

if (glRefConfig.framebufferObject)
GL_BindNullFramebuffers();

qglEnable(GL_TEXTURE_2D);
GL_TextureMode( r_textureMode->string );
Expand Down
5 changes: 4 additions & 1 deletion engine/code/renderergl2/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,8 @@ typedef struct {
int openglMajorVersion;
int openglMinorVersion;

qboolean intelGraphics;

qboolean drawRangeElements;
qboolean multiDrawArrays;
qboolean occlusionQuery;
Expand Down Expand Up @@ -1983,7 +1985,8 @@ typedef struct shaderCommands_s
vec4_t xyz[SHADER_MAX_VERTEXES] QALIGN(16);
int16_t normal[SHADER_MAX_VERTEXES][4] QALIGN(16);
int16_t tangent[SHADER_MAX_VERTEXES][4] QALIGN(16);
vec2_t texCoords[SHADER_MAX_VERTEXES][2] QALIGN(16);
vec2_t texCoords[SHADER_MAX_VERTEXES] QALIGN(16);
vec2_t lightCoords[SHADER_MAX_VERTEXES] QALIGN(16);
uint16_t color[SHADER_MAX_VERTEXES][4] QALIGN(16);
int16_t lightdir[SHADER_MAX_VERTEXES][4] QALIGN(16);
//int vertexDlightBits[SHADER_MAX_VERTEXES] QALIGN(16);
Expand Down
4 changes: 2 additions & 2 deletions engine/code/renderergl2/tr_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,8 +1333,8 @@ qboolean R_MirrorViewBySurface (drawSurf_t *drawSurf, int entityNum) {
return qfalse; // bad portal, no portalentity
}

if (newParms.isMirror)
newParms.flags |= VPF_NOVIEWMODEL;
// Never draw viewmodels in portal or mirror views.
newParms.flags |= VPF_NOVIEWMODEL;

R_MirrorPoint (oldParms.or.origin, &surface, &camera, newParms.or.origin );

Expand Down
8 changes: 3 additions & 5 deletions engine/code/renderergl2/tr_model_iqm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
vec4_t *outXYZ;
int16_t *outNormal;
int16_t *outTangent;
vec2_t (*outTexCoord)[2];
vec2_t *outTexCoord;
uint16_t *outColor;

int frame = data->num_frames ? backEnd.currentEntity->e.frame % data->num_frames : 0;
Expand Down Expand Up @@ -1096,10 +1096,8 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
nrmMat[ 7] = vtxMat[ 2]*vtxMat[ 4] - vtxMat[ 0]*vtxMat[ 6];
nrmMat[ 8] = vtxMat[ 0]*vtxMat[ 5] - vtxMat[ 1]*vtxMat[ 4];

(*outTexCoord)[0][0] = data->texcoords[2*vtx + 0];
(*outTexCoord)[0][1] = data->texcoords[2*vtx + 1];
(*outTexCoord)[1][0] = (*outTexCoord)[0][0];
(*outTexCoord)[1][1] = (*outTexCoord)[0][1];
(*outTexCoord)[0] = data->texcoords[2*vtx + 0];
(*outTexCoord)[1] = data->texcoords[2*vtx + 1];

(*outXYZ)[0] =
vtxMat[ 0] * data->positions[3*vtx+0] +
Expand Down
2 changes: 1 addition & 1 deletion engine/code/renderergl2/tr_shade_calc.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void RB_CalcBulgeVertexes( deformStage_t *ds ) {

now = backEnd.refdef.time * ds->bulgeSpeed * 0.001f;

for ( i = 0; i < tess.numVertexes; i++, xyz += 4, st += 4, normal += 4 ) {
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, st += 2, normal += 4 ) {
int off;
float scale;
vec3_t fNormal;
Expand Down
8 changes: 4 additions & 4 deletions engine/code/renderergl2/tr_sky.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,8 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max
tess.xyz[tess.numVertexes][2] = s_skyPoints[t][s][2];
tess.xyz[tess.numVertexes][3] = 1.0;

tess.texCoords[tess.numVertexes][0][0] = s_skyTexCoords[t][s][0];
tess.texCoords[tess.numVertexes][0][1] = s_skyTexCoords[t][s][1];
tess.texCoords[tess.numVertexes][0] = s_skyTexCoords[t][s][0];
tess.texCoords[tess.numVertexes][1] = s_skyTexCoords[t][s][1];

tess.numVertexes++;

Expand Down Expand Up @@ -563,8 +563,8 @@ static void FillCloudySkySide( const int mins[2], const int maxs[2], qboolean ad
for ( s = mins[0]+HALF_SKY_SUBDIVISIONS; s <= maxs[0]+HALF_SKY_SUBDIVISIONS; s++ )
{
VectorAdd( s_skyPoints[t][s], backEnd.viewParms.or.origin, tess.xyz[tess.numVertexes] );
tess.texCoords[tess.numVertexes][0][0] = s_skyTexCoords[t][s][0];
tess.texCoords[tess.numVertexes][0][1] = s_skyTexCoords[t][s][1];
tess.texCoords[tess.numVertexes][0] = s_skyTexCoords[t][s][0];
tess.texCoords[tess.numVertexes][1] = s_skyTexCoords[t][s][1];

tess.numVertexes++;

Expand Down
Loading

0 comments on commit b48ce63

Please sign in to comment.