Jump to content

  • Log In with Google      Sign In   
  • Create Account

Laval B

Member Since 30 Jul 2010
Offline Last Active Today, 03:06 AM

Posts I've Made

In Topic: Vulkan Resources

28 April 2016 - 04:05 AM

https://software.intel.com/en-us/articles/api-without-secrets-introduction-to-vulkan-preface

https://software.intel.com/en-us/api-without-secrets-introduction-to-vulkan-part-1

https://software.intel.com/en-us/api-without-secrets-introduction-to-vulkan-part-2

https://software.intel.com/en-us/api-without-secrets-introduction-to-vulkan-part-3

 

I found these tutorials, they are nice to start with Vulkan. There is a pdf version with detailed explanations and sample code.


In Topic: Variable size strucs

12 October 2015 - 11:10 AM

 

Well, the main idea is that not every draw item will have a unique combination of shaders and textures, etc. By moving the shared data into a material you will save memory in your main draw queue, it's basically the flyweight pattern.

 

Also you will want to sort your render queue by some criteria which will probably include a material id. Since the number of materials will hopefully be much less than the actual number of draw calls you could use some "heavier" data structures like vectors for the varying length parameters like textures and constants.

 

 

You mean moving the shaders, the shader parameters and the textures to a material class that could be shared among multiple DrawItems ? Yes it could be done. But what i'm trying to do (and this is only experimentation) is to pack all the data for a draw call into contiguous memory to see if there is something to be gained by being more "cache efficient". Packing arrays is what is actually difficult.

 

Elements of a draw item are of course shared across models.


In Topic: Variable size strucs

12 October 2015 - 10:08 AM

Yeah, that works too. The less code that has to know about how to specially construct these and what not to do with them the better. smile.png

 

Yes it is very important in production code that is manipulated by many people not to allow such a data structures to be easily or accidentally accident missused. It must not be possible to construct a drawitem on the stack or in a conatiner that would construct an incomplete object.

 

Does every draw item really need to store information about shaders, number of textures, assigned textures, etc?

Wouldn't it be better to store an id to a "material" object which contains a pair of shaders and any textures/constants that need to be set for the material to work?

 

Yes indeed. But then, how do you define the "material" object ? This material object will need to have thoses fields anyway with the arrays.


In Topic: Variable size strucs

12 October 2015 - 07:21 AM

There's a reason every modern language has forbidden this kind of C-style tomfoolery: you will make more mistakes like this before your project is done! smile.png

When you think your code is finished, leave it for a month, then come back and audit it with a fine-toothed comb.

 

Of course i realize that. The thing is i'm not working on production code, i'm just experimenting during my spare time.


In Topic: Variable size strucs

11 October 2015 - 07:14 PM

 

arr1() + arr2Count

This is a bug (should be arr1Count to compute the end pointer of arr1); you are writing past the end of your allocation by 2 bytes!

 

Thank you, for some reason, i totally missed it wacko.png


PARTNERS