Only use D3DLOCK_DISCARD if dynamic memory (was Re: d3dx9: CloneMesh test and improvements)

2011-08-19 Thread Michael Mc Donnell
On Fri, Aug 19, 2011 at 2:20 PM, Stefan Dösinger wrote: > Am 19.08.2011 um 14:04 schrieb Michael Mc Donnell: >> Ok I see that in dlls/d3d9/tests/buffers.c. So it will fail to lock on >> Win7 if D3DLOCK_DISCARD is specified and the vertex buffer wasn't >> created with D3DUSAGE_DYNAMIC? > Yes, unles

Re: d3dx9: CloneMesh test and improvements

2011-08-19 Thread Stefan Dösinger
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 19.08.2011 um 14:04 schrieb Michael Mc Donnell: > Ok I see that in dlls/d3d9/tests/buffers.c. So it will fail to lock on > Win7 if D3DLOCK_DISCARD is specified and the vertex buffer wasn't > created with D3DUSAGE_DYNAMIC? Yes, unless Microsoft chan

Re: d3dx9: CloneMesh test and improvements

2011-08-19 Thread Michael Mc Donnell
On Thu, Aug 18, 2011 at 8:05 PM, Stefan Dösinger wrote: > Hi, > > I noticed one small issue: > On Saturday 13 August 2011 12:22:03 Michael Mc Donnell wrote: >> +static HRESULT convert_vertex_buffer(ID3DXMesh *mesh_dst, ID3DXMesh > *mesh_src) >> ... >> +    hr = mesh_dst->lpVtbl->LockVertexBuffer(m

Re: d3dx9: CloneMesh test and improvements

2011-08-18 Thread Stefan Dösinger
Hi, I noticed one small issue: On Saturday 13 August 2011 12:22:03 Michael Mc Donnell wrote: > +static HRESULT convert_vertex_buffer(ID3DXMesh *mesh_dst, ID3DXMesh *mesh_src) > ... > +hr = mesh_dst->lpVtbl->LockVertexBuffer(mesh_dst, D3DLOCK_DISCARD, (void**)&vb_dst); On paper, D3DLOCK_DISCA

Re: d3dx9: CloneMesh test and improvements

2011-08-12 Thread Henri Verbeet
On 12 August 2011 13:06, Octavian Voicu wrote: > As far as I know C99 is not allowed. However, you can emulate round by > doing: > floorf(val + 0.5f) It probably doesn't matter here, but note that that isn't the same as roundf() for values below zero.

Re: d3dx9: CloneMesh test and improvements

2011-08-12 Thread Matteo Bruni
2011/8/12 Octavian Voicu : > On Fri, Aug 12, 2011 at 12:59 PM, Michael Mc Donnell > wrote: >> >> Is it ok to use roundf and rintf? They're both C99 functions. > > Hello, > As far as I know C99 is not allowed. However, you can emulate round by > doing: > floorf(val + 0.5f) > According to [1] floorf

Re: d3dx9: CloneMesh test and improvements

2011-08-12 Thread Michael Mc Donnell
On Fri, Aug 12, 2011 at 1:06 PM, Octavian Voicu wrote: > On Fri, Aug 12, 2011 at 12:59 PM, Michael Mc Donnell > wrote: >> >> Is it ok to use roundf and rintf? They're both C99 functions. > > Hello, > As far as I know C99 is not allowed. However, you can emulate round by > doing: > floorf(val + 0.

Re: d3dx9: CloneMesh test and improvements

2011-08-12 Thread Octavian Voicu
On Fri, Aug 12, 2011 at 12:59 PM, Michael Mc Donnell wrote: > Is it ok to use roundf and rintf? They're both C99 functions. > Hello, As far as I know C99 is not allowed. However, you can emulate round by doing: floorf(val + 0.5f) According to [1] floorf is C99 (only floor is C89), but includin

Re: d3dx9: CloneMesh test and improvements

2011-08-12 Thread Michael Mc Donnell
On Thu, Aug 11, 2011 at 4:07 PM, Michael Mc Donnell wrote: > On Thu, Aug 11, 2011 at 3:01 PM, Matteo Bruni > wrote: >> 2011/8/11 Michael Mc Donnell : >>> >>> +            dst_ptr[0] = src->x < 0.0f ? (SHORT)ceilf(src->x * SHRT_MAX + >>> 0.5f) :(SHORT)floorf(src->x * SHRT_MAX + 0.5f); >> >> You

Re: d3dx9: CloneMesh test and improvements

2011-08-11 Thread Michael Mc Donnell
On Thu, Aug 11, 2011 at 3:01 PM, Matteo Bruni wrote: > 2011/8/11 Michael Mc Donnell : >> >> +            dst_ptr[0] = src->x < 0.0f ? (SHORT)ceilf(src->x * SHRT_MAX + >> 0.5f) :(SHORT)floorf(src->x * SHRT_MAX + 0.5f); > > You can use roundf() instead. Actually, notice that maybe what you > actual

Re: d3dx9: CloneMesh test and improvements

2011-08-11 Thread Matteo Bruni
2011/8/11 Michael Mc Donnell : > > +dst_ptr[0] = src->x < 0.0f ? (SHORT)ceilf(src->x * SHRT_MAX + > 0.5f) :(SHORT)floorf(src->x * SHRT_MAX + 0.5f); You can use roundf() instead. Actually, notice that maybe what you actually need for correct rounding is rintf() (which essentially match

Re: d3dx9: CloneMesh test and improvements

2011-08-09 Thread Matteo Bruni
2011/8/8 Michael Mc Donnell : > Hi > > I've been working on a test and improvements for CloneMesh as part of > GSoC 2011. I would be grateful if anyone could comment on my work. > There are five test cases in the attached patch: > >  0. Basic mesh cloning. Declaration has position and normal, and t

d3dx9: CloneMesh test and improvements

2011-08-08 Thread Michael Mc Donnell
Hi I've been working on a test and improvements for CloneMesh as part of GSoC 2011. I would be grateful if anyone could comment on my work. There are five test cases in the attached patch: 0. Basic mesh cloning. Declaration has position and normal, and the new declaration is the same as the ori