Sign in to follow this  
ArcticHammer

[SlimDX] Flexible Vertex Format (FVF) usage with nVidia and Intel?

Recommended Posts

Hi everyone,

We are successfully using compact vertex structure for Ati(AMD) Radeon GPUs, they work in all models about 5 years old or newer. We want to minimize the data amount to be written to the GPU for maximizing the performance, we are rendering 2D graphics with D3D9. The same vertex structure type doesn't work with any nVidia or Intel GPU in our app.

We can successfully use the following struct for Ati(AMD):

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]internal[/color][/size][/color][/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]struct[/color][/size][/color][/size] [size="2"][color="#2b91af"][size="2"][color="#2b91af"]CompactVertex[/color][/size][/color][/size]
[size="2"]{[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]float[/color][/size][/color][/size][size="2"] X;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]float[/color][/size][/color][/size][size="2"] Y;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]int[/color][/size][/color][/size][size="2"] Color;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]static[/color][/size][/color][/size] [size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexFormat[/color][/size][/color][/size][size="2"] Format = [/size][size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexFormat[/color][/size][/color][/size][size="2"].None;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]const[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]int[/color][/size][/color][/size][size="2"] StrideSize = 12;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]static[/color][/size][/color][/size] [size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexElement[/color][/size][/color][/size][size="2"][] VertexElements = [/size]
[size="2"]{[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]new[/color][/size][/color][/size] [size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexElement[/color][/size][/color][/size][size="2"](0, 0, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationType[/color][/size][/color][/size][size="2"].Float2, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationMethod[/color][/size][/color][/size][size="2"].Default, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationUsage[/color][/size][/color][/size][size="2"].PositionTransformed,0),[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]new[/color][/size][/color][/size] [size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexElement[/color][/size][/color][/size][size="2"](0, 8, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationType[/color][/size][/color][/size][size="2"].Color, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationMethod[/color][/size][/color][/size][size="2"].Default, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationUsage[/color][/size][/color][/size][size="2"].Color, 0),[/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexElement[/color][/size][/color][/size][size="2"].VertexDeclarationEnd[/size]
[size="2"]};[/size]
[size="2"]}[/size]


And for nVidia and Intel, we have to use larger one:

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]internal[/color][/size][/color][/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]struct[/color][/size][/color][/size] [size="2"][color="#2b91af"][size="2"][color="#2b91af"]LargeVertex[/color][/size][/color][/size]
[size="2"]{[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]float[/color][/size][/color][/size][size="2"] X;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]float[/color][/size][/color][/size][size="2"] Y;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]float[/color][/size][/color][/size][size="2"] Z;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]float[/color][/size][/color][/size][size="2"] RHW;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]int[/color][/size][/color][/size][size="2"] Color;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]static[/color][/size][/color][/size] [size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexFormat[/color][/size][/color][/size][size="2"] Format = [/size][size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexFormat[/color][/size][/color][/size][size="2"].PositionRhw | [/size][size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexFormat[/color][/size][/color][/size][size="2"].Diffuse;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]const[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]int[/color][/size][/color][/size][size="2"] StrideSize = 20;[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]public[/color][/size][/color][/size] [size="2"][color="#0000ff"][size="2"][color="#0000ff"]static[/color][/size][/color][/size] [size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexElement[/color][/size][/color][/size][size="2"][] VertexElements = [/size]
[size="2"]{[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]new[/color][/size][/color][/size] [size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexElement[/color][/size][/color][/size][size="2"](0, 0, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationType[/color][/size][/color][/size][size="2"].Float4, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationMethod[/color][/size][/color][/size][size="2"].Default, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationUsage[/color][/size][/color][/size][size="2"].PositionTransformed,0),[/size]

[size="2"][color="#0000ff"][size="2"][color="#0000ff"]new[/color][/size][/color][/size] [size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexElement[/color][/size][/color][/size][size="2"](0, 16, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationType[/color][/size][/color][/size][size="2"].Color, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationMethod[/color][/size][/color][/size][size="2"].Default, [/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]DeclarationUsage[/color][/size][/color][/size][size="2"].Color, 0),[/size]

[size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexElement[/color][/size][/color][/size][size="2"].VertexDeclarationEnd[/size]
[size="2"]};[/size]
[size="2"]}[/size]

[size="2"]We have tried to detect the compatible type by investigating [/size]
[size="2"][size="2"]bool compactSupported = (caps.FVFCaps & [/size][size="2"][color="#2b91af"][size="2"][color="#2b91af"]VertexFormatCaps[/color][/size][/color][/size][size="2"].DoNotStripElements) == 0;[/size][/size]


[size="2"][size="2"]Ati/AMD has flag value set to 0, Intel and nVidia 1. [/size][/size]

and also tried to force the compact format into use in nVidia and Intel, but they fail to render it.

[size="2"]It's very difficult for me to believe that nVidia wouldn't support this kind of compact vertex type. [/size]

[size="2"]So, can you say what are we doing wrong, and how to get a compact vertex type (x,y,color) working with nVidia? [/size]

[size="2"]Thanks for any help... [/size]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this