Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411279 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 03:03:01 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The grumpy old programmer room
Pages: 1 ... 275 276 [277] 278 279 ... 295
Print
Author Topic: The grumpy old programmer room  (Read 733305 times)
Crimsontide
Level 5
*****


View Profile
« Reply #5520 on: October 23, 2017, 11:20:41 PM »

According to what I've read, testing for noexcept would indicate misuse, because the noexcept marker is supposed to be part of the signature and be a promise to the API user who might write other code that depends on that function remaining noexcept; if you can't guarantee that the function will remain noexcept through updates you shouldn't mark it as such in the first place as far as I've understood. I only use it for simple functions that by design would not make sense to change that fundamentally in the future. I may be wrong tho. Panda

Which sounds great... until you get to templates.  You can't know if a function will or will not violate the noexcept declaration without testing any functions/operators it calls.  Now you could just assume all those functions throw, ignore noexcept, but that kinda defeats point right?  If the best way to use noexcept is to not use noexcept... well then we are in agreement Smiley
Logged
Ordnas
Level 10
*****



View Profile WWW
« Reply #5521 on: October 24, 2017, 12:06:30 AM »

According to what I've read, testing for noexcept would indicate misuse, because the noexcept marker is supposed to be part of the signature and be a promise to the API user who might write other code that depends on that function remaining noexcept; if you can't guarantee that the function will remain noexcept through updates you shouldn't mark it as such in the first place as far as I've understood. I only use it for simple functions that by design would not make sense to change that fundamentally in the future. I may be wrong tho. Panda

Which sounds great... until you get to templates.  You can't know if a function will or will not violate the noexcept declaration without testing any functions/operators it calls.  Now you could just assume all those functions throw, ignore noexcept, but that kinda defeats point right?  If the best way to use noexcept is to not use noexcept... well then we are in agreement Smiley

I think Noexcept was introduced to solve the problem of move semantics, example a vector<T>::push_back, there is a difference in performance if you use move constructor instead of copy constructor. This performance gain is achieved only if you can guarantee that push_back does not throw. For this particular case it is being introduced std::move_if_noexcept. So, in case of move operations where you need performance and you are sure of what you are doing, why not.
Logged

Games:

oahda
Level 10
*****



View Profile
« Reply #5522 on: October 24, 2017, 12:20:09 AM »

True, there are cases like that. I guess it wasn't completely clear to me from your code samples what you were showing Tongue
Logged

Crimsontide
Level 5
*****


View Profile
« Reply #5523 on: October 24, 2017, 05:27:01 AM »

I think Noexcept was introduced to solve the problem of move semantics, example a vector<T>::push_back, there is a difference in performance if you use move constructor instead of copy constructor. This performance gain is achieved only if you can guarantee that push_back does not throw. For this particular case it is being introduced std::move_if_noexcept. So, in case of move operations where you need performance and you are sure of what you are doing, why not.

While you actually don't need no-except move for vector::push_back, you are right in that one of the primary motivations was to indicate that the move constructor/move assignment doesn't throw, and hence many container operations actually use move and don't revert to copy to ensure strong exception safety.

But adding a keyword this late in the game for such a small optimization, there has to be more to it... one would think... at least I did at first.  But no, that's really the only use for it.  So my rant was kinda a warning for those brave souls that might think noexcept could be a proper exception specification.  Sadly it is not.  Really I think they simply should have said 'move constructor/assignment cannot throw'.  We didn't need a keyword for destructors, why we need one for two functions is beyond me...
Logged
MorleyDev
Level 0
***

"It is not enough for it to just work"


View Profile WWW
« Reply #5524 on: November 12, 2017, 05:21:28 AM »

"Oh hey, Microsoft have come out with a package manager to C++. Neat, I'll give that a try aaaaand compiler errors when I try and pull down Box2D. Okay then."

"Oh hey, conan.io seems to be taking off somewhat! Open source package manager for C++. Neat, I'll give that a try aaaaand compiler errors when I try and pull down Box2D. Okay then."

"Okay, writing custom batch files it is for dependencies. I'll just premake5 vs2017 Box2D aaaand there's no way to specify to use /MT not /MD programmatically. Okay, I'll just write a powershell script to add that to the generated vcxproj file. Aaaaand it fails to build because premake5's vcxproj files use the Windows 8 SDK not the Windows 10 one."

"Okay, I found an up-to-date fork of Box2D that still uses CMake for building! That solves all the problems! Custom batch files for Box2D, SFML, and ChakraCore it is then!"

So yeah, dependency management in C++ still isn't a solved problem. *sighs*

====

Also why does ChakraCore compile on Linux via CMake, but only on Windows via msbuild? *sighs more* So I can't even do cross-platform scripting with cmake without checking which environment anyway >.<
Logged

oahda
Level 10
*****



View Profile
« Reply #5525 on: November 12, 2017, 06:04:11 AM »

What exactly do you mean by package manager? Is it a global thing or a per-project thing? Would something like how you usually get C++ libs on Linux (using apt-get or whatever your distro has) and Mac (Homebrew or MacPorts) count or do you mean something else?

Re /MT versus /MD I have this in a batch script that compiles with VS on the command line but it was too long ago for me to remember what it was really for, but if it helps…

Code:
msbuild premaketest.sln /p:Configuration=Debug /p:RuntimeLibrary=MT_StaticDebug
Logged

MorleyDev
Level 0
***

"It is not enough for it to just work"


View Profile WWW
« Reply #5526 on: November 12, 2017, 06:24:06 AM »

Tried that, but it seemed like msbuild just ignored it and continue with /MD (MD means dynamically linking the c/cpp runtime, MT means statically linking it. Static creates a bigger .exe but easier to distribute).

What exactly do you mean by package manager?

Something like npm or NuGet. Microsoft came out with vcpkg recently, and conan has been trying to gain traction for awhile now.

C++ is sorely lacking a tool for acquiring 3rd party libraries to use in your project in a repeatable cross-platform way that means you can take your source code from one machine to another without having to spend a day rebuilding the exact specific environment the code was compiled on.

"Just build/download the .lib files and commit them in your git repo" really should not be seen as the acceptable solution for C++ Windows Development in 2017, and doesn't work for something like MinGW very well (yay C++'s constantly changing ABI).
« Last Edit: November 12, 2017, 06:35:17 AM by MorleyDev » Logged

oahda
Level 10
*****



View Profile
« Reply #5527 on: November 12, 2017, 08:08:11 AM »

Yeah. So long as you're only targeting PC the ways I described do work decently at least but is there anything like that for Windows (e.g. like apt-get, or brew)?
Logged

MorleyDev
Level 0
***

"It is not enough for it to just work"


View Profile WWW
« Reply #5528 on: November 12, 2017, 08:39:48 AM »

vcpkg is Microsoft's attempt that's currently in preview (if you look closely in the msbuild output for a VS2017 C++ project you can see references to it, even). Rather than take control, the idea is you can use it on windows the same as how apt-get is used on Linux. So they aren't trying to solve the cross-platform issue, and vcpkg only works for Visual Studio so no mingw either.

Conan is trying to solve it cross-platform, but they both work fundementally the same: A command line task runner that strings together CMake scripts and handles the file copying for you.

I actually built something like this a few years ago now, for my final year university project, that worked similar. CMake already can do 99% of the work, since you can use cmake --build and cmake --install to actually build and put the files where you want without needing to learn the idiosyncrasies of each platforms configure/msbuild/whatever scripts, so long as you don't need to run any extra manual steps and the projects use cmake correctly. Conan and VCPkg are both looking to do the same.
Logged

qMopey
Level 6
*


View Profile WWW
« Reply #5529 on: November 12, 2017, 08:59:38 AM »

I hate texture atlases  Angry
Logged
Ordnas
Level 10
*****



View Profile WWW
« Reply #5530 on: November 13, 2017, 04:29:42 AM »

I hate texture atlases  Angry

How harder is than a texture arrays?
Logged

Games:

qMopey
Level 6
*


View Profile WWW
« Reply #5531 on: November 13, 2017, 08:50:35 AM »

They both suck. IMO the need to pack different images together just to transfer to the GPU is a failure.
« Last Edit: November 13, 2017, 01:13:58 PM by qMopey » Logged
ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #5532 on: November 13, 2017, 12:08:04 PM »

Tell that to the cable connecting your GPU to the rest of the computer.
Logged

powly
Level 4
****



View Profile WWW
« Reply #5533 on: November 14, 2017, 04:25:03 AM »

Texture arrays are okay unless some of the layers need to be huge and you don't want to go virtual textures.

The need for these objects doesn't arise from bandwidth problems though. It's old hardware being more restricted with memory accesses and the APIs following along too slowly. The reason for a limited amount of texture units originated from only being to physically access that many texture objects at a time which has been lifted ages ago.

