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 995085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:40:03+00:00 2026-05-16T06:40:03+00:00

Does someone know a fast way to invoke shader processing via DirectX? Right now

  • 0

Does someone know a fast way to invoke shader processing via DirectX?

Right now I’m setting shaders using D3DXCreateEffectFromFile calls, which create shaders in runtime (once per each shader) from *.fx files.

Rendering part for every object (every patch in my case – see further) then means something like:

// --------------------
// Preprocessing
effect->Begin();
effect->BeginPass(0);
effect->SetMatrix (or Vector or whatever - internal shader parameters) (...)
effect->CommitChanges();

// --------------------
// Geometry rendering

// Pass the geometry to render
// ...

// --------------------
// Postprocessing

// End 'effect' passes
effect->EndPass();
effect->End();

This is okay, but the profiler shows weird things – preprocessing (see code) takes about 60% of time (I’m rendering terrain object of 256 patches where every patch contains about 10k vertices).

Actual geometry rendering takes ~35% and postprocessing – 5% of total rendering time.

This seems pretty strange to me and I guess that D3DXEffect interface may not be the best solution for this sort of things.

I’ve got 2 questions:

1. Do I need to implement my own shader controller / wrapper (probably, low-level) and where should I start from?

2. Would compiling shaders help to somehow improve parameter setting performance?

Maybe somebody knows how to solve this kind of problem / some implemented shader interface or could give some advices about how is this kind of problem solved in modern game engines.

Thank you.

  • 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-05-16T06:40:04+00:00Added an answer on May 16, 2026 at 6:40 am

    Actual geometry rendering takes ~35% and postprocessing – 5% of total rendering time

    If you want to profile shader performance you need to use NVPerfHud or something similar. Using CPU profiler and measuring ticks is not going to help you – rendering is often asynchronous.

    Do I need to implement my own shader controller / wrapper (probably, low-level)

    Using your own shader wrapper isn’t a bad idea – I never liked ID3DXEffect anyway.
    With your own wrapper you’ll have a total control of resources and program behavior.
    Whether you need it or not is for you to decide. With ID3DXEffect you won’t have a warranty that implementation is as fast as it could be – it could be wasting cpu cycles doing something you don’t really need. D3DX library contains few classes that are useful, but aren’t guaranteed to be efficient (ID3DXEffect, ID3DXMesh, All animation-related and skin-related functions, etc).

    and where should I start from?

    D3DXAssembleShader, IDirect3DDevice9::CreateVertexShader, IDirect3DDevice9::CreatePixelShader on DirectX 9, D3D10CompileShader on DirectX 10. Also download DirectX SDK and read shader documentation/tutorials.

    Would compiling shaders help to somehow improve parameter setting performance?

    Shaders are automatically compiled when you load them. You could compiling try with different optimization settings, but don’t expect miracles.

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

Sidebar

Ask A Question

Stats

  • Questions 498k
  • Answers 498k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Provide a list with image URL's in the dropdown and… May 16, 2026 at 12:09 pm
  • Editorial Team
    Editorial Team added an answer Since the accepted answer doesn't address the situation fully, here's… May 16, 2026 at 12:09 pm
  • Editorial Team
    Editorial Team added an answer In method declaration you can't use string literals for parameter… May 16, 2026 at 12:09 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Is there a way to just have something show? I know there's the effect
I'm currently writing a C# application that does a lot of digital signal processing,
Does someone knows how to calculate the total hours between 2 times? For example
The idea is that a game might need something fast but also simplistic. Mainly
I am thinking of using a PHP framework called CodeIgniter . One of the
OK, I know that this has been asked previously, so please forgive me for
I have a database where I need to query to get records from one
I have a table that looks like this: Col1 Col2 Col3 Col4 a b
I will start by saying that I don't think what I want can be
I have a web service that is on an internal server. It can be

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.