sunnlok
Topic Author
Posts: 30
Joined: 04 Jul 2017, 17:45

Problems with buffers

31 Mar 2020, 03:18

I have been working on a Noesis integration for cryengine for a bit now with the new 3.0 beta release.(https://github.com/sunnlok/CryNoesis)
I have got the shader converted and loading in all different variants as well as the input and constant buffers updating.
I am still facing a few problems.

1:
I am not really sure how all the vertex and input mappings are supposed to work in regards to offsets. The techniques used in the dx11 sample seem a bit... arbitrary to me and i have some difficulty adapting them. It works fine for simple xamls though if it only draws 1-2 batches. Havent tested more.

2:
The values for the projection matrix are weird. The copy properly to the gpu, i have checked with renderdoc, but the values themselves seem wrong and project a simple square beyond all measure. Not sure if i need to set up something differently here.

3:
The actual vertices submitted in the batches seem wrong, for the hello world xaml i am only getting the background, with correct color, and a cross shape with 24 vertices.
I hope you guys can help me out!

This is what i get for the hello world sample
Image
 
User avatar
jsantos
Site Admin
Posts: 2802
Joined: 20 Jan 2012, 17:18
Contact:

Re: Problems with buffers

31 Mar 2020, 16:10

I think you should take the D3D11RenderDevice implementation (that one or the Metal one are the easiest to follow) and just clone its behavior in your implementation. Then with a simple XAML and using renderdoc just analyze the differences between your sample and XamlPlayer.

The function D3D11RenderDevice::CreateShaders() contains all the combinations of shaders and input layout that Noesis needs. Not sure if I can give you a better answer that just following that reference code.
 
sunnlok
Topic Author
Posts: 30
Joined: 04 Jul 2017, 17:45

Re: Problems with buffers

31 Mar 2020, 16:40

That is basically what i did. Buffers and shaders are all correct, the stuff coming out of the batches isnt.
I also cant just 1 to 1 copy the code in the sample implementation since thats not how the engine works.
The reason i am asking here is because i have already been through all the available code in the sample implementation. Otherwise i wouldnt ask.
 
User avatar
jsantos
Site Admin
Posts: 2802
Joined: 20 Jan 2012, 17:18
Contact:

Re: Problems with buffers

31 Mar 2020, 16:53

That is basically what i did. Buffers and shaders are all correct, the stuff coming out of the batches isnt.
Sorry, It was not my intention to sound mean. I am not sure how content from the batches can be different when rendering in XamlPlayer vs rendering with CryEngine, being the same Noesis library generating those batches. For example, that projectionMatrix you are displaying seems correct to me. Why do you think the values are weird?
 
sunnlok
Topic Author
Posts: 30
Joined: 04 Jul 2017, 17:45

Re: Problems with buffers

31 Mar 2020, 17:21

I didnt mean any disrespect either! I am just a bit frustrated at this point...
The reason i think the output is wrong, is because the vertex shader produces this.
Image
The disassembly seems correct to me as well.

The other issue why i think that the batch output is wrong is that it outputs that 24 index cross from the first picture, and not any other draw instructions regarding text or glyphs.
The first draw call seems to be the background, since it at least has the correct color.

I am currently trying with 2 simple rectangles but thats a bit tricky since it only renders for one tick, so capturing the frame hasnt been to easy.

Edit:
This is what i am getting from the batch:
Image

And this is what a projection matrix usually looks like in xaml player:
Image

Edit 2:
Ok the vertex input was a cross because i was updating with the frame delta, not time since application start :D
That seemed a bit... weird
The matrix is still wrong though.
 
User avatar
jsantos
Site Admin
Posts: 2802
Joined: 20 Jan 2012, 17:18
Contact:

Re: Problems with buffers

31 Mar 2020, 19:30

This is using the same XAML for both renderers right? In that case the batches cannot be different. The projection matrix maybe different because probably you are not rendering to exactly the same resolution. Are you doing a SetSize to the view?
 
sunnlok
Topic Author
Posts: 30
Joined: 04 Jul 2017, 17:45

Re: Problems with buffers

31 Mar 2020, 19:45

You were right, it was in fact not the Matrix :D

had to change
o.position = mul(float4(i.position, 0, 1), projectionMtx);
to
o.position = mul(projectionMtx, float4(i.position.xy, 0, 1));
On to the next problem!
 
sunnlok
Topic Author
Posts: 30
Joined: 04 Jul 2017, 17:45

Re: Problems with buffers

31 Mar 2020, 20:23

Probably still interpreting the vertex offsets incorrectly.

At least thats what this lookes like

https://i.imgur.com/tu4JsBp.mp4

Also i assume i am not allowed to distribute the shader on github?
 
User avatar
jsantos
Site Admin
Posts: 2802
Joined: 20 Jan 2012, 17:18
Contact:

Re: Problems with buffers

01 Apr 2020, 01:13

Also i assume i am not allowed to distribute the shader on github?
Yes, don't worry about the shader. It is part of NoesisApp and it is opensourced.
 
sunnlok
Topic Author
Posts: 30
Joined: 04 Jul 2017, 17:45

Re: Problems with buffers

01 Apr 2020, 16:24

Thats nice to hear!

Still got more questions though :D

is batch.vertexOffset the offset in bytes or the offset in strides of that batches layout?

Who is online

Users browsing this forum: No registered users and 9 guests