Comments (3)
I doubt you can create a VertexBufferBinding with a stride of 0. Doesn't make sense. Either you don't have any vertex buffer, so you should not set a binding and if you have one, you have necessarily a stride > 0
from sharpdx.
Sure, it's not valid. But it's possible to make the mistake as I did when I copied in some code from another project. And in that case, would it be better if an exception was thrown if stride <=0. I guess I'd like to see some better error detection there. Because with stride = 0, the program will run, not render the geometry, and prevent graphics diagnostics from catching data.
You guys know a lot more about the situation than I do, so if you think it's not a problem, no worries.
from sharpdx.
I see. Well, the original rule in SharpDX was to expose the native API almost as-is in order to get maximum performance and not to expose a sanitized native API. As you know, the native runtime - Direct3D11 for example - is already making lots of checks of parameters consistency and SharpDX rely almost exclusively on this. What is unfortunate in your case is that the native runtime is not checking this.
Should we provide such a check? Personally, I'm not really inclined for several reasons. We would have to go through all signatures, check if a parameter is already checked by the native runtime, if not we would have to add a check and throw an exception. In the case of the stride, the parameter to check is even an indirect parameter, as for the native API, the stride is stored in a int array.How much we would have to follow indirect references like this to check parameters? I would argue that the API to blame is Direct3D11 for not checking this one. Performance wise also, I wouldn't want the API to be bloated by checks that are most of the time irrelevant for regular usage.
Though there are some places in the code where we can perform this kind of checks, I agree that it is not always consistent, but again, I'm fine to make some sacrifice of safety over performance.
from sharpdx.
Related Issues (20)
- Unable to create instances on Windows 7 (up to date)
- Function mapping guideline question HOT 2
- Missing trigger detection on Nyko Playpad Pro
- how can i create SharpDX.Direct2D1.Factory4? HOT 2
- Add DXCompiler HOT 5
- Disable MSDN Documentation Provider HOT 1
- Unity IL2Cpp throw System.NotImplementedException HOT 2
- How to add customized ViewCube?
- CallbackBase.Release() - Null reference exception
- .NET Core Support
- AudioProcessorBase.LockForProcess method is not virtual
- DirectInput.GetDevices(DeviceType deviceType, DeviceEnumerationFlags deviceEnumFlags) takes very long time
- texture size is reported wrong HOT 3
- Question about returning unsigned long in Interfaces.cs
- One cannot pass NULL to MapSubresource for the parameter D3D11_MAPPED_SUBRESOURCE *pMappedResource HOT 2
- Bug in Mapping.xml file? HOT 1
- Question about memory
- Error in 4.2 version that not was in 4.0.1 version
- Matrix3x2.ScaleVector calculation is incorrect for rotated transforms
- New Managed DirectX bindings HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sharpdx.