Browse Source

Various compilation and warning fixes.

legacy
Sam Hocevar 7 years ago
parent
commit
0239617197
10 changed files with 33 additions and 12 deletions
  1. +2
    -2
      doc/samples/benchmark/real.cpp
  2. +1
    -1
      doc/tutorial/14_lol_lua.cpp
  3. +1
    -1
      src/3rdparty/mingw-std-threads
  4. +6
    -5
      src/gpu/shader.cpp
  5. +1
    -1
      src/image/color/cie1931.cpp
  6. +2
    -2
      src/image/movie.cpp
  7. +10
    -0
      src/lol/base/features.h
  8. +1
    -0
      src/math/real.cpp
  9. +1
    -0
      src/platform/sdl/sdlapp.cpp
  10. +8
    -0
      src/platform/sdl/sdlinput.cpp

+ 2
- 2
doc/samples/benchmark/real.cpp View File

@@ -60,12 +60,12 @@ void bench_real(int mode)

timer.Get();
for (size_t i = 0; i < REAL_TABLE_SIZE / 128; i++)
sin(real(0.01 * i));
(void)sin(real(0.01 * i));
result[3] += timer.Get() * 128;

timer.Get();
for (size_t i = 0; i < REAL_TABLE_SIZE / 128; i++)
exp((real)(int)(i - REAL_TABLE_SIZE / 256));
(void)exp((real)(int)(i - REAL_TABLE_SIZE / 256));
result[4] += timer.Get() * 128;
}



+ 1
- 1
doc/tutorial/14_lol_lua.cpp View File

@@ -138,9 +138,9 @@ public:
}
void TestStuff()
{
/*
lua_State* l = GetLuaState();

/*
//create property
lua_pushnumber(l, 5.0);
lua_setfield(l, -2, "x");


+ 1
- 1
src/3rdparty/mingw-std-threads

@@ -1 +1 @@
Subproject commit c0aaced0099e0134b707c8c4cd165acc08332fa9
Subproject commit ded7874c23e8e6818dca5855def05e7288c24bb9

+ 6
- 5
src/gpu/shader.cpp View File

@@ -327,16 +327,16 @@ Shader::Shader(String const &name,
int attrib_type;
glGetActiveAttrib(data->prog_id, i, max_len, &attrib_len, (GLint*)&attrib_size, (GLenum*)&attrib_type, name_buffer);

String name(name_buffer);
String attr_name(name_buffer);
int index = -1;
VertexUsage usage = VertexUsage::MAX;
for (int j = 0; j < (int)VertexUsage::MAX; ++j)
{
if (name.starts_with(attribute_names[j]) ||
name.starts_with(String(attribute_names[j]).to_lower()))
if (attr_name.starts_with(attribute_names[j]) ||
attr_name.starts_with(String(attribute_names[j]).to_lower()))
{
usage = VertexUsage(j);
char* idx_ptr = name.C() + strlen(attribute_names[j]);
char* idx_ptr = attr_name.C() + strlen(attribute_names[j]);
index = strtol(idx_ptr, nullptr, 10);
break;
}
@@ -357,7 +357,7 @@ Shader::Shader(String const &name,
if (data->attrib_locations.has_key(flags))
{
msg::error("error while parsing attribute semantics in %s\n",
name.C());
attr_name.C());
}
#endif
data->attrib_locations[flags] = location;
@@ -691,6 +691,7 @@ String ShaderData::Patch(String const &code, ShaderType type)

size_t l0 = strlen(rep[0]);
size_t l1 = strlen(rep[1]);
UNUSED(l1);

String left = patched_code.sub(0, index);
String right = patched_code.sub(index + l0, patched_code.count() - (index + l0));


+ 1
- 1
src/image/color/cie1931.cpp View File

@@ -44,7 +44,7 @@ float Color::DistanceCIEDE2000(vec3 lab1, vec3 lab2)
float hp2 = atan2(lab2.z, ap2);
float dhp = fmod(hp2 - hp1 + 3.f * F_PI, 2.f * F_PI) - F_PI; /* -pi .. pi */
float dHp = 2.f * sqrt(Cp1 * Cp2) * sin(0.5f * dhp);
float Hp_ = Cp1 * Cp2 ? fmod(hp1 + 0.5f * dhp + 2.f * F_PI, 2.f * F_PI) : hp1 + hp2; /* 0 .. 2pi */
float Hp_ = (Cp1 && Cp2) ? fmod(hp1 + 0.5f * dhp + 2.f * F_PI, 2.f * F_PI) : hp1 + hp2; /* 0 .. 2pi */

float T = 1.f - 0.17f * cos(Hp_ - F_PI / 6.f)
+ 0.24f * cos(2.f * Hp_)


+ 2
- 2
src/image/movie.cpp View File

@@ -37,12 +37,12 @@ static String error2string(int errnum)
return String(tmp);
}

