Permalink
Browse files

Merge branch 'master' of github.com:Unvanquished/Unvanquished into co…

…nnectionless_packet
  • Loading branch information...
mbasaglia committed Mar 9, 2016
2 parents 4443f4a + 368cfdb commit 0eb3a9aab96348454f2a9c0e6cda95ef71e88adc
Showing with 6,854 additions and 4,518 deletions.
  1. +2 −0 buildshaders.sh
  2. +2 −1 daemon/libs/tinygettext/po_parser.cpp
  3. +2 −3 daemon/src/engine/audio/WavCodec.cpp
  4. +3 −2 daemon/src/engine/client/cl_main.cpp
  5. +1 −2 daemon/src/engine/client/cl_parse.cpp
  6. +5 −2 daemon/src/engine/qcommon/q_shared.cpp
  7. +1 −1 daemon/src/engine/qcommon/q_shared.h
  8. +101 −6 daemon/src/engine/renderer/gl_shader.cpp
  9. +280 −5 daemon/src/engine/renderer/gl_shader.h
  10. +4,864 −3,649 daemon/src/engine/renderer/shaders.cpp
  11. +314 −243 daemon/src/engine/renderer/tr_backend.cpp
  12. +6 −10 daemon/src/engine/renderer/tr_bsp.cpp
  13. +10 −12 daemon/src/engine/renderer/tr_cmds.cpp
  14. +30 −16 daemon/src/engine/renderer/tr_fbo.cpp
  15. +42 −80 daemon/src/engine/renderer/tr_image.cpp
  16. +12 −15 daemon/src/engine/renderer/tr_init.cpp
  17. +9 −9 daemon/src/engine/renderer/tr_light.cpp
  18. +62 −10 daemon/src/engine/renderer/tr_local.h
  19. +48 −23 daemon/src/engine/renderer/tr_main.cpp
  20. +2 −4 daemon/src/engine/renderer/tr_scene.cpp
  21. +109 −68 daemon/src/engine/renderer/tr_shade.cpp
  22. +52 −54 daemon/src/engine/renderer/tr_shade_calc.cpp
  23. +163 −62 daemon/src/engine/renderer/tr_shader.cpp
  24. +1 −1 daemon/src/engine/renderer/tr_surface.cpp
  25. +2 −2 daemon/src/engine/renderer/tr_types.h
  26. +84 −0 daemon/src/engine/renderer/tr_vbo.cpp
  27. +0 −1 daemon/src/engine/sys/con_curses.cpp
  28. +4 −7 daemon/src/engine/sys/sdl_glimp.cpp
  29. +1 −1 download-pk3.sh
  30. +1 −1 macosx/Info.plist
  31. +116 −0 main/glsl/depthtile1_fp.glsl
  32. +38 −0 main/glsl/depthtile1_vp.glsl
  33. +53 −0 main/glsl/depthtile2_fp.glsl
  34. +31 −0 main/glsl/depthtile2_vp.glsl
  35. +0 −1 main/glsl/forwardLighting_fp.glsl
  36. +17 −52 main/glsl/lightMapping_fp.glsl
  37. +122 −0 main/glsl/lighttile_fp.glsl
  38. +37 −0 main/glsl/lighttile_vp.glsl
  39. +134 −0 main/glsl/reliefMapping_fp.glsl
  40. +8 −57 main/glsl/vertexLighting_DBS_entity_fp.glsl
  41. +14 −45 main/glsl/vertexLighting_DBS_world_fp.glsl
  42. +3 −3 main/glsl/vertexSprite_vp.glsl
  43. +2 −0 main/scripts/flamer.particle
  44. +1 −1 main/ui/menu_ingame.rml
  45. +1 −1 main/ui/menu_main.rml
  46. +1 −1 src/cgame/cg_buildable.cpp
  47. +3 −3 src/cgame/cg_gameinfo.cpp
  48. +5 −4 src/cgame/cg_rocket_datasource.cpp
  49. +36 −36 src/sgame/sg_admin.cpp
  50. +3 −3 src/sgame/sg_admin.h
  51. +6 −9 src/sgame/sg_spawn.cpp
  52. +1 −1 src/sgame/sg_utils.cpp
  53. +1 −2 src/shared/bg_alloc.cpp
  54. +1 −3 src/shared/bg_misc.cpp
  55. +1 −1 src/shared/bg_pmove.cpp
  56. +1 −1 src/shared/bg_public.h
  57. +5 −4 src/shared/bg_voice.cpp
