Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8700873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:16:07+00:00 2026-06-13T02:16:07+00:00

I want to make my code parallel, but have some questions for the experienced.

  • 0

I want to make my code parallel, but have some questions for the experienced.

1] Is it a good idea to do something like this?

#pragma omp parallel num_threads(2)
{
    const int threadID=omp_get_thread_num();
    if(threadID==0) while(WM_QUIT != msg.message){ // < Engine stuff
        if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }else{
            engine.omp_renderPrepare();
        }
    }
    if(threadID==1) while(WM_QUIT != msg.message){ // < Render stuff
        engine.omp_renderApply();
    }
}

// Functions from the engine class:
inline void omp_renderPrepare(){
    if(gDevice.omp_isReady()){
#pragma omp critical(renderPrepare)
        if(!omp_rendering){
            omp_sceneReady=0;
            renderPrepare();
            omp_sceneReady=1;
        }
    }else{
        Sleep(42); // If the device is not ready, dont spam.
    }
}
inline void omp_renderApply(){
    if(gDevice.omp_isReady()){
#pragma omp critical(omp_renderApply)
        if(omp_sceneReady){
            omp_rendering=1;
            renderApply();
            omp_rendering=0;
        }
    }else{
        Sleep(42); // If the device is not ready, dont spam.
    }
}

I already applied it, but it is heavy on the CPU & my code slows to a crawl when I resize the window, since it must:

  1. Set a bool “omp_deviceReady” to false so the rendering will stop.
  2. Wait for the parallel sections to stop.
  3. Resizing the graphics buffers.
  4. Set “omp_deviceReady” to true so rendering can happen again.
  5. Repeat as long as the user resizes the window.

2] Since my OMP code is heavy on the CPU [about 50% accord to task mgr], what is a good way to handle parallel rendering?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:16:09+00:00Added an answer on June 13, 2026 at 2:16 am

    “OMP isn’t too well suited for MT rendering (OMP would work better for parallel processing of game tasks)” – Necrolis

    “Deffered contexts is a good way to go, …” – catflier

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code that I want to make point-free; (\k t -> chr
I want to know when some parallel tasks are completed. I'm using this code
I don't want to make my code tight coupled to some JDBC driver (for
For some MATLAB code that I want to make executable, I need the location
i want to make a system call in my python code but the problem
How do I make code like this thread safe? public static class Converter {
I've tested this Curl code to download multiple pages simultaneously. But I want to
I want to make code that does this kind of task: check if a
I want to make code section wise like so in left side i can
I want to make a code snippet database web application. Would the best way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.