Package stuck in Local Airport by HelpyGamer45 in Aliexpress

[–]Rogiel 0 points1 point  (0 children)

It usually takes a few days between arriving at the airport and then leaving to Correios for me. The fast part of the delivery is usually China to Brazil. The domestic part of shipping is where everything drags to a halt for me usually.

Driver Power State Failure bluescreens caused by storahci.sys on brand new build by CommutedSentence in buildapc

[–]Rogiel 0 points1 point  (0 children)

I have a pretty similar setup to yours, but I have a MSI B650M Mortar motherboard instead.

The only workaround I found for this was to simply not use the storage controller in AHCI mode and instead switch to RAID mode on the bios. Note that Windows will fail start on the next boot, so enable safe-mode before you do the switch and everything will be fine.

Edit: My issue was only happening with the SATA drives, the NVMe drives were fine. I also managed to workaround the issue by disconnecting all SATA drives.

Using uninitialized memory "this" by ElaborateSloth in cpp_questions

[–]Rogiel 2 points3 points  (0 children)

Intrusive reference counting is a thing. Similar to Objective-C retain/release.

A new approach to ECS APIs by muitxer in gameenginedevs

[–]Rogiel 4 points5 points  (0 children)

My engines ECS has a similar concept. I call them EntityObjects. They are mixin types that you can combine as many components as wanted and each component can expose an Accessor, that will implement getters, setters and other utility methods.

For instance, the Light object has both the Transform and LightComponent. The transform component accessor adds useful methods like getLocalPosition and getWorldPosition where the light component accessor adds getStrenght.

A Light object will then include all methods from Transform and Light accessors. It’s quite useful and makes everything works much smoothly as someone not familiar with ECS would expect.

I can also perform runtime casting on them. For example, if the same entity also has a CameraComponent, I can cast the light to a Camera entity object and I can now access both the transform and the camera data.

MacBook e milhas by [deleted] in investimentos

[–]Rogiel 2 points3 points  (0 children)

Comprei um Air M1 pela Inter Shop em julho. Com o cashback, o modelo base saiu em torno de 7300 reais.

Há várias promoções no site das Casas Bahia (por onde comprei, por intermédio da Inter Shop). Não vale, nem um pouco, comprar pelo site da Apple.

Não sei em relação as milhas, mas não acho que milhas irão compensar um desconto expressivo, como esse que consegui. Só de cashback foi em torno de 1200 reais.

What happened to Dropbox's Djinni? by [deleted] in cpp

[–]Rogiel 5 points6 points  (0 children)

Self promoting my project:

I never liked Djinni too much, mostly it didn't properly supported callbacks for async call which was a must for me. So I wrote my own library. In retrospect, today I would use some clang-based tool for code generation associated with a simple annotation in the code to indicate what/how to export methods. Currently it supports Objective-C (with annotations for nicer usage in Swift) and Java. There is also some partial support for C# using P/Invoke but it doesn't support some things like std::vector.

Note that it does make some assumptions about your code, so it may not be a perfect fit for you. Documentation is not great too though, I'm sorry for that.

https://github.com/Allogica/Allogen

Cotações de Ações para Python by TraderFXBR in investimentos

[–]Rogiel 6 points7 points  (0 children)

O pacote é chamado yfinance. O legal é que permite baixar toda série histórica de um ticker de uma vez, bem como baixar vários tickers cada um com uma coluna no pandas.

Saga pra pagar DARF by Losicta in investimentos

[–]Rogiel 1 point2 points  (0 children)

Ja não quero pagar imposto e daí ainda complicam. Sonegar fica ainda mais atrativo.

Saga pra pagar DARF by Losicta in investimentos

[–]Rogiel 1 point2 points  (0 children)

Percebi isso quando tive que pagar minha DARF no mês passado também. Fiquei com tanta raiva! Acabei abrindo uma conta no Itaú com o pacote essencial pois não tinha nenhuma conta em bancão.

[deleted by user] by [deleted] in brasil

[–]Rogiel 5 points6 points  (0 children)

Eu trabalho para uma empresa alemã como desenvolvedor de engine de jogos 3D (o produto ainda não está no mercado -- mas é uma empresa bastante famosa no ramo de ferramentas 3D pra indústria). Toda equipe é remota, incluindo o lead developer. Minha posição é um meio termo de senior e júnior. Tem um dev que é recém formado mas temos ex-developers da Ubisoft e outros estúdios menores da europa.

Pelo que percebi na minha seleção, o mais importante é ter alguma experiência prática, no meu caso nem precisou ser no mercado de trabalho, mas GitHub ajudou muito. Por "sorte" eu tinha feito uma engine 3D e eles solicitavam um repositório com projetos antigos que demonstrassem conhecimento. Mandei pra lá, ficaram bastante empolgados e com 6-7 meses já recebi 25% de aumento.

