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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:24:44+00:00 2026-05-22T02:24:44+00:00

I’ve got two questions really. The first is more a description of events: software

  • 0

I’ve got two questions really.

The first is more a description of events: software uses DirectX 9 and compiles shaders at start-up from resources. The shaders compile fine with both debug and release versions when you run the software from within the IDE, but when you double-click it to run it stand-alone, you start getting lots of weird errors from D3DXCompileShader.

I have put this down to the possibility that Visual Studio has converted the shader text files to Unicode and that this is throwing D3DXCompileShader somehow. Why they compile and run ok when I’m within the IDE but not outside of it is a mystery (note, it still fails if you launch it outside of VS and then attach the debugger to the process). Anyone have any thoughts on this?

My second question relates to attempts to fix the above. Instead of having my own resource data type called SHADER, I’ve imported a shader as RCDATA, so instead of manually loading the shader text from the resource myself, I’m now able to use D3DXCompileShaderFromResource. I’m getting a bad HRESULT from my call to this however, but the `errors’ collection remains empty. There is no debug output from it at all. The code looks like this:

HRESULT result;

result = D3DXCompileShaderFromResource( 0, 
                                        MAKEINTRESOURCE(IDR_SHADERPHONG),
                                        NULL, 
                                        NULL, 
                                        "VERTEXMAIN",
                                        D3DXGetVertexShaderProfile(Window()->GetDevice()),
                                        D3DXSHADER_OPTIMIZATION_LEVEL3,
                                        &MyVertexShaderBuffer,
                                        &errors,
                                        &MyVertexShaderConstants);

The HRESULT is -2005529767, which seems to be “failed”. I can find no references on the interwebs to what it can mean in relation to D3DXCompileShaderFromResource!

I’m hoping my clever friends at stackoverflow can offer some assistance here :p. Thanks.


  • 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-22T02:24:45+00:00Added an answer on May 22, 2026 at 2:24 am

    OK, the problem was found (by a colleague). When loading my resource I was grabbing a memory block and incorrectly converting it to std::string. That is, std::string will go through the resource looking for a null terminator, but the resource data won’t necessarily have one (it’s just a text file). It will eventually find one, however, probably in some part of memory the software isn’t supposed to be using!

    So, to convert a char buffer from a resource into a std::string, the following should be used:

    return std::string(reinterpret_cast<char const*>(pD), bytes);
    

    not this:

    return std::string(pD);
    

    , unless of course you know for sure that pD points to a null-terminated string.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
i got an object with contents of html markup in it, for example: string
I'm making a simple page using Google Maps API 3. My first. One marker
I have just tried to save a simple *.rtf file with some websites and

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.