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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:12:05+00:00 2026-06-12T21:12:05+00:00

I’m learning 3D and shaders and I’ve got a shader I’ve spent weeks creating.

  • 0

I’m learning 3D and shaders and I’ve got a shader I’ve spent weeks creating.

I have an issue with a single line in this shader – commenting one and replacing it with another will cause the effect to fail when IDirect3DDevice9::CreateVertexShader() is called. All the fields have been set, and this behaviour also occurs when I set all the boneTransforms and viewProj to identity matrices. As is I’ll see the model, and changing that one line (commented) will cause the vertex shader not to compile. Why does this happen? I have spent days debugging this and cannot find a reason!

static const int MAX_MATRICES = 100;
float4x3    boneTransforms[MAX_MATRICES] : WORLDMATRIXARRAY;
float4x4    ViewProj : VIEWPROJECTION;

struct VS_INPUT
{
    float3  Pos             : POSITION;
    float4  BlendWeights    : BLENDWEIGHT;
    float4  BlendIndices    : BLENDINDICES;
    float3  Normal          : NORMAL;
    float2  Tex0            : TEXCOORD0;
};

struct VS_OUTPUT
{
    float4  Pos      : POSITION;
    float2  Tex0     : TEXCOORD0;
    float4  Diffuse  : COLOR;
};

VS_OUTPUT VShade(VS_INPUT i)
{
    VS_OUTPUT   o;

    int4 blendIndicies = D3DCOLORtoUBYTE4(i.BlendIndices);

    float blendWeights[4] = (float[4])i.BlendWeights;
    int boneIndicies[4] = (int[4])blendIndicies;

    float3 pos = mul(i.Pos, boneTransforms[boneIndicies[0]]) * blendWeights[0]
                  + mul(i.Pos, boneTransforms[boneIndicies[1]]) * blendWeights[1]
                  + mul(i.Pos, boneTransforms[boneIndicies[2]]) * blendWeights[2]
                  + mul(i.Pos, boneTransforms[boneIndicies[3]]) * blendWeights[3];

    float4 aaa = mul(float4(pos.xyz, 1.0f), ViewProj);

    //////////////////////////////////////////////////////////////////////////////
    // If I comment out this SINGLE line
    o.Pos = mul(float4(i.Pos.xyz, 1.0f), ViewProj);
    // and replace it with this one, then IDirect3DDevice9::CreateVertexShader() returns D3DERR_INVALIDCALL
    // o.Pos = aaa;
    //////////////////////////////////////////////////////////////////////////////

    o.Diffuse = 1.0f;
    o.Tex0  = i.Tex0.xy;
    return o;
}

float4 PShade(VS_OUTPUT i) : COLOR
{
    return float4(1.0, 1.0, 1.0, 1.0);
}

technique technique0
{
    pass p0
    {
        //PixelShader = compile ps_2_0 PShade();
        VertexShader = compile vs_2_0 VShade();
    }
}

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-06-12T21:12:06+00:00Added an answer on June 12, 2026 at 9:12 pm

    You need to try to reduce MAX_MATRICES

    static const int MAX_MATRICES = 50;
    

    Otherwise you will go over the maximum constant buffer size.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a small JavaScript validation script that validates inputs based on Regex. I

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.