« first day (844 days earlier)      last day (4095 days later) » 

8:00 PM
I wrapped this function and gave it sane interface
 
user142019
@sehe TO PARSE WIKITEXT
 
Whoever created glShaderSource function: I want you to die slowly and in severe pain in C hell. I hate you so much.
 
user142019
I won't ever want to do that in Erlang.
 
@StackedCrooked Not in C++11.
 
user142019
Wikitext is from hell.
 
8:00 PM
@bartek LOL
 
@Zoidberg senseless. WP is supposed to be open. I'd do it all directly from ECMA script
@Zoidberg you don't have to handle it all
 
I am writing wrappers for GLShaderSource
sorta.
 
@BartekBanachewicz void *c_hell = &c_hell;
 
DirectX and OpenGL
sucks a LOT
 
@BartekBanachewicz Hyperbole much? Note that this might seem "normal" on twitter, but you got to ask yourself: did you really wish to contibrute to the culture of gratuitous death wishes on the internet?
 
8:01 PM
@WindAndFlame hm?
 
@sehe you haven't seen that API.
 
Ell
@FredOverflow ahh okay
 
@WindAndFlame I have seen his tweet
 
@sehe you haven't (probably) seen that API
 
There are justifications for gratuitous death wishes... 1, the stupidity of a paid for C++ spec... 2. The Open GL API
 
8:02 PM
I don't really wish him death, of course
 
@BartekBanachewicz I did. Actually. I haven't actually had to make it work (it was already in working order, and it was C anyway)
@BartekBanachewicz That's the problem
 
why would you hate glShaderSource?
 
@sehe Well, would you, in that guy's position, take that literally?
 
@doug65536 Because it is a bad API
 
8:03 PM
@doug65536 -.-
 
so what if you have to pull out some funky iterators. big deal
 
Let's just say, I have completely rewritten a Shader API, memory buffers and all, in order to not use that API.
except where I have to
 
@BartekBanachewicz It's not about this case. And it is certainly not about what you mean. It's about the growing practice. A slow but steady decline of inhibitions due to anymous-land
 
Speaking of my Shader API ...
Don't suppose anyone wants to help me with my bridging logic ... :) bridging to DirectX or OpenGL implementation ? :p
Stuck on C++ 11 syntax.
 
I guess they figured 3D graphics people could handle an array of null terminated string pointers
 
8:05 PM
@sehe I am very expressive person IRL too. That led myself to many problems, of course, but I don't really think that I wrote that hidded behind, as you call it, anonymous-land.
@sehe Please note that I use my real name both here and on Twitter
 
using string pointers is a really/really/ bad idea... I dropped them all, and went to vectors of int8_t ...
 
@BartekBanachewicz Good point
 
I kept losing segments of my buffers.
:(
 
@BartekBanachewicz I just don't like the fact that threats or death-wishes are somehow acceptable in public, written, history. There's a big difference between venting "live" (IRL) and committing it to the internet.
 
I mean, they were still there... Just couldn't read them. I suppose if I were more epic with std:: I wouldn't have that problem, so just reduced complexity. :)
 
8:07 PM
@WindAndFlame DirectX is dead.
 
Both in lifetime and audience reach
 
Nah... DirectX is moving to XNA.
 
user142019
You all suck.
 
Its not going anywhere.
 
@WindAndFlame XNA is dead too.
 
8:07 PM
Quit saying dead.
We have to walk on eggshells in our society now.
 
@Zoidberg Babies are noobs sucking boobs.
 
@WindAndFlame hehe.
 
We don't let the government censor speech, but it is totally okay for corporations to do so.
 
@Zoidberg It's right here
 
@sehe yeah, but, as I already pointed out, I doubt the guy would take that seriously. If I was a street thug or southern-us gun owner, then maybe. But please take the topic into consideration.
 
8:08 PM
in 10 years, we are all going to live in new eden, have jump clones, and everything will be ran by corporations. Promise.
 
