Home > 计算机与 Internet > ABOUT RESOURCE BINDING

ABOUT RESOURCE BINDING

"I try to define manually a texture buffer, and I can’t figure out how it works (no sample since the skinning10 sample uses effects, and very few documentations):

In the API,

  1. How a texture buffer is defined? As a texture or as a buffer resource? (the name suggests a texture resource …)
  2. With what binding flag?
  3. If the texture buffer is defined as a texture, how this ressource can be bound to a constant buffer slot with *SetConstantBuffers since an ID3D10Texture*D cannot be casted to an ID3D10Buffer.
  4. If the texture buffer is defined as a buffer, what is the difference between a cbuffer and a tbuffer.

In a HLSL code,

  1. is there a way to tell to the FX compiler that a cbuffer/tbuffer can be found in a peculiar constant buffer slot?
  2. the skinning10 fx sample says: "tbuffers are special constant buffers that are accessed like textures".  But no Load or Sample instructions are used in that case. So what does it mean? That the internal job is done with Load-like functions?

Thanks for your help."

"

API:

1.      The data are stored in a buffer resource

2.      The binding flag need to include “D3D10_BIND_SHADER_RESOURCE”

3.      You don’t bind it to a constant buffer slot. Texture buffers are bound to the shader resource slots (XSSetShaderResources). Therefore you need to create a shader resource view for the buffer.

4.      The difference is the way that the GPU access the data. This could have an impact on the performance. You should take a look at the developer guidelines from the different IHVs as soon as they are available.

HLSL:

1.      Sure. As always you can define a register:
tbuffer T1 : register(t#)
cbuffer C1 : register(b#)

2.      The shader compiler will insert the necessary instructions. You can see this in the disassembled shader.

"

Advertisements
Categories: 计算机与 Internet
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: