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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:46:57+00:00 2026-06-10T11:46:57+00:00

Let’s say that i’ve got a model. This model has data for position, color,

  • 0

Let’s say that i’ve got a model. This model has data for position, color, normals, and 2 texture coords. Now let’s say i have a shader who’s input type is position and color only. However, this model’s vertex buffer is in the format of:

struct Vertex_PCNT2
{
    D3DXVECTOR3 position;
    D3DXVECTOR4 color;
    D3DXVECTOR3 normal;
    D3DXVECTOR2 tex1;
    D3DXVECTOR2 tex2;
};

Despite the fact that this model has the information in it for the shader that takes position and color, i can’t use it because there is superfluous data. The only other solution i can think of is to have multiple vertex buffers with the same information minus a couple fields, but that’s just plain redundant. There seriously has to be a better way. Any help here?

edit: Figured i’d elaborate my question a little with some time before work. When talking about the vertex buffer i mean the ID3D11Buffer * which you create with ID3D11Device::CreateBuffer . Before hand i fill an array of vertices wiht type Vertex_PCNT2 up there. From what i can tell at this point, that buffer is now permanently in this format so all shaders would have to work with this format. Setting up other buffers would just be a strain on ram when the data already exists.

  • 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-10T11:46:58+00:00Added an answer on June 10, 2026 at 11:46 am

    Usually, this is done by creating different InputLayout for the same vertex buffer. Remember that the InputLayout can act as a filtered view between vertex input data and the expected input of vertex shader.

    The InputLayout is exactly done for this kind of scenario. It is basically decoupling the layout of the original data and the layout of the binding to the vertex shader input.

    For example, if you only need to map position and color, you just have to instantiate an input layout with an array of two D3D11_INPUT_ELEMENT_DESC elements with the correct AlignedByteOffset set.

    In the case of selecting only “POSITION” (offset 0) and “COLOR” (offset in bytes: 12):

    D3D11_INPUT_ELEMENT_DESC layout[] =
    {
    { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT,    0, 0,  D3D11_INPUT_PER_VERTEX_DATA, 0 },
    { "COLOR"   , 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    }; 
    

    but you could also select just “POSITION” (offset 0) and “NORMAL” (offset 28):

    D3D11_INPUT_ELEMENT_DESC layout[] =
    {
    { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT,    0, 0,  D3D11_INPUT_PER_VERTEX_DATA, 0 },
    { "NORMAL"  , 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 28, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    }; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say that I have a set of relations that looks like this: relations
Let's say that we have an ARGB color: Color argb = Color.FromARGB(127, 69, 12,
Let's say I've got a collection of 10 million documents that look something like
Let's say I've got n properties (pairs key-value) that are either dates, numbers or
Let me explain best with an example. Say you have node class that can
Let's say I have a table with a Color column. Color can have various
Let's say that I have a SQLite database that I create in a separate
Let's say I have a sortable list like this: $(.song-list).sortable({ handle : '.pos_handle', axis
Let's say I have a string like this: var str = /abcd/efgh/ijkl/xxx-1/xxx-2; How do
Let's say on a page I have alot of this repeated: <div class=entry> <h4>Magic:</h4>

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.