@BartekBanachewicz As I already pointed out, that's irrelevant for the point I'm making
 
@WindAndFlame 10 years? I cannot wait that long :(
 
user142019
lol yay my script workz. xD
 
But you might get a really cool space ship.
 
4 messages moved to Sandbox
 
user142019
8:09 PM
lol
 
Eve Online, it will take you 10 years just to skill up to fly anything cool anyway.
 
@Zoidberg Please be testing it elsewhere?
 
user142019
Meh. :(
 
@Zoidberg Or I'm going to use my own script again, too
 
You can test it in Java Sucks.
 
8:10 PM
@sehe I think you are overreacting a bit; entering teenage counterstrike server would produce more threats/minute than pretty much any other place in the world. That's the internet.
 
:7578661 sehe@desktop:~/Userscripts$ git grep daknok
SEChatModifications.user.js:    // Define the message daknok command
SEChatModifications.user.js:    ChatExtension.define('daknok', function (id) {
@BartekBanachewicz The problem with that assessment is that you think I'm somehow reacting to your tweet only. That's not what I said.
 
user142019
lol
 
@WindAndFlame A wrapper for GLShaderSource doesn't need to be all that complex. Obviously, you can add a lot more, but I'd personally keep most of the other "stuff" (e.g., loading source code from files) separate.
 
I thought making a mini game in native C++ for a windows store application would be a great use case for me to learn C++ 11 after years of not using C/ASM... *cough...
 
yes I've heard people making death threats over voice in games. people are crazy
 
8:11 PM
@BartekBanachewicz Also, that may be the internet, but the choice remains: do you want to think it's normal
 
@JerryCoffin I am allowing the user to switch between DirectX and OpenGL at run time.
 
@sehe Depends on the context entirely for me.
 
Its more of a bridge, than wrapper.
 
@BartekBanachewicz The context is the internet, and humans. Duh.
 
@JerryCoffin that's bad
@sehe too wide
 
8:12 PM
glShaderSource is like that to minimize overhead, you can deliver a batch of strings at once. If you can't handle some string pointers, don't use C APIs
 
@BartekBanachewicz Well, I'll gladly borrow a set of eye-blinders one day. Thanks for the offer :)
 
vectors are guaranteed to be contiguous, a lot better than string pointes.
 
@WindAndFlame Sounds like a virtual base class and a couple of derived concrete classes. At least offhand, I don't see any differences so major you couldn't abstract them away.
 
the api wrapping them.
 
@WindAndFlame Strings are guaranteed to be contiguous.
 
8:14 PM
@JerryCoffin the implementations are actually in separate classes that derive indirectly from the abstract shaders through encapsulation, (rather than direct inheritance)....
 
@sehe I'm just younger :) Feel free to borrow some of that too
 
> Student: Have you ever gotten any death threats because of changes you made to the language?
> Stroustrup: I have never gotten any death threats for any reason. And let's keep it that way.
 
@JerryCoffin yeah, I meant, if vectors are guaranteed to be contiguous, then there is no advantage of using string * ... the string apis will clip data if you are not careful.
(like me)
 
@BartekBanachewicz I'd like to thank you for your deeply insightful remark (if only you'd make one so I could).
 
@BartekBanachewicz That's low :) You know, even younger people might have (different) norms :)
 
8:15 PM
@WindAndFlame What string apis are you talking about that will "clip data"? Something from C like strncpy perhaps?
 
@JerryCoffin only vertex and fragment shaders. This wrapper was just bad. Oh wait it's yours. Than ok, it's not that bad, but I still wouldn't use it
 
@JerryCoffin Honestly, I don't really know. I was trying to partition my memory buffer ... and was trying to use string functions, strncpy, and a bunch of others. \0 is signifant in places, and I didn't have the patience to figure it out. Raw pointers seemed easier.
shouldn't say raw... but, you get the idea.
 
@BartekBanachewicz I'm not asking you to like it -- but "just bad" doesn't give much of an idea of how you think it could/should be improved or what would be better. My experience is pretty simple: it's easy to use, and it works.
 
@sehe bah. I am not going to grow up faster than it's absolutely necessary
 
so, now I just use memset, memcpy, etc with indexes into my vector, and there it is.
 
8:18 PM
@BartekBanachewicz It's not about that. Anyways. I just wanted to say it. I've spent about 20 messages too much on this.
 
@JerryCoffin you don't cache sources, for example
 
@WindAndFlame Sounds quite horrible to me. What's the advantage over using std::string and/or std::vector as they're intended?
 
Performance.
 
@WindAndFlame that's terribad
 
@BartekBanachewicz Yes -- as already mentioned, caching is (and IMO should be) separate.
 
8:19 PM
@JerryCoffin so separate shaders from the program
 
just make a reference to & vector[0], (or vector.data(), vector.front(), whatever),
then you can use the vector wrapper, when you need to push_back more vertice meshes, or other compiled shaders.
Since my "problem'" isn't strings, or vectors, but a raw memory problem, I prefer to use raw memory functions.
 
its reasonable as long as you are using shared_ptr and resetting everything when you clean up
and don't have overflows. ;)
*cough
 
@StackedCrooked Alignment, one suspects.
but I'm not actually sure how that could result in such a large size increase.
 
Though, buffer overflows often help one achieve a zen like state when strange patterns occur on one's p.c.
 
8:22 PM
@DeadMG Hmm... When byte-aligned the objects size only increments by 1. It seems you're right.
 
and by "zen like" state, I mean drunken rage.
 
@BartekBanachewicz I actually had one that did that for a while -- at least in my use, the efficiency gain was too minimal to justify the extra work to use it.
 
Perl compiler to JavaScript and Go. This is three nightmares in one for me. https://github.com/fglock/Perlito
 
@JerryCoffin my shader class automatically caches all bindings, uniforms etc. Without it it was pretty useless imo
 
I have a model class that encapsulates shader, and that points to textures, shaders, meshes, etc.
 
8:24 PM
@StackedCrooked The issue is that for an array, the next element must have the alignment of it's first member, so if the whole structure size is not a multiple of N, then it must be increased to match this size.
 
@DeadMG Oh, I just realized that the extra size may be just padding and that boost only stores the 'set'-flag as a char.
 
I implement my Model class as a Controller.
Shader, Texture, Mesh, etc, are all "Models" for that Controller.
 
@StackedCrooked Of course it does- it wouldn't be so wasteful on purpose.
 
@BartekBanachewicz Sounds (to me) like a failure to comprehend modularity. ;-)
 
I created a new project and it immediately crashed.
 
8:27 PM
@JerryCoffin why, no. It just has everything required to render
 
@FredOverflow Eclipse unresponsive? How could that possibly be?
 
user142019
@FredOverflow Vim and problem solved.
 
@JerryCoffin Yeah, blows my fucking mind.
 
user142019
inb4 no
 
@BartekBanachewicz "This beam is useless. It hasn't been built into a skyscraper yet!"
 
8:28 PM
 
@Zoidberg I cannot live without auto-complete. I'm a pussy programmer.
 
@JerryCoffin waaat?
 
user142019
Yes Vim has no auto-complete.
 
@FredOverflow after about 10 languages or so, its the only way to go.
 
8:28 PM
@WindAndFlame What is the only way to go? Ditch auto-complete?
 
I remember my m_ days.....
@FredOverflow don't have time to learn 99 APIs.
 
@DeadMG It wouldn't be wasteful to occupy padded space :P
 
@WindAndFlame So you're a pussy programmer, too?
 
I don't like holes in my stack.
 
@StackedCrooked True, but they likely don't know the alignment in advance.
 
8:29 PM
lol... Technically, I am a solution architect... So, yeah.
 
@DeadMG It's the same as alignment of T?
 
user142019
 
@BartekBanachewicz As in: "It's bad because it only does one specific thing, not all 54 other things I associate with that (because I still don't understand modularity)."
 
besides, it's impossible to do anything about- they have no extra data to put in there, they can't change the alignment, and they can't pack multiple boost::optional.
 
Junior programmer is everybody can able understand your code is wrong. Senior programmer is nobody can able understand your code is wrong.
 
8:31 PM
@FredOverflow You wish! How many guys wish they could program pussies instead of computers?
 
@Zoidberg is ooold
 
user142019
I don caaare.
 
wow. That tweet hurts me in the brain.
I want that in a poster.
okay, whoever documented std::bind, I want to slap with a fish
 
struct { int a; char b; } blob{}; // is accessing the padded bytes UB? if yes, then won't memcpy invoke UB?
 
can I use fish threats?
 
8:33 PM
@sehe Can someone translate that into English, please?
 
I pad byes in memory buffers all the time.
 
@StackedCrooked Ask in SO and receive the rep.
 
you sizeof(struct) * numCopiesOfStruct
 
user142019
 
DirectX refers to struct size as strides ...
including the padding.
 
8:36 PM
@Zoidberg I found it funnier with stack traces.
 
OMG.. Microsoft's documentation on std::bind is horrid! Who would have thought! *sigh
 
user142019
@FredOverflow :)
 
Isn't std::bind kinda deprecated now that we have lambdas?
 
@StackedCrooked No.
it's not UB to access the padded bytes, but you can't depend on their value.
@FredOverflow Only when we have polymorphic lambdas.
 
I actually have been reading about pros and cons of both methods
 
8:37 PM
So I can access uninitialized bytes without getting UB? Interesting.
 
@DeadMG We'll get them eventually, right?
 
@FredOverflow I believe that they are initialized when the struct is, just not to any particular value.
 
ah ok
 
@FredOverflow C++14, or if not, C++17.
 
8:38 PM
does the Standard make any guarantees about padded bytes? Are they set to zero or anything?
 
1 min ago, by DeadMG
it's not UB to access the padded bytes, but you can't depend on their value.
 
@TonyTheLion you have to memset everything to 0 anyway to make sure everything is 0
you have to do that /anyway/
 
@WindAndFlame memset? MEMSET??? This is C++, not C.
 
user142019
@WindAndFlame wat no.
 
user142019
Use a decent ctor.
 
8:39 PM
Anyone ever teach computer science before?
 
for a memory buffer, memset.. ..
sigh.
 
user142019
std::vector PROBLEM SOLVED.
 
@FredOverflow memset is pro
 
user142019
memset is terrible.
 
memset is gay, unless you're writing C code.
 
8:40 PM
French Wikipedia articles always seem like they're written by wankers.
 
user142019
Use std::fill if you have uninitialized buffer for some reason.
 
user142019
And no, it's not slower than memset.
 
@Zoidberg std::uninitialized_fill ;)
 
