Download

C++ API docs: missing or hidden pages

I’ve been finding myself having to frequent the C++ header files for how to use various components of UE4’s API, because the documentation on the website is either vague or nonexistent. For example, I was reading the article on GeneratedMeshComponent, and I came across a constant called BUF_Static. I figured I’d look it up in the documentation for Runtime/RHI. It wasn’t in the listing. A Google search turned up a result on a page from the documentation on that site under Runtime/RHI for EBufferUsageFlags. I took a look at it and there’s no info on it, just the enum’s code itself. I then turn to the UnrealEngine Github source where in Runtime/RHI/RHIDefinitions.h I found that enum with comments describing what each flag does, which I’ll paste the snippet below:


/**
 *	Resource usage flags - for vertex and index buffers.
 */
enum EBufferUsageFlags
{
	// Mutually exclusive write-frequency flags
	BUF_Static            = 0x0001, // The buffer will be written to once.
	BUF_Dynamic           = 0x0002, // The buffer will be written to occasionally.
	BUF_Volatile          = 0x0004, // The buffer will be written to frequently.

	// Mutually exclusive bind flags.
	BUF_UnorderedAccess   = 0x0008, // Allows an unordered access view to be created for the buffer.

	/** Create a byte address buffer, which is basically a structured buffer with a uint32 type. */
	BUF_ByteAddressBuffer = 0x0020,
	/** Create a structured buffer with an atomic UAV counter. */
	BUF_UAVCounter        = 0x0040,
	/** Create a buffer that can be bound as a stream output target. */
	BUF_StreamOutput      = 0x0080,
	/** Create a buffer which contains the arguments used by DispatchIndirect or DrawIndirect. */
	BUF_DrawIndirect      = 0x0100,
	/** 
	 * Create a buffer that can be bound as a shader resource. 
	 * This is only needed for buffer types which wouldn't ordinarily be used as a shader resource, like a vertex buffer.
	 */
	BUF_ShaderResource    = 0x0200,

	/**
	 * Request that this buffer is directly CPU accessible
	 * (@todo josh: this is probably temporary and will go away in a few months)
	 */
	BUF_KeepCPUAccessible = 0x0400,

	/**
	 * Provide information that this buffer will contain only one vertex, which should be delivered to every primitive drawn.
	 * This is necessary for OpenGL implementations, which need to handle this case very differently (and can't handle GL_HALF_FLOAT in such vertices at all).
	 */
	BUF_ZeroStride        = 0x0800,

	/** Buffer should go in fast vram (hint only) */
	BUF_FastVRAM          = 0x1000,

	// Helper bit-masks
	BUF_AnyDynamic      = (BUF_Dynamic|BUF_Volatile),
};

So, in conclusion, documentation pages for certain API components are hidden and require a Google search to find. Also comments from the header files and possibly source code should make it into the documentation when there is no documentation.