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

  • Home
  • SEARCH
  • 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 6596699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:06:36+00:00 2026-05-25T18:06:36+00:00

Good evening, I’m trying to send a XMFLOAT3X3 to a constant buffer (see code

  • 0

Good evening,

I’m trying to send a XMFLOAT3X3 to a constant buffer (see code below).

ZeroMemory(&constDesc, sizeof(constDesc));
constDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
constDesc.ByteWidth = sizeof(XMFLOAT3X3);
constDesc.Usage = D3D11_USAGE_DEFAULT;

result = m_pDevice->CreateBuffer(&constDesc,0,&m_pTexTransformCB);

if (FAILED(result)) {
    MessageBoxA(NULL,"Error creating constant buffer m_pTexTransformCB", "Error", MB_OK);
    return false;
}

But the compiler tells me that XMFLOAT3X3 is an invalid dimension for the constant buffer bytewidth:

D3D11: ERROR: ID3D11Device::CreateBuffer: The Dimensions are invalid. For ConstantBuffers, marked with the D3D11_BIND_CONSTANT_BUFFER BindFlag, the ByteWidth (value = 36) must be a multiple of 16 and be less than or equal to 65536. [ STATE_CREATION ERROR #66: CREATEBUFFER_INVALIDDIMENSIONS ]

However, I’m sort of new to HLSL, so I’m not sure if I set the bytewidth to 48, the float3x3 in the cbuffer of the shader will register properly. How should I handle this best?

If you need any more information, comment and I’ll edit the question. I hope it’s clear enough.

  • 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-25T18:06:37+00:00Added an answer on May 25, 2026 at 6:06 pm

    In your case, you can just change the ByteWidth to 48 and it will be fine. If you want to group more than one value together, you’re going to need to make sure that your data is aligned to 16 byte boundaries. To do this you can just add __declspec(align(16)) before defining your structures.

    __declspec(align(16))
    struct Data
    {
        XMFLOAT3X3 a;
    
        //other stuff here
    };
    

    This way you can use sizeof(Data) and be guaranteed that your ByteWidth will be valid. I apologize for giving you an incorrect answer earlier, you do not need to manually pad.

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

Sidebar

Related Questions

Good evening :-)! I have this code to use Drag & Drop method for
Good evening, I wrote the code below in C to read and print from
Good evening, In a test JSF 2.0 web app, I am trying to get
Good evening all, I'm trying to write a method that creates and returns a
Good evening, here is what I am trying to achieve, I currently have a
Good evening all, I'm trying to implement jquery table sorter, all seems fine and
Good evening, Following is the code I used for reading the files and folders
Good evening, people! I'm trying to solve a rather simple problem, but.. well, it
Good evening. This code works. It sorts an array of cards by both Suit
Good evening, I am having a weird issue with a method I am trying

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.