std::vector<int8_t> MemoryBuffer;
MemoryBuffer.resize(MemorySize);
memset(&MemoryBuffer[0], 0, sizeof(MemoryBuffer[0]) * MemoryBuffer.size());
or std::fill
 
resize will set to 0, anyway. No need for memset or std::fill.
 
8:41 PM
fill uses memset.
 
@FredOverflow Why, is C homophobic?
 
*I think
 
user142019
@WindAndFlame that's defined nowhere.
 
@FredOverflow Well that explains why I like it...
 
user142019
8:41 PM
Point is that std::fill is type-safe and memset is not.
 
user142019
Or uninitialized_fill or whatever. :P
 
type safety is not an issue when you are just copying over memory very fast, thousands of times a second.
 
user142019
Don't write C in C++.
 
You can never have a vector with uninitialized values inside.
 
user142019
Type safety is not an issue? Y u no assembly?
 
8:42 PM
ooh, a religious debate.
:)
 
Type safety is an issue? Y u no Haskell?
 
user142019
@WindAndFlame so what?
 
Scrape for nano-seconds and let me know if you are willing to sacrifice fill, for memset. :p
 
user142019
Fill is not slower than memset.
 
@Zoidberg If type safety is not an issue, I would go with a dynamic language. Assembly is so verbose...
 
