pplux / px Goto Github PK
View Code? Open in Web Editor NEWSingle header C++ Libraries for Thread Scheduling, Rendering, and so on...
License: MIT License
Single header C++ Libraries for Thread Scheduling, Rendering, and so on...
License: MIT License
With multithread support maybe?
Hi,
I found a little yet annoying bug which causes severe issues after calling destroy() with px_render::Pipeline and subsequent call of createPipeline. There's one line missing in DestroyBackEndResource(), right after you call glDeleteProgram:
GLCHECK(glDeleteProgram(b->pipelines[pos].program));
b->pipelines[pos].program = 0; // <---- this one is required
Without this you'll get a lot of OpenGL errors by using deleted and reused Pipeline (since createPipeline reuses previously deleted Pipeline), because this check in ChangePipeline will always fail to execute the inner code in the if() block:
if (pi.second->program == 0) {
I cant compile with the .bat. I am using 2014 VS with C++14 support
'px_sched::ObjectPool<px_sched::Scheduler::Task>::D::state': is not a type name, static, or enumerator
[I'm closing this soon because it's not a real issue]
I remember that some years ago I liked this library a lot: [tinythreadpp] [API reference here].
From your docs, it seems that px_sched.h is:
whereas px_render.h is more complex (needs C++11/C++14).
I'm wondering if px_sched.h can be compiled without C++11, just using tinythreadpp.
AFAIR, the API is very similar (except a few missing constructor overloads in the thread class).
However, this post is just a useless experiment: nowadays most compilers support C++11.
Maybe this is just something for people trying to minimize file size (I don't think tinythreadpp uses STL, but I have to check).
So basically I'm going to close this now, leaving this post just as a suggestion for the few users that can be interested in removing the C++11 dependency from px_sched.h.
Sorry for polluting the Issue Section.
Hi,
how can I get the texture ID from a framebuffer?
frame_buffer.color_texture().id has invalid value...
ItΒ΄s to use in the Imgui image
Pseudo code:
px_sched::Sync sync;
for(int i = 0; i < 100; ++i) {
scheduler.runTask([&](){
// Heavy task
}, &sync);
}
scheduler.waitFor(sync);
Here the calling thread that creates the task will suspend waiting for the tasks to be finished before carrying on. This requires the pool of threads to be bigger than the actual core count to allow some threads wait for others and still have enough threads to keep using all cpus. One possible solution could be for the thread that waits on a sync object to start doing tasks from the list of tasks related to that sync object.
The idea is that if the thread needs to wait for a task to be finished it can go on and start working on that lists of tasks itself instead of waiting.
Entry point is not defined in the examples, how can I execute it?
I added the default "main" entry, and then call to sokol_main(int argc, char **argv) with the default parameters.
Is there a preprocesor or something to determine the entry in your API?
Thanks, I am waiting for a reasonable documentation to how to start or something
Can someone show me how to set custom uniforms?
I didn't find any example for the set_uniforms function
Any texture exposed from px_render, would be in B&W due to the fact that the shader only uses the first channel (for text is fine, but... nothing else)
Hi. I've cloned the repository and tried compiling it with:
.../.../px/examples$ make
g++ -std=c++11 -pedantic -g -O2 -Wall -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wdouble-promotion -Werror -Wextra -Wformat=2 -Winit-self -Wmissing-include-dirs -Wno-unused -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch-default -Wundef -o px_sched_example1 -lpthread -lpthread px_sched_example1.cpp
/tmp/cce6YjPP.o: In function `std::thread::thread<void (&)(px_sched::Scheduler*, px_sched::Scheduler::Worker*), px_sched::Scheduler*, px_sched::Scheduler::Worker*>(void (&)(px_sched::Scheduler*, px_sched::Scheduler::Worker*), px_sched::Scheduler*&&, px_sched::Scheduler::Worker*&&)':
/usr/include/c++/5/thread:137: undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
Makefile:42: recipe for target 'px_sched_example1' failed
make: *** [px_sched_example1] Error 1
Then, based on these links link1 link2 (that seem to contradict each other π ), I thought that -lpthread
must be put after the source files, whereas -pthread
only can be used before the source files.
I've tried the latter and simply replaced -lpthread
with -pthread
in the Makefile.
I don't know if this is the right solution, but it worked:
.../.../px/examples$ make clean
rm -f px_sched_example1 px_sched_example2 px_sched_example3 px_sched_example4 px_sched_example5 px_sched_example6 px_sched_example7
.../...//px/examples$ make
g++ -std=c++11 -pedantic -g -O2 -Wall -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wdouble-promotion -Werror -Wextra -Wformat=2 -Winit-self -Wmissing-include-dirs -Wno-unused -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch-default -Wundef -o px_sched_example1 -pthread px_sched_example1.cpp
g++ -std=c++11 -pedantic -g -O2 -Wall -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wdouble-promotion -Werror -Wextra -Wformat=2 -Winit-self -Wmissing-include-dirs -Wno-unused -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch-default -Wundef -o px_sched_example2 -pthread px_sched_example2.cpp
g++ -std=c++11 -pedantic -g -O2 -Wall -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wdouble-promotion -Werror -Wextra -Wformat=2 -Winit-self -Wmissing-include-dirs -Wno-unused -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch-default -Wundef -o px_sched_example3 -pthread px_sched_example3.cpp
g++ -std=c++11 -pedantic -g -O2 -Wall -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wdouble-promotion -Werror -Wextra -Wformat=2 -Winit-self -Wmissing-include-dirs -Wno-unused -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch-default -Wundef -o px_sched_example4 -pthread px_sched_example4.cpp
g++ -std=c++11 -pedantic -g -O2 -Wall -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wdouble-promotion -Werror -Wextra -Wformat=2 -Winit-self -Wmissing-include-dirs -Wno-unused -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch-default -Wundef -o px_sched_example5 -pthread px_sched_example5.cpp
g++ -std=c++11 -pedantic -g -O2 -Wall -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wdouble-promotion -Werror -Wextra -Wformat=2 -Winit-self -Wmissing-include-dirs -Wno-unused -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch-default -Wundef -o px_sched_example6 -pthread px_sched_example6.cpp
g++ -std=c++11 -pedantic -g -O2 -Wall -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wdouble-promotion -Werror -Wextra -Wformat=2 -Winit-self -Wmissing-include-dirs -Wno-unused -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch-default -Wundef -o px_sched_example7 -pthread px_sched_example7.cpp
Hope it helps other Linux users having the same problems π .
Test model: test_model.zip
For myself I just hardcoded
new_texture.info.magnification_filter = SamplerFiltering::Linear;
new_texture.info.minification_filter = SamplerFiltering::LinearMipmapLinear;
new_texture.info.wrapping[0] = SamplerWrapping::Repeat;
new_texture.info.wrapping[1] = SamplerWrapping::Repeat;
new_texture.info.wrapping[2] = SamplerWrapping::Repeat;
...and everything works. I have an assumption that the model has no legal samplers
So problem line is
Line 303 in 76a7033
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.