|
|
@ -49,6 +49,8 @@ static const char *GL_TargetToString( GLenum target ) |
|
|
|
return "1D"; |
|
|
|
return "1D"; |
|
|
|
case GL_TEXTURE_2D: |
|
|
|
case GL_TEXTURE_2D: |
|
|
|
return "2D"; |
|
|
|
return "2D"; |
|
|
|
|
|
|
|
case GL_TEXTURE_2D_MULTISAMPLE: |
|
|
|
|
|
|
|
return "2D Multisample"; |
|
|
|
case GL_TEXTURE_3D: |
|
|
|
case GL_TEXTURE_3D: |
|
|
|
return "3D"; |
|
|
|
return "3D"; |
|
|
|
case GL_TEXTURE_CUBE_MAP_ARB: |
|
|
|
case GL_TEXTURE_CUBE_MAP_ARB: |
|
|
@ -117,6 +119,10 @@ void GL_ApplyTextureParams( gl_texture_t *tex ) |
|
|
|
|
|
|
|
|
|
|
|
Assert( tex != NULL ); |
|
|
|
Assert( tex != NULL ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// multisample textures does not support any sampling state changing
|
|
|
|
|
|
|
|
if( FBitSet( tex->flags, TF_MULTISAMPLE )) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// set texture filter
|
|
|
|
// set texture filter
|
|
|
|
if( FBitSet( tex->flags, TF_DEPTHMAP )) |
|
|
|
if( FBitSet( tex->flags, TF_DEPTHMAP )) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -523,6 +529,7 @@ static void GL_SetTextureDimensions( gl_texture_t *tex, int width, int height, i |
|
|
|
{ |
|
|
|
{ |
|
|
|
case GL_TEXTURE_1D: |
|
|
|
case GL_TEXTURE_1D: |
|
|
|
case GL_TEXTURE_2D: |
|
|
|
case GL_TEXTURE_2D: |
|
|
|
|
|
|
|
case GL_TEXTURE_2D_MULTISAMPLE: |
|
|
|
maxTextureSize = glConfig.max_2d_texture_size; |
|
|
|
maxTextureSize = glConfig.max_2d_texture_size; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case GL_TEXTURE_2D_ARRAY_EXT: |
|
|
|
case GL_TEXTURE_2D_ARRAY_EXT: |
|
|
@ -626,6 +633,8 @@ static void GL_SetTextureTarget( gl_texture_t *tex, rgbdata_t *pic ) |
|
|
|
tex->target = GL_TEXTURE_3D; |
|
|
|
tex->target = GL_TEXTURE_3D; |
|
|
|
else if( FBitSet( tex->flags, TF_RECTANGLE )) |
|
|
|
else if( FBitSet( tex->flags, TF_RECTANGLE )) |
|
|
|
tex->target = GL_TEXTURE_RECTANGLE_EXT; |
|
|
|
tex->target = GL_TEXTURE_RECTANGLE_EXT; |
|
|
|
|
|
|
|
else if( FBitSet(tex->flags, TF_MULTISAMPLE )) |
|
|
|
|
|
|
|
tex->target = GL_TEXTURE_2D_MULTISAMPLE; |
|
|
|
else tex->target = GL_TEXTURE_2D; // default case
|
|
|
|
else tex->target = GL_TEXTURE_2D; // default case
|
|
|
|
|
|
|
|
|
|
|
|
// check for hardware support
|
|
|
|
// check for hardware support
|
|
|
@ -648,6 +657,9 @@ static void GL_SetTextureTarget( gl_texture_t *tex, rgbdata_t *pic ) |
|
|
|
// depth cubemaps only allowed when GL_EXT_gpu_shader4 is supported
|
|
|
|
// depth cubemaps only allowed when GL_EXT_gpu_shader4 is supported
|
|
|
|
if( tex->target == GL_TEXTURE_CUBE_MAP_ARB && !GL_Support( GL_EXT_GPU_SHADER4 ) && FBitSet( tex->flags, TF_DEPTHMAP )) |
|
|
|
if( tex->target == GL_TEXTURE_CUBE_MAP_ARB && !GL_Support( GL_EXT_GPU_SHADER4 ) && FBitSet( tex->flags, TF_DEPTHMAP )) |
|
|
|
tex->target = GL_NONE; |
|
|
|
tex->target = GL_NONE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(( tex->target == GL_TEXTURE_2D_MULTISAMPLE ) && !GL_Support( GL_TEXTURE_MULTISAMPLE )) |
|
|
|
|
|
|
|
tex->target = GL_NONE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -1006,6 +1018,7 @@ static void GL_TextureImageRAW( gl_texture_t *tex, GLint side, GLint level, GLin |
|
|
|
qboolean subImage = FBitSet( tex->flags, TF_IMG_UPLOADED ); |
|
|
|
qboolean subImage = FBitSet( tex->flags, TF_IMG_UPLOADED ); |
|
|
|
GLenum inFormat = gEngfuncs.Image_GetPFDesc(type)->glFormat; |
|
|
|
GLenum inFormat = gEngfuncs.Image_GetPFDesc(type)->glFormat; |
|
|
|
GLint dataType = GL_UNSIGNED_BYTE; |
|
|
|
GLint dataType = GL_UNSIGNED_BYTE; |
|
|
|
|
|
|
|
GLsizei samplesCount = 0; |
|
|
|
|
|
|
|
|
|
|
|
Assert( tex != NULL ); |
|
|
|
Assert( tex != NULL ); |
|
|
|
|
|
|
|
|
|
|
@ -1032,6 +1045,21 @@ static void GL_TextureImageRAW( gl_texture_t *tex, GLint side, GLint level, GLin |
|
|
|
if( subImage ) pglTexSubImage3D( tex->target, level, 0, 0, 0, width, height, depth, inFormat, dataType, data ); |
|
|
|
if( subImage ) pglTexSubImage3D( tex->target, level, 0, 0, 0, width, height, depth, inFormat, dataType, data ); |
|
|
|
else pglTexImage3D( tex->target, level, tex->format, width, height, depth, 0, inFormat, dataType, data ); |
|
|
|
else pglTexImage3D( tex->target, level, tex->format, width, height, depth, 0, inFormat, dataType, data ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if( tex->target == GL_TEXTURE_2D_MULTISAMPLE ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
samplesCount = (GLsizei)gEngfuncs.pfnGetCvarFloat("gl_msaa_samples"); |
|
|
|
|
|
|
|
switch (samplesCount) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
case 4: |
|
|
|
|
|
|
|
case 8: |
|
|
|
|
|
|
|
case 16: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
samplesCount = 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
pglTexImage2DMultisample( tex->target, samplesCount, tex->format, width, height, GL_TRUE ); |
|
|
|
|
|
|
|
} |
|
|
|
else // 2D or RECT
|
|
|
|
else // 2D or RECT
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if( subImage ) pglTexSubImage2D( tex->target, level, 0, 0, width, height, inFormat, dataType, data ); |
|
|
|
if( subImage ) pglTexSubImage2D( tex->target, level, 0, 0, width, height, inFormat, dataType, data ); |
|
|
@ -2165,6 +2193,9 @@ void R_TextureList_f( void ) |
|
|
|
case GL_TEXTURE_2D_ARRAY_EXT: |
|
|
|
case GL_TEXTURE_2D_ARRAY_EXT: |
|
|
|
gEngfuncs.Con_Printf( "ARRAY " ); |
|
|
|
gEngfuncs.Con_Printf( "ARRAY " ); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case GL_TEXTURE_2D_MULTISAMPLE: |
|
|
|
|
|
|
|
gEngfuncs.Con_Printf( "MSAA "); |
|
|
|
|
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
gEngfuncs.Con_Printf( "???? " ); |
|
|
|
gEngfuncs.Con_Printf( "???? " ); |
|
|
|
break; |
|
|
|
break; |
|
|
|