user142019
8:43 PM
In any respectable implementation.
 
the type check for fill is dynamic? not static, right?
 
WTF, no.
 
user142019
In fact, because it's type safe it may even be faster and I wouldn't be surprised.
 
@WindAndFlame No, it's done statically with TMP.
 
@WindAndFlame std::fill is templated. The type is resolved at compile time.
 
8:44 PM
k
 
I don't think there's any late binding in the standard library, is it?
 
but there is no type to check for... you are copying memory out of a GPU, to system memory, to another GPU, etc.
 
Never underestimate the power of TMP (template masturbation programming).
 
user142019
Also use immutable objects. :3
 
@WindAndFlame You still got a bunch of bytes, so char *.
 
8:44 PM
@EtiennedeMartel std::function uses virtual member functions internally.
 
you are literally manipulating raw memory.
 
user142019
const ALL THE THINGS!
 
why char *? why not vector<int8_t> ?
 
user142019
Because you want bytes.
 
user142019
And a byte is a char.
 
user142019
8:45 PM
int8_t may not exist.
 
that way, I can push_back when I want, when I am not copying that buffer to GPU, or from the GPU
int8_t is guaranteed to be 8bits if it is supported by the compiler.
*I think.
 
Wait, are you talking to OpenGL? You might as well use memset then. Your code is fucked up, anyhow.
 