static void ffmpeg_logger(void *ptr, int level, const char *fmt, va_list vl)
/*static void ffmpeg_logger(void *ptr, int level, const char *fmt, va_list vl)
{
// FIXME: use lol::msg::debug
UNUSED(ptr, level);
vfprintf(stderr, fmt, vl);
}
}*/
#endif

movie::movie(ivec2 size)


+ 10
- 0
src/lol/base/features.h View File

@@ -52,12 +52,16 @@
#undef LOL_FEATURE_CXX11_SFINAE_FOR_CTORS

#undef LOL_FEATURE_CXX17_ATTRIBUTE_NODISCARD
#undef LOL_FEATURE_CXX17_ATTRIBUTE_FALLTHROUGH

/* Features detected through __has_cpp_attribute */
#ifdef __has_cpp_attribute
# if __has_cpp_attribute(nodiscard)
# define LOL_FEATURE_CXX17_ATTRIBUTE_NODISCARD 1
# endif
# if __has_cpp_attribute(fallthrough)
# define LOL_FEATURE_CXX17_ATTRIBUTE_FALLTHROUGH 1
# endif
#endif

/* Features supported by GCC */
@@ -128,6 +132,12 @@
# define LOL_ATTR_NODISCARD /* */
#endif

#ifdef LOL_FEATURE_CXX17_ATTRIBUTE_FALLTHROUGH
# define LOL_ATTR_FALLTHROUGH [[fallthrough]]
#else
# define LOL_ATTR_FALLTHROUGH /* */
#endif


/*
* Ensure we have ptrdiff_t.


+ 1
- 0
src/math/real.cpp View File

@@ -243,6 +243,7 @@ template<> real::Real(char const *str)
finished = true;
break;
}
LOL_ATTR_FALLTHROUGH /* FIXME: why doesn’t this seem to work? */
case 'a': case 'b': case 'c': case 'd': case 'f':
case 'A': case 'B': case 'C': case 'D': case 'F':
case '0': case '1': case '2': case '3': case '4':


+ 1
- 0
src/platform/sdl/sdlapp.cpp View File

@@ -201,6 +201,7 @@ private:
SdlApp::SdlApp(char const *title, ivec2 res, float fps) :
data(new SdlAppData())
{
UNUSED(title);
#if LOL_USE_SDL || LOL_USE_OLD_SDL
ivec2 window_size = res;
ivec2 screen_size = res;


+ 8
- 0
src/platform/sdl/sdlinput.cpp View File

@@ -68,6 +68,7 @@ static int sdl12_to_scancode(int ch, int sc)
return false;
}
//-------------------------------------------------------------------------
/* DEBUG STUFF
static String ScanCodeToText(int sc)
{
switch (sc)
@@ -80,7 +81,9 @@ static int sdl12_to_scancode(int ch, int sc)
}
return String();
}
*/
//-------------------------------------------------------------------------
/* DEBUG STUFF
static String ScanCodeToName(int sc)
{
switch (sc)
@@ -93,6 +96,7 @@ static int sdl12_to_scancode(int ch, int sc)
}
return String();
}
*/
#endif

/*
@@ -237,6 +241,9 @@ void SdlInput::TickDraw(float seconds, Scene &scene)
void SdlInputData::Tick(float seconds)
{
#if LOL_USE_SDL || LOL_USE_OLD_SDL
/* FIXME: maybe we should make use of this? */
UNUSED(seconds);

/* Pump all joystick events because no event is coming to us. */
# if SDL_FORCE_POLL_JOYSTICK && !EMSCRIPTEN
SDL_JoystickUpdate();
@@ -459,6 +466,7 @@ void SdlInputData::SetMousePos(ivec2 position)
{
#if LOL_USE_SDL
// FIXME: how do I warped mouse?
UNUSED(position);
#elif LOL_USE_OLD_SDL
SDL_WarpMouse((uint16_t)position.x, (uint16_t)position.y);
#else


Loading…
Cancel
Save