| @@ -2,7 +2,7 @@ | |||||
| // Lol Engine — Shader builder tutorial | // Lol Engine — Shader builder tutorial | ||||
| // | // | ||||
| // Copyright © 2002—2015 Benjamin “Touky” Huet <huet.benjamin@gmail.com> | // 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 | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -108,7 +108,7 @@ public: | |||||
| << green_pixel | << green_pixel | ||||
| << blue_pixel; | << blue_pixel; | ||||
| builder.Build(code); | |||||
| code = builder.Build(); | |||||
| file.Write(code); | file.Write(code); | ||||
| //code = file.ReadString(); | //code = file.ReadString(); | ||||
| @@ -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 | #pragma once | ||||
| @@ -81,8 +83,8 @@ public: | |||||
| LOL_ATTR_NODISCARD inline operator ldouble() const { return (float)(*this); } | LOL_ATTR_NODISCARD inline operator ldouble() const { return (float)(*this); } | ||||
| /* Array conversions */ | /* 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 */ | /* Operations */ | ||||
| LOL_ATTR_NODISCARD bool operator ==(half x) const { return (float)*this == (float)x; } | LOL_ATTR_NODISCARD bool operator ==(half x) const { return (float)*this == (float)x; } | ||||
| @@ -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> | #include <lol/engine-internal.h> | ||||
| @@ -219,7 +221,7 @@ half::operator float() const | |||||
| return u.f; | 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++) | 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++; | u.f = *src++; | ||||
| *dst++ = makebits(float_to_half_nobranch(u.x)); | *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++) | 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); | u.x = half_to_float_nobranch((*src++).bits); | ||||
| *dst++ = u.f; | *dst++ = u.f; | ||||
| } | } | ||||
| return nelem; | |||||
| } | } | ||||
| } /* namespace lol */ | } /* namespace lol */ | ||||