Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Jun 2008
Offline Last Active Jul 19 2016 02:44 PM

Posts I've Made

In Topic: D3D11 - Bitmap Font Rendering

19 July 2016 - 02:47 PM

I completely did not understand clashie... :) Are you able to change the text during runtime efficiently?


Yes, my font is just packed into a texture. I wrote a tool that generates bitmap fonts and it also creates the glyph data I need alongside the actual texture.


So when I pass a character, it's indexes to an array with information for drawing it so I have the character's bounds, texture coordinates and whatever else I needed.

In Topic: D3D11 - Bitmap Font Rendering

18 July 2016 - 01:13 PM

I just do the naive thing with 2D and it seems quite fast. Even on older hardware I could throw tens of thousands of them around like it was nothing.


I pre-fill a static 16 bit index buffer and create a dynamic vertex buffer for my sprites. I create the sprite geometry each frame and do some basic sorting and batching. It's pretty easy to batch large amounts of the sprites into a single draw call. Buffers for it are created once up front and destroyed only at the end.


Since the index buffer was 16 bit, I capped the number of sprites at 10922 per draw call.


(10922 * 4) * sizeof(Vertex2D)... which was 32. So 1398016 bytes for the vertex buffer. About 1.4mb.

In Topic: Vulkan is Next-Gen OpenGL

22 February 2016 - 10:02 AM

I installed the AMD vulkan drivers after they were released, along with the SDK, after finishing the installation I started up a game on my computer and it gave an error, as expected because AMD vulkan drivers don't support other APIs. Just to make sure everything was ok, I uninstalled the drivers and the games worked normally. I reinstalled the drivers and made a test project​ to see if I could make it work. All the program did was create an instance then destroy it. But after compiling it, vkCreateInstance returned VK_ERROR_IMCOMPATIBLE_DRIVER. I uninstalled and reinstalled the drivers several times, also when I ran vulkaninfo I got: "WARNING: [loader] Code 0 : Using deprecated ICD interface of vkGetInstanceProcAddr instead of vk_icdGetInstanceProcAddr
ERROR: [loader] Code 0 : ICD ignored: failed to CreateInstance and find entrypoints with ICD"


Are the AMD drivers just broken or is It me, btw my card is a Radeon HD 7850M


The drivers at release were indeed broken. It's since been fixed, so redownload them.

In Topic: Vulkan is Next-Gen OpenGL

16 February 2016 - 10:26 PM

So I've installed the AMD beta drivers (made sure to tick off the "VulkanRT" option), yet I can't run the samples?  Complains about a missing ICD...


I've got an R9 390 so I know it's not a hardware issue.


You and me both. And what looks like others, according to google.


AMD goof?

In Topic: Rendering a GUI efficiently

13 July 2013 - 03:06 AM

I dunno if it's optimal how I have my stuff set up, but I have a simple sprite batching class that I use to draw quads with. I don't really do anything special at all.


SpriteBatch manages the state, etc. It's really dead simple and really doesn't do that much work internally. Just tracking a few things, starting a new batch, finally issuing the draw call, etc. I pre-fill the index buffer and cap how large batches can get. Adding a sprite to the batch just needs a Rect for the position and another for the texture coordinates.


A batch is a simple struct like this

struct Batch
	Vertex2D*	verts;
	Texture*	texture;
	u32		numSprites;
	u32		numVerts;
	u32		numIndicies;

Then keep a vector of them. Batches hang around until you explicitly purge them, so once you add a bunch of quads, you don't need to re-add them and the only thing that needs to happen is the draw call (and prior memcpy() to push whatever batch verts to the underlying vertex buffer).


It's not fancy or super robust, but I don't see why I couldn't draw an entire UI with just one or two draw calls. Drawing thousands of textured quads costs practically nothing, and my framerate is still well into the thousands. What's GWEN doing that's taking so long?