mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-09 23:01:51 +00:00
OpenGL2: Detect Intel graphics and avoid/use certain operations there.
Also use qglCopyTextureSubImage2DEXT instead of qglCopyTextureImage2DEXT.
This commit is contained in:
parent
730207817e
commit
0672905ef1
9 changed files with 22 additions and 13 deletions
|
@ -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) \
|
||||
|
|
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -271,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)
|
||||
|
|
|
@ -2761,7 +2761,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;
|
||||
|
|
|
@ -1373,6 +1373,8 @@ typedef struct {
|
|||
int openglMajorVersion;
|
||||
int openglMinorVersion;
|
||||
|
||||
qboolean intelGraphics;
|
||||
|
||||
qboolean drawRangeElements;
|
||||
qboolean multiDrawArrays;
|
||||
qboolean occlusionQuery;
|
||||
|
|
|
@ -360,8 +360,8 @@ void R_BindVao(vao_t * vao)
|
|||
{
|
||||
qglBindVertexArray(vao->vao);
|
||||
|
||||
// why you no save GL_ELEMENT_ARRAY_BUFFER binding, Intel?
|
||||
if (1)
|
||||
// Intel Graphics doesn't save GL_ELEMENT_ARRAY_BUFFER binding with VAO binding.
|
||||
if (glRefConfig.intelGraphics || vao == tess.vao)
|
||||
qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vao->indexesIBO);
|
||||
|
||||
// tess VAO always has buffers bound
|
||||
|
|
Loading…
Reference in a new issue