Jump to content

  • Log In with Google      Sign In   
  • Create Account


Yang G

Member Since 05 Jan 2011
Offline Last Active Aug 01 2013 04:52 AM

Posts I've Made

In Topic: How does delete[] know how many bytes to release?

14 December 2011 - 03:36 AM

In fact, while you new or malloc a range of memory, there is a header block who will record these information used to release the memory.

In Topic: question about oD0 in vertex shader

05 December 2011 - 08:18 PM

If you're manually outputting depth from a pixel shader, then you just output a [0.0, 1.0] floating point value. It will then converted to whatever format is being used by the depth buffer, which is typically either 24-bit fixed point integer or 32-bit floating point.

while generating the shadow texture, I move the depth value to oD0, what i know is the clr will be clamp to [0.0, 1.0] in each component of oD0, but i'm not clear about how many bits to store the value.In the pixel shader, I use tex to retrieve the value in shadow texture,
what i have done has nothing to do with the depth buffer.while rendering the scene, i store the depth in oD1 in vertex shader, then get it from v1 in pixel shader.

Here are something i guess, but not sure.
the r# register is 128 bits with each component 32 bits.
the c# register is 128 bits with each component 32 bits.
the oD# register is 32 bits with each component 8 bits.

Are these correct ?





In Topic: question about oD0 in vertex shader

05 December 2011 - 07:34 AM

It's just like what you said, but i'm confused that how many bits oD0's each component has.
Thanks for your answer

In Topic: Erasing an element in a vector

28 May 2011 - 04:37 AM


i think you'd better take a look at erase-remove idiom about vector.it's a efficient way to remove element in vector


erase-remove of a std::vector uses the swap and pop method, correct?

it's like that
template < class ForwardIterator, class T >  
ForwardIterator remove ( ForwardIterator first, ForwardIterator last, const T& value )
{ 
	 ForwardIterator result = first; 
	 for ( ; first != last; ++first)   
		 if (!(*first == value)) 
			*result++ = *first;
	 return result;
}
(from c++ library).
Note:
remove doesn't delete the element in the vector instead of overwriting the element like the code said.
so we must use erase to delete these elements who should be removed like that vec.erase(remove(first, end, value), end).
you can see these subjects in book named Effective STL

In Topic: Erasing an element in a vector

26 May 2011 - 09:39 PM

i think you'd better take a look at erase-remove idiom about vector.it's a efficient way to remove element in vector

PARTNERS