View
@@ -1,5 +1,7 @@
#!/bin/sh
cd $(dirname "$0")
exec > daemon/src/engine/renderer/shaders.cpp
cd main
@@ -23,6 +23,7 @@
#include <istream>
#include <string.h>
#include <map>
#include <stddef.h> // for size_t
#include <stdlib.h>
#include "language.hpp"
@@ -244,7 +245,7 @@ POParser::parse_header(const std::string& header)
if (has_prefix(line, "Content-Type:"))
{
// from_charset = line.substr(len);
unsigned int len = strlen("Content-Type: text/plain; charset=");
size_t len = strlen("Content-Type: text/plain; charset=");
if (line.compare(0, len, "Content-Type: text/plain; charset=") == 0)
{
from_charset = line.substr(len);
@@ -99,13 +99,12 @@ AudioData LoadWavCodec(std::string filename)
return AudioData();
}
//TODO find the position of "data"
std::size_t dataOffset{audioFile.find("data", 36)};
//TODO: find the position of "data"
std::size_t dataOffset{audioFile.find("data", 36)};
if (dataOffset == std::string::npos) {
audioLogs.Warn("Could not find the data chunk in %s", filename);
return AudioData();
}
std::string chunk2ID = audioFile.substr(dataOffset, 4);
int size = PackChars(audioFile, dataOffset + 4, 4);
@@ -4167,6 +4167,7 @@ void CL_LocalServers_f()
// by the server. We don't care about that here, but master servers
// can use that to prevent spoofed server responses from invalid IP addresses
message = "\377\377\377\377getinfo xxx";
int messageLen = strlen(message);
// send each message twice in case one is dropped
for ( i = 0; i < 2; i++ )
@@ -4179,10 +4180,10 @@ void CL_LocalServers_f()
to.port = BigShort( ( short )( PORT_SERVER + j ) );
to.type = netadrtype_t::NA_BROADCAST;
NET_SendPacket( netsrc_t::NS_CLIENT, strlen( message ), message, to );
NET_SendPacket( netsrc_t::NS_CLIENT, messageLen, message, to );
to.type = netadrtype_t::NA_MULTICAST6;
NET_SendPacket( netsrc_t::NS_CLIENT, strlen( message ), message, to );
NET_SendPacket( netsrc_t::NS_CLIENT, messageLen, message, to );
}
}
}
@@ -472,8 +472,7 @@ void CL_ParseGamestate( msg_t *msg )
Com_Error( errorParm_t::ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
}
const char* str = MSG_ReadBigString( msg );
std::string s = str;
const char* str = MSG_ReadBigString( msg );
cl.gameState[i] = str;
}
else if ( cmd == svc_baseline )
@@ -180,7 +180,9 @@ Com_CharIsOneOfCharset
*/
static bool Com_CharIsOneOfCharset( char c, const char *set )
{
for (unsigned i = 0; i < strlen( set ); i++ )
std::size_t len = strlen( set );
for ( std::size_t i = 0; i < len; i++ )
{
if ( set[ i ] == c )
{
@@ -1226,8 +1228,9 @@ int Com_HexStrToInt( const char *str )
if ( str[ 0 ] == '0' && str[ 1 ] == 'x' )
{
int n = 0;
std::size_t len = strlen( str );
for (unsigned i = 2; i < strlen( str ); i++ )
for ( std::size_t i = 2; i < len; i++ )
{
char digit;
@@ -49,7 +49,7 @@ Maryland 20850 USA.
#define PRODUCT_NAME "Unvanquished"
#define PRODUCT_NAME_UPPER "UNVANQUISHED" // Case, No spaces
#define PRODUCT_NAME_LOWER "unvanquished" // No case, No spaces
#define PRODUCT_VERSION "0.48"
#define PRODUCT_VERSION "0.49"
#define ENGINE_NAME "Daemon Engine"
#define ENGINE_VERSION PRODUCT_VERSION
@@ -61,6 +61,9 @@ GLShader_liquid *gl_liquidShader = nullptr;
GLShader_volumetricFog *gl_volumetricFogShader = nullptr;
GLShader_motionblur *gl_motionblurShader = nullptr;
GLShader_ssao *gl_ssaoShader = nullptr;
GLShader_depthtile1 *gl_depthtile1Shader = nullptr;
GLShader_depthtile2 *gl_depthtile2Shader = nullptr;
GLShader_lighttile *gl_lighttileShader = nullptr;
GLShader_fxaa *gl_fxaaShader = nullptr;
GLShaderManager gl_shaderManager;
@@ -244,18 +247,27 @@ void GLShaderManager::UpdateShaderProgramUniformLocations( GLShader *shader, sha
{
size_t uniformSize = shader->_uniformStorageSize;
size_t numUniforms = shader->_uniforms.size();
size_t numUniformBlocks = shader->_uniformBlocks.size();
// create buffer for storing uniform locations
shaderProgram->uniformLocations = ( GLint * ) ri.Z_Malloc( sizeof( GLint ) * numUniforms );
// create buffer for uniform firewall
shaderProgram->uniformFirewall = ( byte * ) ri.Z_Malloc( uniformSize );
// create buffer for storing uniform block indexes
shaderProgram->uniformBlockIndexes = ( GLuint * ) ri.Z_Malloc( sizeof( GLuint ) * numUniformBlocks );
// update uniforms
for (GLUniform *uniform : shader->_uniforms)
{
uniform->UpdateShaderProgramUniformLocation( shaderProgram );
}
// update uniform blocks
for (GLUniformBlock *uniformBlock : shader->_uniformBlocks)
{
uniformBlock->UpdateShaderProgramUniformBlockIndex( shaderProgram );
}
}
static inline void AddDefine( std::string& defines, const std::string& define, int value )
@@ -449,6 +461,8 @@ std::string GLShaderManager::BuildGPUShaderText( Str::StringRef mainShaderNa
AddDefine( env, "M_PI", static_cast<float>( M_PI ) );
AddDefine( env, "MAX_SHADOWMAPS", MAX_SHADOWMAPS );
AddDefine( env, "MAX_REF_LIGHTS", MAX_REF_LIGHTS );
AddDefine( env, "TILE_SIZE", TILE_SIZE );
float fbufWidthScale = 1.0f / glConfig.vidWidth;
float fbufHeightScale = 1.0f / glConfig.vidHeight;
@@ -465,6 +479,7 @@ std::string GLShaderManager::BuildGPUShaderText( Str::StringRef mainShaderNa
}
AddDefine( env, "r_NPOTScale", npotWidthScale, npotHeightScale );
AddDefine( env, "r_tileStep", glState.tileStep[ 0 ], glState.tileStep[ 1 ] );
if ( glConfig.driverType == glDriverType_t::GLDRV_MESA )
AddDefine( env, "GLDRV_MESA", 1 );
@@ -484,7 +499,7 @@ std::string GLShaderManager::BuildGPUShaderText( Str::StringRef mainShaderNa
break;
}
if ( r_shadows->integer >= Util::ordinal(shadowingMode_t::SHADOWING_ESM16) && glConfig2.textureFloatAvailable && glConfig2.framebufferObjectAvailable )
if ( r_shadows->integer >= Util::ordinal(shadowingMode_t::SHADOWING_ESM16) && glConfig2.textureFloatAvailable )
{
if ( r_shadows->integer == Util::ordinal(shadowingMode_t::SHADOWING_ESM16) || r_shadows->integer == Util::ordinal(shadowingMode_t::SHADOWING_ESM32) )
{
@@ -677,6 +692,12 @@ void GLShaderManager::InitShader( GLShader *shader )
shader->_uniformStorageSize += uniform->GetSize();
}
for ( std::size_t i = 0; i < shader->_uniformBlocks.size(); i++ )
{
GLUniformBlock *uniformBlock = shader->_uniformBlocks[ i ];
uniformBlock->SetLocationIndex( i );
}
std::string vertexInlines;
shader->BuildShaderVertexLibNames( vertexInlines );
@@ -936,7 +957,6 @@ void GLShaderManager::PrintShaderSource( Str::StringRef programName, GLuint obje
{
char *msg;
int maxLength = 0;
std::string msgText;
glGetShaderiv( object, GL_SHADER_SOURCE_LENGTH, &maxLength );
@@ -1133,6 +1153,28 @@ bool GLCompileMacro_USE_REFLECTIVE_SPECULAR::MissesRequiredMacros( size_t permut
return false;
}
bool GLCompileMacro_USE_PHYSICAL_SHADING::MissesRequiredMacros( size_t permutation, const std::vector< GLCompileMacro * > &macros ) const
{
bool foundUSE_NORMAL_MAPPING = false;
for (const GLCompileMacro* macro : macros)
{
if ( ( permutation & macro->GetBit() ) != 0 && macro->GetType() == USE_NORMAL_MAPPING )
{
foundUSE_NORMAL_MAPPING = true;
break;
}
}
if ( !foundUSE_NORMAL_MAPPING )
{
//ri.Printf(PRINT_ALL, "missing macro! canceling '%s' <= '%s'\n", GetName(), "USE_NORMAL_MAPPING");
return true;
}
return false;
}
bool GLShader::GetCompileMacrosString( size_t permutation, std::string &compileMacrosOut ) const
{
compileMacrosOut.clear();
@@ -1258,13 +1300,16 @@ GLShader_generic::GLShader_generic( GLShaderManager *manager ) :
u_Bones( this ),
u_VertexInterpolation( this ),
u_DepthScale( this ),
u_numLights( this ),
u_Lights( this ),
GLDeformStage( this ),
GLCompileMacro_USE_VERTEX_SKINNING( this ),
GLCompileMacro_USE_VERTEX_ANIMATION( this ),
GLCompileMacro_USE_VERTEX_SPRITE( this ),
GLCompileMacro_USE_TCGEN_ENVIRONMENT( this ),
GLCompileMacro_USE_TCGEN_LIGHTMAP( this ),
GLCompileMacro_USE_DEPTH_FADE( this )
GLCompileMacro_USE_DEPTH_FADE( this ),
GLCompileMacro_USE_SHADER_LIGHTS( this )
{
}
@@ -1293,10 +1338,14 @@ GLShader_lightMapping::GLShader_lightMapping( GLShaderManager *manager ) :
u_ModelMatrix( this ),
u_ModelViewProjectionMatrix( this ),
u_DepthScale( this ),
u_numLights( this ),
u_Lights( this ),
GLDeformStage( this ),
GLCompileMacro_USE_NORMAL_MAPPING( this ),
GLCompileMacro_USE_PARALLAX_MAPPING( this ),
GLCompileMacro_USE_GLOW_MAPPING( this )
GLCompileMacro_USE_GLOW_MAPPING( this ),
GLCompileMacro_USE_SHADER_LIGHTS( this ),
GLCompileMacro_USE_PHYSICAL_SHADING( this )
{
}
@@ -1322,6 +1371,7 @@ void GLShader_lightMapping::SetShaderProgramUniforms( shaderProgram_t *shaderPro
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_LightMap" ), 3 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_DeluxeMap" ), 4 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_GlowMap" ), 5 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_LightTiles" ), 8 );
}
GLShader_vertexLighting_DBS_entity::GLShader_vertexLighting_DBS_entity( GLShaderManager *manager ) :
@@ -1341,13 +1391,17 @@ GLShader_vertexLighting_DBS_entity::GLShader_vertexLighting_DBS_entity( GLShader
u_EnvironmentInterpolation( this ),
u_LightGridOrigin( this ),
u_LightGridScale( this ),
u_numLights( this ),
u_Lights( this ),
GLDeformStage( this ),
GLCompileMacro_USE_VERTEX_SKINNING( this ),
GLCompileMacro_USE_VERTEX_ANIMATION( this ),
GLCompileMacro_USE_NORMAL_MAPPING( this ),
GLCompileMacro_USE_PARALLAX_MAPPING( this ),
GLCompileMacro_USE_REFLECTIVE_SPECULAR( this ),
GLCompileMacro_USE_GLOW_MAPPING( this )
GLCompileMacro_USE_GLOW_MAPPING( this ),
GLCompileMacro_USE_SHADER_LIGHTS( this ),
GLCompileMacro_USE_PHYSICAL_SHADING( this )
{
}
@@ -1375,6 +1429,7 @@ void GLShader_vertexLighting_DBS_entity::SetShaderProgramUniforms( shaderProgram
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_GlowMap" ), 5 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_LightGrid1" ), 6 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_LightGrid2" ), 7 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_LightTiles" ), 8 );
}
GLShader_vertexLighting_DBS_world::GLShader_vertexLighting_DBS_world( GLShaderManager *manager ) :
@@ -1397,10 +1452,14 @@ GLShader_vertexLighting_DBS_world::GLShader_vertexLighting_DBS_world( GLShaderMa
u_LightWrapAround( this ),
u_LightGridOrigin( this ),
u_LightGridScale( this ),
u_numLights( this ),
u_Lights( this ),
GLDeformStage( this ),
GLCompileMacro_USE_NORMAL_MAPPING( this ),
GLCompileMacro_USE_PARALLAX_MAPPING( this ),
GLCompileMacro_USE_GLOW_MAPPING( this )
GLCompileMacro_USE_GLOW_MAPPING( this ),
GLCompileMacro_USE_SHADER_LIGHTS( this ),
GLCompileMacro_USE_PHYSICAL_SHADING( this )
{
}
@@ -1425,6 +1484,7 @@ void GLShader_vertexLighting_DBS_world::SetShaderProgramUniforms( shaderProgram_
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_GlowMap" ), 3 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_LightGrid1" ), 6 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_LightGrid2" ), 7 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_LightTiles" ), 8 );
}
GLShader_forwardLighting_omniXYZ::GLShader_forwardLighting_omniXYZ( GLShaderManager *manager ):
@@ -1961,6 +2021,41 @@ void GLShader_ssao::SetShaderProgramUniforms( shaderProgram_t *shaderProgram )
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_DepthMap" ), 0 );
}
GLShader_depthtile1::GLShader_depthtile1( GLShaderManager *manager ) :
GLShader( "depthtile1", ATTR_POSITION, manager ),
u_zFar( this )
{
}
void GLShader_depthtile1::SetShaderProgramUniforms( shaderProgram_t *shaderProgram )
{
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_DepthMap" ), 0 );
}
GLShader_depthtile2::GLShader_depthtile2( GLShaderManager *manager ) :
GLShader( "depthtile2", ATTR_POSITION, manager )
{
}
void GLShader_depthtile2::SetShaderProgramUniforms( shaderProgram_t *shaderProgram )
{
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_DepthMap" ), 0 );
}
GLShader_lighttile::GLShader_lighttile( GLShaderManager *manager ) :
GLShader( "lighttile", ATTR_POSITION | ATTR_TEXCOORD, manager ),
u_ModelMatrix( this ),
u_numLights( this ),
u_lightLayer( this ),
u_Lights( this )
{
}
void GLShader_lighttile::SetShaderProgramUniforms( shaderProgram_t *shaderProgram )
{
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_DepthMap" ), 0 );
}
GLShader_fxaa::GLShader_fxaa( GLShaderManager *manager ) :
GLShader( "fxaa", ATTR_POSITION, manager )
{
Oops, something went wrong.

0 comments on commit 0eb3a9a

Please sign in to comment.