I researched that specifically,
DirectX AND OpenGL at the same time.
 
user142019
Both are for graphics so both are terrible.
 
What's wrong with 3D graphics?
 
8:46 PM
his hair, apparently.
 
@FredOverflow 2D monitors
 
jumps out and grabs you, its so D
3D
:p Touchscreen, 3D monitors for laptops, coming soon to a desktop / handheld phone near you.
 
When I do some D3D11, and I map a buffer, I get a void *, which I cast to a pointer of the relevant type.
And I can then use std::copy or std::fill as needed.
 
user142019
Haskell has a nice type system.
 
I do not deal directly with bytes.
 
8:48 PM
@EtiennedeMartel the reason I don't use that, is I like that I will get big errors when I try to memset beyond the size of the vector... void * had no size associated, unless you start sizeof()ing everything or ARRAYSIZE which is SO ornery when it comes to pointers.
 
@WindAndFlame Eh?
 
@Zoidberg I just noticed that the words "bytes" and "types" are pretty similar.
 
sorry, was talking about why I don't use void * ... anyway... I like vectors, cause I can use them as raw memory buffers to copy around, AND to push things into when I need to
 
user142019
Why the fuck would you use memset in C++ seriously.
 
@Zoidberg Because you're terrible?
It's a legitimate reason.
 
8:50 PM
@zoidberg when you need to copy over a memory buffer that you have partitioned.
 
memset? void*? what the heck is going on.
5
 
@WindAndFlame Why not std::fill?
 
@Zoidberg just in case the compiler does something stupid, like calling the constructor repeatedly lol
 
8:51 PM
Well, I was under the impression that std::fill was slower than memset because of the wrappings.
but, I was just told no.
that it was all static.
SO ... I need to profile it.
 
Profiling sounds like a good idea.
 
I will go with the faster.
I will.
 
user142019
@doug65536 yes compiler really generates code to call the ctor of char.
 
Why don't you just use it.
 
@WindAndFlame it better ought not be, it ought to be using memset (for POD types)
 
8:51 PM
@WindAndFlame It's all inlined, and an implementation can always just call memset if the conditions are satifsfied.
 
@Zoidberg that was the joke
 
@mooingdu
 
@Zoidberg only in theory.
 
Profiling is a waste of time if it causes no noticeable difference in your program.
 
@MooingDuck if fill is just using memset, why not just use memset in the first place to be clear about what you are doing?
 
(And it causes a noticeable difference in your code, namely safety)
@WindAndFlame You suck.
 