Nowadays OpenGL has the bindless texture extension that lets you directly access as many separate texture objects as you'd like and have the pointers in an array if you will, essentially avoiding all of these problems. Depending on how wary you are about requiring modern hardware, this might be a major issue. NV/AMD cards from the past 5 years or so all seem to have support for this so I wouldn't worry about it.
Logged
oahda
Level 10
*****



View Profile
« Reply #5534 on: November 14, 2017, 05:17:56 AM »

Since what version specifically (including GLES and WebGL versions if those have it)?
Logged

qMopey
Level 6
*


View Profile WWW
« Reply #5535 on: November 14, 2017, 06:30:28 AM »

Nowadays OpenGL has the bindless texture extension that lets you directly access as many separate texture objects as you'd like and have the pointers in an array if you will, essentially avoiding all of these problems. Depending on how wary you are about requiring modern hardware, this might be a major issue. NV/AMD cards from the past 5 years or so all seem to have support for this so I wouldn't worry about it.

Finally an extension I actually care about. Thanks for bringing this up! Searching around for GLES minimum version that supports bindless textures... No luck so far.

Edit: Maybe this https://www.khronos.org/registry/OpenGL/extensions/IMG/IMG_bindless_texture.txt and https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_gpu_shader5.txt

Edit2: Looks like these extensions are a little too new for my taste. I'll just stick with atlases even though I hate them.
« Last Edit: November 14, 2017, 08:24:33 AM by qMopey » Logged
powly
Level 4
****



View Profile WWW
« Reply #5536 on: November 15, 2017, 01:00:14 AM »

Since what version specifically (including GLES and WebGL versions if those have it)?
None, it's an extension and not a core feature -- sorry, my description was a bit vague. I believe Intel still doesn't support it, might be part of the reason why it's not in the core.

Finally an extension I actually care about. Thanks for bringing this up! Searching around for GLES minimum version that supports bindless textures... No luck so far.

Edit: Maybe this https://www.khronos.org/registry/OpenGL/extensions/IMG/IMG_bindless_texture.txt and https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_gpu_shader5.txt

Edit2: Looks like these extensions are a little too new for my taste. I'll just stick with atlases even though I hate them.
Ah, sorry for bringing up your hopes Embarrassed tbh I'm quite surprised there's a GLES counterpart, I wonder how widespread the support is.

btw how do you handle repeating and mip maps with atlases? manually?
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #5537 on: November 15, 2017, 06:57:51 AM »

Ah, sorry for bringing up your hopes Embarrassed tbh I'm quite surprised there's a GLES counterpart, I wonder how widespread the support is.

btw how do you handle repeating and mip maps with atlases? manually?

No problem! I had fun researching for about 2 hours Smiley Plus it is nice to know eventually the texture binding problem will go away eventually.

I simply don't do repeating or mip-maps. Making a 2D sprite based game. Repeating via tiling on the CPU, so overhead is really low. If I were to ever make a 3D game it would probably not use textures really at all! 3D textures are very complicated. I worked on a AAA game where they avidly avoided using conventional texturing techniques, and instead sparingly used some repeating textures for things like projecting grass/foliage waving in the wind atop of hills or other triangle meshes. It worked very well, and most rendering code was extremely simplified. This freed up a lot of dev-time to focus on making other more interesting graphical effects, and the artists enjoyed never needing to fiddle with uv maps.
Logged
Ordnas
Level 10
*****



View Profile WWW
« Reply #5538 on: November 16, 2017, 01:02:26 AM »

A case where a texture array could be used in a 3D game I think could be in a car cockpit, the gauge can be animated using a spritesheet and each texture array index dependent of the car RPM / Speed.


Logged

Games:

Maximillian
Level 0
**


View Profile
« Reply #5539 on: December 10, 2017, 11:40:12 AM »

I guess I am grumpy. I have a question. Does anyone here know -- I hope someone does -- whether it is possible to create a DOS game, say a single level of Bubble Bobble, using QBasic? I know it is. But my question is, can I make it run fast enough on a PC 486? I'm using DosBox and whatever kind of graphics I try to draw using QBasic runs so slow I can see it "unfolding" on the screen. The image does not appear instantly. Rather, it literally "unfolds" in front of me. I can see it being drawn. And it does not matter whether I am using an interpreter or a compiler. It is the same either way. Do I have to use something else? Borland C++ with assembly? Google didn't help me much.
Logged
Pages: 1 ... 275 276 [277] 278 279 ... 295
Print
Jump to:  

Theme orange-lt created by panic