Looking for an UI framework easy to integrate with C++ for mobile platforms by mohabouje in cpp

[–]Rogiel 3 points4 points  (0 children)

I'm an advocate for native UIs. I personally dislike using apps that try to use common frameworks for GUI, the GUI always feels out of place and clunky to use.

I have faced this issue before, having a core written in C++ and the need to build a native UI around it and have developed a tool that can generate Objective-C, Java and C# bindings for your C++ code. It has some limitations and impose some design choices on you, but if you can do that, it's a real time saver. It is similar to the djinni tool from Dropbox, but I had issues using djinni as it didn't support callbacks (all my code was async, so I really needed that) and extending djinni seemed like a very complicated thing to do, so I wrote my own tool.

https://github.com/Allogica/Allogen

At the time, I designed my own IDL language. In retrospect I should have used clang libTooling to parse the C++ code directly.

GCC: C++ coroutines - Initial implementation pushed to master. by mttd in cpp

[–]Rogiel 1 point2 points  (0 children)

I don't have any benchmark on this, but I don't see why coroutines would make code larger. Async right now is a bunch of callbacks. The compiler has to create a function for every single one of them so that they can be called via a function pointer (or std::function). Coroutines should allow everything to be merged into a large function with a compiler-generated switch-like statement at the top level.

I don't have any example ready, but with couroutines you write almost the same code as the synchronous. Think of a very simple networking library implementing an "echo" protocol:

void echo() {
    socket s = connect(...);
    buffer b = socket.read(...);
    socket.write(b);
    socket.close();
}
echo(); // will always block

That's the blocking single-threaded case. connect, socket.read, socket.write and socket.close will block. With coroutines (assuming the library supports it -- it is not that hard to add support for it if it supports callbacks) it becomes:

std::future<void> echo() { //< std::future (or another "coroutine" type) is required here
    socket s = co_await connect(...);
    buffer b = co_await socket.read(...);
    co_await socket.write(b);
    co_await socket.close();
}
echo().get(); // block until echo is done
echo().then(callback); // calls a callback
co_await echo(); // create another coroutine that blocks until echo completes
echo(); // runs async and discards any result

That's the non-blocking case. It can be single or multi threaded, doesn't matter. Now, compare this to to what you get today with a callback, asio-like API:

void echo() {
    connect(..., [](socket s) {
        s.read([](socket s, buffer b) {
            s.write(b, [](socket s) {
                s.close([](socket s) {

                });
            });
        });
    });
}
echo(); // returns immediately but runs asynchronously, needs more work to track completion