@WindAndFlame I think fill is clearer.
 
It's also safer.
 
It fills a container.
 
user142019
@R.MartinhoFernandes Unless you enjoy profiling, in which case it's not a waste of time since you experience enjoyment. :)
 
8:53 PM
@WindAndFlame because fill always works. memset only sometimes works. fill is always as fast as memset when memset would work. Why use memset at all?
 
@R.MartinhoFernandes copying around 100mb buffers a couple hundred times a second is something to optimize.
 
fill implementations try to detect when memset works, don't they?
 
@WindAndFlame Only if the user notices it.
 
@doug65536 yes
 
8:53 PM
Okay, memset is definitely faster than fill
 
user142019
How can you tell?
 
though, that is with just small copies, 4 * float.
 
@WindAndFlame debug build or release?
 
release.
 
user142019
ohlol
 
8:54 PM
@WindAndFlame definitely should not be slower
 
user142019
Code + output please.
 
You are not profiling your code?
Then, yes, profiling is a waste of time.
 
but, the percentage of the performance gain will be obviously smaller with larger memory copies.
 
"Hey, look this program no one will never use after this runs faster".
 
user142019
Also buy a better compiler.
 
8:55 PM
@WindAndFlame Only 4 floats? Why not use 4 float assignments?
 
Also stop optimizing
 
struct {float x, float y, float z, float w}
 
Memset?
FFS.
 
@WindAndFlame For such a small thing, it's faster to just assign 4 times.
Because memset checks for alignment and shit.
 
@WindAndFlame You can just assign the entire struct.
 
8:56 PM
@WindAndFlame that's bad and you should feel bad
 
well, in honesty, I am assigning thousands of vertices to my memory buffer, then copying to the GPU...
 
struct {...} foo = {}; shorter than memset, just as fast.
 
@R.MartinhoFernandes probably faster, no looping
 
user142019
Use SSE. :D
 
8:56 PM
my memory buffer is partitioned: Static Meshes, Instance Data...
 
big memcpy's will be memory bound -> no need to "tune" it
 
@MooingDuck GCC uses memset for it (you can try compiling without the stdlib and it will fail at link time asking for memset)
 
SSE is something I want to look into
 
@WindAndFlame That sounds like a nightmare.
 
@R.MartinhoFernandes well, that works too
 
8:57 PM
@WindAndFlame if you have to look into SSE that's already sign your code sucks
 
it is game programming.
 
Anyway, I encourage you to browse viva64.com/en/examples
 
user142019
Ooh game programming.
 
it is lame attempt at game programming
 
8:57 PM
@WindAndFlame I do game programming, and I never saw that kind of shit.
2
 
@BartekBanachewicz or your compiler, really
 
lol It is a standard design pattern with games, partitioning buffers.
 
or compiler, yes
@WindAndFlame bullshit
 
geez.
 
user142019
But is it a scalable and agile design pattern?
2
 
8:58 PM
interleaved are usually faster.
anyway, dammit dude.
 
@WindAndFlame Beware, uttering the "DP" word in the Lounge is dangerous.
 
@EtiennedeMartel It's because you don't write shit games.
 
you're not gonna write another UE3
so focus on readability and usability
 
8:58 PM
@FredOverflow double puffering?
 
@R.MartinhoFernandes Do you use that analyzer? How good is it?
 
@StackedCrooked design puffy
 
@Zoidberg Yesterday I saw a book about MapReduce Design Patterns. They're probably webscale.
 
@MooingDuck guess what?!?
 
@FredOverflow exclusively
 
8:59 PM
@AndreiTita I don't use it, but it seems pretty nice if you have a legacy codebase with some C-like code.
 
@user1690130 exclamation marks buried in question marks. (did I get it right?)
 
The number of fail memsets and memcpys that thing has found on open-source projects is staggering.
 
@StackedCrooked The game I'm currently working on has no artists, so it's gonna be shit.
 

« first day (844 days earlier)      last day (4095 days later) »