Browse Source

Fix tutorial build and a few compilation warnings.

legacy
Sam Hocevar 5 years ago
parent
commit
3effd3abe5
3 changed files with 22 additions and 22 deletions
  1. +2
    -2
      doc/tutorial/13_shader_builder.cpp
  2. +10
    -8
      src/lol/math/half.h
  3. +10
    -12
      src/math/half.cpp

+ 2
- 2
doc/tutorial/13_shader_builder.cpp View File

@@ -2,7 +2,7 @@
// Lol Engine — Shader builder tutorial
//
// Copyright © 2002—2015 Benjamin “Touky” Huet <huet.benjamin@gmail.com>
// © 2012—2018 Sam Hocevar <sam@hocevar.net>
// © 2012—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -108,7 +108,7 @@ public:
<< green_pixel
<< blue_pixel;

builder.Build(code);
code = builder.Build();

file.Write(code);
//code = file.ReadString();


+ 10
- 8
src/lol/math/half.h View File

@@ -1,11 +1,13 @@
//
// Lol Engine
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
// Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

#pragma once
@@ -81,8 +83,8 @@ public:
LOL_ATTR_NODISCARD inline operator ldouble() const { return (float)(*this); }

/* Array conversions */
LOL_ATTR_NODISCARD static size_t convert(half *dst, float const *src, size_t nelem);
LOL_ATTR_NODISCARD static size_t convert(float *dst, half const *src, size_t nelem);
static void convert(half *dst, float const *src, size_t nelem);
static void convert(float *dst, half const *src, size_t nelem);

/* Operations */
LOL_ATTR_NODISCARD bool operator ==(half x) const { return (float)*this == (float)x; }


+ 10
- 12
src/math/half.cpp View File

@@ -1,11 +1,13 @@
//
// Lol Engine
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
// Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

#include <lol/engine-internal.h>
@@ -219,7 +221,7 @@ half::operator float() const
return u.f;
}

size_t half::convert(half *dst, float const *src, size_t nelem)
void half::convert(half *dst, float const *src, size_t nelem)
{
for (size_t i = 0; i < nelem; i++)
{
@@ -227,11 +229,9 @@ size_t half::convert(half *dst, float const *src, size_t nelem)
u.f = *src++;
*dst++ = makebits(float_to_half_nobranch(u.x));
}

return nelem;
}

size_t half::convert(float *dst, half const *src, size_t nelem)
void half::convert(float *dst, half const *src, size_t nelem)
{
for (size_t i = 0; i < nelem; i++)
{
@@ -242,8 +242,6 @@ size_t half::convert(float *dst, half const *src, size_t nelem)
u.x = half_to_float_nobranch((*src++).bits);
*dst++ = u.f;
}

return nelem;
}

} /* namespace lol */


Loading…
Cancel
Save