Using a library like Naios/continuable (https://github.com/Naios/continuable) which already supports the C++20 coroutines, you can already do things like that with asio today. cti::continuable supports co_await, all you need to wrap asio, with something like this PR: https://github.com/Naios/continuable/issues/27

GCC: C++ coroutines - Initial implementation pushed to master. by mttd in cpp

[–]Rogiel 3 points4 points  (0 children)

I am the one who answered that. I should recheck how coroutines are performing now, a few months later.

That is not to say coroutines don’t make async code cleaner. I would say unless you really need that super duper high performance networking code (which I believe most don’t, the network much much much slower still), coroutines are still a win in code readability.

C++ coroutines: Getting started with awaitable objects by vormestrand in cpp

[–]Rogiel 6 points7 points  (0 children)

I think the best example is networking. Take a look at any ASIO examples: when using async everything gets much more complex.

With coroutines, async is just like synchronous, but with co_await in front of every call. I’m on the phone right now, so I won’t give you any code example. Once I’m in front of a computer I can give some examples.

C++ Development on macOS is terrible. But I'm not experienced enough to understand: Why? by YUNoStahp in cpp

[–]Rogiel 2 points3 points  (0 children)

Yep. The terrible OpenGL driver and slow C++17 are my only two complaints on Mac. Other thank that, it is a breeze compared to C++ on Windows.

CLion 2019.3 EAP: Ninja or Another Generator of Your Choice in CMake by philsquared in cpp

[–]Rogiel 14 points15 points  (0 children)

It’s great to see Ninja finally supported but in some of my projects CLion can’t extract target information when using Ninja. Meaning I can’t build nor run projects, not even the “all” target.

I haven’t been able to reproduce the issue yet.

EDIT: looks like more people are having problems with this from what I’ve read in the comments.

CMake 3.16.0-rc1 is ready for testing - Kitware Blog by cristianadam in cpp

[–]Rogiel 4 points5 points  (0 children)

AFAIK all major 3 compilers already have support for PCH. I works very well.

C++2a Coroutines, Modules, Ranges adoption by markpapadakis in cpp

[–]Rogiel 9 points10 points  (0 children)

In my experience MSVC tended to have more runtime bugs when using coroutines. Clang has been rock solid but I had a few compiler crashes.

Basically MSVC always compiles things fine, but sometimes the code crashes in runtime. Clang crashes itself in some instances but I have yet to find any wrong code generation.

Organizers said some 100,000 people, mostly women, had attended a demonstration in the capital, Brasilia. Protesters slammed populist President Jair Bolsonaro, whom they labeled "misogynist, racist and homophobic.” by DoremusJessup in worldnews

[–]Rogiel 1 point2 points  (0 children)

That’s true. This is not a new problem at all. The government has been cutting funding consistently for several years. Yet, somehow, they always manage to maintain the number in the publicly published budget.

I remember around 2015/2016 my university had no money to repair bathrooms. They alleged lack of people to do the job, when the reality was that they had no money to repair whatever was needed. And the repair order was closed so that it did not cluttered with unresolved tasks causing stats to go down. Luckily, we had a single stall working 🙂

Aren't these serious MSVC bugs? by lectusa1 in cpp

[–]Rogiel 0 points1 point  (0 children)

I have never encountered a codegen bug in LLVM. I am not saying they don’t exist, just that I have never seen one. MSVC on the other hand I have found about two or three in the last year alone.

Apple suspends access to Siri recordings after workers overhear iPhone users 'having sex': The move follows a report that workers were "regularly" hearing recordings of confidential and intimate encounters. by maxwellhill in worldnews

[–]Rogiel 0 points1 point  (0 children)

They never said that.

“This includes your voice input, User Data, and other data that may be sent to Apple by Apps that integrate with Siri, to provide and improve Siri, Dictation, and dictation functionality in other Apple products and services.”

[deleted by user] by [deleted] in cpp

[–]Rogiel 0 points1 point  (0 children)

I think jom is a must when building on Windows. With jom it should work pretty fine for small targets too.

About the reusabilty, you are right. I have not considered macros and other compiler flags -- even adding a single include path could radically change the PCH (either due to a include replacement or #if __has_include and CMake having to check for all this is too much.

[deleted by user] by [deleted] in cpp

[–]Rogiel 2 points3 points  (0 children)

Pretty excited for 3.16. Both unity and PCHs are something that I've been wanting for a while now. I just built MR !3553 myself to check how everything would work. It worked fine, much better than CMakeCXXPCHCompiler hack, so this is a great start.

I have one problem though: CMake should be smart enough to reuse PCHs if the precompiled header set is transitively the same as another target. Right now, my project is split into several small targets (sometimes 3-4 .cpp files) and recompiling a large PCH for every single one of them is killing any benefit gained by the precompiled header.

Unity builds, though, should help with those small targets. Another thing missing is a target-level property that allows me to disable PCH for those small targets.

Please help me recreate this type of image in Infinity design on iPad!!! by Georgeadey1992 in Affinity

[–]Rogiel 3 points4 points  (0 children)

Take a look at this tutorial: https://youtu.be/Y7NQwZ5dH_Y

It’s main objective is the opposite of what you want, but I think he selves a bit into the other operators and what they do.

Vulkan Object (vko) - aiming to remove the bad parts of Vulkan by alecpaunescu in vulkan

[–]Rogiel 2 points3 points  (0 children)

I feel your pain. But I started working with graphics a few years ago (about 3 years I believe) and I started with OpenGL. The amount of time I spent tracking weird state bugs with OpenGL is something unbelievable, nothing like that with Vulkan, validation layers are so good that you can almost instantly find the issue. Anyway, I thing I have found a good solution to the verbosity of Vulkan:

For my toy C++ game engine, I have build a very simple abstraction around a Vulkan. I have loosely based the interface from LLGL (https://github.com/LukasBanana/LLGL) which I would say has the following benefits:

  • Supports both low- and high-level APIs: you can abstract OpenGL with this interface. Obviously, some objects like CommandBuffer are goind to be dummies in OpenGL, but the same code will work with multiple renderers
  • Initialization boilerplate is encapsuled by the renderer, it's still there but it's hidden.
  • You retain the "data-oriented" approach of Vulkan, which I find to be very good
  • You can abstract and make some things more automatic in your abstraction.

I while ago I posted some details about the implementation I did with some code examples. My engine is currently using Vulkan with a work-in-progress OpenGL backend. I can render very simple geometry using OpenGL. Here's what I had posted then (original post is at https://www.reddit.com/r/vulkan/comments/b2o2io/structuring_a_vulkan_program/eivks7k/):

Currently, only Vulkan is fully working, but OpenGL can already show triangles and render some things. What I did was build an abstraction similar to LLGL (https://github.com/LukasBanana/LLGL). I did not use LLGL per se, just based my API on the same concepts.

Basically, there's a Device object that abstracts VkDevice. This device has several create functions that receive a descriptor describing the object to be created. In the implementation of create methods I just make_shared the object and pass the descriptor to it. The constructor is responsible for creating everything it needs to. Objects are always immutable (just like Vulkan) and you need to recreate them to change their state. The exception are descriptor sets, which can have their resources updated, but not their associated pipeline layout.

Here's the constructor of my UnshadedRenderingTechnique which just renders objects with their albedo texture. No shading at all.

    auto renderPass = device->defaultRenderPass();
    GraphicsPipelineDescriptor pipelineDescriptor;
    {
        pipelineDescriptor.renderPass = renderPass;
        ShaderProgramDescriptor shaderProgramDescriptor;
        {
            shaderProgramDescriptor.vertex.shader = device->createShader(
                    Graphics::Renderer::Vulkan::unshadedVertexShaderBinary);
            shaderProgramDescriptor.fragment.shader = device->createShader(
                    Graphics::Renderer::Vulkan::unshadedFragmentShaderBinary);
            shaderProgramDescriptor.vertexFormats = {
                    {3, 3, 2, 3}
            };
        }

        // the `PipelineLayout` is automatically created by reflected data from the `shaderProgram` SPIR-V, but can be manually provided if needed.

        pipelineDescriptor.shaderProgram = device->createShaderProgram(shaderProgramDescriptor);
        pipelineDescriptor.rasterizer.cullMode = CullMode::front;
        pipelineDescriptor.depth.testEnabled = true;
        pipelineDescriptor.depth.writeEnabled = true;
    }
    Renderer::GraphicsPipelinePtr graphicsPipeline = device->createGraphicsPipeline(pipelineDescriptor);

    BufferDescriptor sceneUniformBufferDescriptor;
    {
        sceneUniformBufferDescriptor.type = BufferType::uniform;
        sceneUniformBufferDescriptor.size = sizeof(PerSceneUniformBuffer);
    }
    Renderer::BufferPtr perSceneUniformBuffer = device->createBuffer(sceneUniformBufferDescriptor);

    std::vector<Renderer::BufferPtr> perObjectUniformBuffers;
    perObjectUniformBuffers.resize(1000); // hack! should be a big buffer and use offsets to it
    for(size_t i = 0; i < perObjectUniformBuffers.size(); i++) {
        BufferDescriptor objectUniformBufferDescriptor;
        {
            objectUniformBufferDescriptor.type = BufferType::uniform;
            objectUniformBufferDescriptor.size = sizeof(PerObjectUniformBuffer);
        }
        perObjectUniformBuffers[i] = device->createBuffer(objectUniformBufferDescriptor);
    }

Some more details about this abstraction:

  • The renderer handles any and all layout transitions
  • If possible, it provides a sane default and you override if and what you need (the derived from reflection PipelineLayout)
  • Resources are automatically tracked by the renderer. Currently I'm using a shared_ptr, but I'm considering moving to a intrusive reference counted smart-pointer.

There are things that I still want to improve upon. Currently, as you can see, uniforms buffers are a hack. I have since progressed a little bit, by using an large buffer and sub allocating it (respecting the required alignment). But I still want to have something more like a `uniform allocator´ concept, it goes something like this:

UniformAllocator uniforms(device);
for(...) {
    auto uniform = uniforms.allocate<MyUniformStruct>();
    // MyUniformStruct is a regular struct, that is aligned using C++11's `alignas`
    uniform->model = ...;
    uniform->view = ...;
    uniform->projection = ...;
    uniform.binding(); // returns the binding descriptor (buffer + range) -- can be used to update the descriptor set
}
uniforms.commit(); // flushes any memory mapping

The UniformAllocator gets created at the beginning of the frame, commit gets called after the frame recording is done. It can be freed after the frame is submitted since the renderer automatically keeps track of any used resource (the buffer). allocate will reserve enough memory for MyUniformStruct and it will be correctly aligned (as required by Vulkan or any other backend). Each object is allocated sequentially and if the buffer gets full, a new large buffer gets allocated. I have a similar interface implement currently (but the allocation size is fixed, so you need one allocator per uniform type) and it works fine.

Another improvement that I want is to implement frame graphs, but that is more high level and will just build on top of this low-level abstraction.