|
|
Hard to debug because when you have chains of them it can be hard to know which ones are even being compiled.
Real programmers use butterflies
|
|
|
|
|
|
In my GFX project I allow drivers to expose different methods depending on what their hardware supports. GFX will use them when available for better performance.
You tell gfx what you want by exposing a caps "using" and filling it with what you support like this:
Supports only batching:
using caps = gfx::gfx_caps<false,false,true,false,false,false,false>;
Supports everything but read ops and direct blts:
using caps = gfx::gfx_caps<false,false,true,true,false,false,false>;
Each of those fields has a named argument to tell you what it is, so it's not as confusing as it looks.
If you mark a field as true, you *must* implement the methods necessary to support that feature. For example, if you mark your target as readable, you must implement the method to read a pixel from its framebuffer.
This caps template is examined through partial template specializations, and the different methods are called based on its values. It chooses the best method it can to perform an operation, and falls back when the caps doesn't support it.
This isn't really possible to do any other way, except at runtime, and that comes with lots of overhead and additional code size for unused code.
Real programmers use butterflies
|
|
|
|
|
This is graphics related, so it took me a moment to realize that caps meant capabilities, not capitalization.
I think you want to flip the trues and falses in the second example.
I assume the non-template way would be to have an abstract Driver class define virtual functions that return false, with each driver overriding the ones that it supports and returning true?
|
|
|
|
|
No, there's actually more read operations than write. Although posting that did make me realize I turned off asynchronicity on that driver. Edit: Never mind, async is not supported under Arduino. I forgot I was looking at that and not the ESP-IDF driver.
Yes, the non-template way would require a virtual class, but then it couldn't do things like taking non-native pixel formats. Every pixel format is its own type. gfx::rgb_pixel<16> nets you a 16 bit RGB pixel, but it's a different type than gfx::rgb_pixel<24> or gfx::yuv_pixel<24>;
Real programmers use butterflies
modified 14-Nov-21 13:17pm.
|
|
|
|
|
For readability, you could introduce a new type/enum for each parameter that converts to a boolean.
That way it would say BATCH/NOBATCH, etc
If you have a unique type for each cap, then you could not accidentally transpose parameters in the long list of booleans.
I think you could figure out a way that the compiler would enforce it all without making the runtime any larger?
My C++ is very rusty, but I have faith that you can figure it out if you think it has merit. 😊
|
|
|
|
|
Yeah, I could do that, but with approaching 600 downloads here, and with over 30 stars on github i'm not sure I want to make such a big breaking change. caps is used *everywhere*
Real programmers use butterflies
|
|
|
|
|
Random content to just check something.
I need someone to answer here with a message, please
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
|
Thanks
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Pong[^]
Software Zen: delete this;
|
|
|
|
|
No you can't delete your post because it has sub items. OTH you can while playing with the URL
[Edit]
Doing that will not delete the thread, it will only delete the content of the top message and show it something like 'Message Closed'
modified 13-Nov-21 13:52pm.
|
|
|
|
|
@Nelek is a Protector - so he has additional privileges and powers. One of those is the power to delete any post, which means he can delete the whole thread (message by message) if he wants to.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
*lol* then protector should be aware to be protectors and keep that in mind when comenting to simple members
|
|
|
|
|
It's possible he doesn't know he can: you don't get a manual with the badge!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm working on the manual
|
|
|
|
|
Yeah, right! I think that probably counts as "documentation" and no bugger does that these days!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I do know that I can.
But the protector deletion "red X" is a different button, the standard "delete" widget is greyscaled as "not allowed" as Bruno says.
I would have said before I could still "delete" my own messages, but doing it would only delete the content. Now, I can't even click it.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
OriginalGriff wrote: @Nelek is a Protector Protector[^]?
Software Zen: delete this;
|
|
|
|
|
Yep. Hadn't you noticed the leathery skin, swollen joints, and so forth - or did you think that was just the Spanish sun?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: or did you think that was just the Spanish sun? Not anymore for me... haven't been back since Corona started
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
You are right, the standard "delete" is greyscaled and not clickable.
I would have bet that before I could still use the widget, but without really removing the message.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
And this is specific for the Lounge I think. It is different for 'B&S' and also for 'Spam and Abuse Watch'. Did not verified that in all the other sections like 'discussions' etc.
|
|
|
|
|
0x01AA wrote: And this is specific for the Lounge I think. It is different for 'B&S' and also for 'Spam and Abuse Watch'. "Spam and Abuse" = same behaviour as here.
"Delete" in not answered == active
"Delete" in answered message == not active.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|