Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 21 Oct 2011
Offline Last Active Mar 27 2015 09:00 AM

#5219553 Direct3D 12 documentation is now public

Posted by tonemgub on 27 March 2015 - 03:34 AM

They probably won't "roundhouse kick" it, because it's still needed for backwards compatibility with older versions of D3D (including the lower Feature Levels in D3D12).


Debug/Release has nothing to do with this. They both support the Debug layer. The reference driver is probably also what they send to hardware manufacturers as example of driver implementations... The WARP driver is simply an implementation of the reference driver optimized to use SIMD/SSE, and I think it's used with Store apps when there is no hardware acceleration available.




In fact, MSDN has this to say:


Because WARP uses the same software interface to Direct3D as the reference rasterizer does, any Direct3D 10 or 10.1 application that can support running with the reference rasterizer can be tested by using WARP. To use WARP, rename D3d10warp.dll to D3d10ref.dll and place it in the same folder as the sample or application. Next, when you switch to ref, you will see WARP rendering.


But the only good reason they can't drop the reference rasterizer is probably ( smile.png ) because officially Microsoft only requires that SSE is supported by the CPU for 64-bit versions of Windows. The 32-bit Widnows can still be installed on machines without SSE (or even MMX?), and there the WARP driver cannot be used.


Of course, we can all just take a look at (and test) D3D12CreateDevice to see what it supports.

#5219244 Direct3D 12 documentation is now public

Posted by tonemgub on 26 March 2015 - 01:45 AM

Thank you!


EDIT, so this post is not completely useless: Let's see who draws the first triangle on D3D12. :)

#5218830 preventing system crash or power outage from wiping savegame: best methods

Posted by tonemgub on 24 March 2015 - 11:05 AM

the power could still go out during an unbuffered write...


If this is your concern, then you obviously need a way to check that your save files are not corrupted. A simple checksum would probably do. However, if this does happen, your backups aren't safe either, so there's no point in doing backups. Either you have a corrupt save and discard it, or you have a good one and use it.


Unbuffered output is useful if you want to display a "saving" indicator/progress bar, to let the user know when their game was properly saved directly to disk, so they don't Alt+F4 your game (or turn off their computers) during the save.

However, this is only useful if you save all your data in one shot (perhaps from a separate thread). If you do multiple writes&reads from the save files, for data used during gameplay, then you're better off using cached writes&reads to avoid disk trashing or slowing down your game while it's waiting for I/O.




looks like the thing to do is:
1. write to a new file each time.
2. unbuffered write MIGHT save your arse, and it might not.
3. when the game starts, assume the power went out last time, and any savegame type files you try to load might be corrupted.
4. due to assumption 3, all savegame type files should have some sort of crc check on loading.
5. if crc checks fail, perform automatic recovery (if possible).
6. how you want to futz around with filenames, copying, deleting, renaming, etc is up to you (.sav, .bak, save1.dat, save2.dat, etc).


Yes, except the last step. Like I said before, backups aren't helping, so you're just making your job harder impelmenting them either way. You should just save the game directly under the desired file name, and avoid any extra file operations. The more file operations you do, the more chances are that something will get corrupted in case of power loss.


EDIT: Sorry about the double-post. Not sure what happened there. smile.png

#5216803 ShaderResourceView sRGB format having no effect on sampler reads

Posted by tonemgub on 16 March 2015 - 02:48 AM

applying just the filter didn't change things, but applying both the format and filter did

Not a SharpDX user either, but it's obvious: the Filter specifies that the loaded image data is in SRGb format (to skip the conversion from linear), and the Format specifies the format of the DirectX texture. You obviously need both to have the same format for things to work as expected.

#5215597 x86 / x64 and the crazy conditional moves based on flags

Posted by tonemgub on 10 March 2015 - 01:21 AM

if(x != y){ cmp x,y
a = 24 movne a, 24


Are you sure you were reading about x86/x64? Because MOVNE is an ARM instruction...

#5214942 WinAPI - Raw input and mouse acceleration

Posted by tonemgub on 06 March 2015 - 07:00 AM

I read that once, but it doesn't say much about mixing the regular mouse input with raw input? In fact, I think it says you can still use the legacy mouse messages along WM_INPUT - you can tell raw input to allow legacy messages during device registration.


And I don't think that the Windows acceleration makes sense for anything other than just the UI elements, since (according to the article I linked to), the acceleration is relative to the screen resolution and DPI setting in Windows (not even the physical DPI), not the physical resolution of the mouse. I don't know why anyone would want to emulate this type of acceleration.

#5214920 WinAPI - Raw input and mouse acceleration

Posted by tonemgub on 06 March 2015 - 04:35 AM

The best way to do that is to just use the standard WM_MOUSE* messages when your GUI is active.


How would turning off acceleration help you implement your own acceleration? That makes no sense.


You can find the formula Windows uses for it's acceleration all over the internet. I found this: http://donewmouseaccel.blogspot.ro/2009/06/out-of-sync-and-upside-down-windows.html

#5214686 splash and menu screens

Posted by tonemgub on 05 March 2015 - 03:48 AM

The splash screen and the menu are what we call "game states". So you should look for tutorials about implementing game states. I found this after a quick search: http://lazyfoo.net/articles/article06/index.php .

#5214671 Directshow problem

Posted by tonemgub on 05 March 2015 - 02:06 AM

Just check the value of the HRESULT returned from RenderFile.


You shouldn't convert DirectShow's error results (which tell you why DirectShow failed) into your own error values (which tell you absolutely nothing), and then just ignore DirectShow's values.


All of the video files I am trying to load work fine in media player, so installed codecs shouldn't be an issue.


If you're on Windows Vista or newer, I believe Media Player now uses Media Foundation Transforms instead of DirectShow codecs.

#5212857 I would like to use a smartpointer's address as a ID value

Posted by tonemgub on 25 February 2015 - 01:00 AM

My 2 cents: this "pointer-ID" could be used for arbitrary code execution over the network, as long as someone knows the memory layout of your object - which isn't hard, considering all C+ objects and most other types of objects keep a pointer to the virtual methods table right at the start of the object. All they would have to do is send you another "pointer-ID" which points to valid memory that has the same layout. At the least they could start sending random IDs and manage to crash your server with an access violation.

#5212637 How were you learning programming at the age of 5?

Posted by tonemgub on 24 February 2015 - 12:53 AM

Watching cartoons and dreaming about becoming a robot. Good start to a programming career.

#5210933 Rendering text to the texture.

Posted by tonemgub on 16 February 2015 - 02:01 AM

I mean DirectX ID2D1Bitmap, it is possible?


ID2D1Bitmap is a Direct2D interface, and you can use it with ID2D1BitmapRenderTarget. Read up on this MSDN article to see what's possible to do between Direct2D, DirectWrite and GDI: https://msdn.microsoft.com/en-us/library/windows/desktop/ff729481%28v=vs.85%29.aspx

#5210265 Clip (mask out) child by parent bounds.

Posted by tonemgub on 12 February 2015 - 08:18 AM

If all you need are rounded corners, then you can generate the "masks" for those in the pixel shader, with a bit of math (by comparing the UV coordinates against the sin/cos of some corner-radius(es)). And if all your UI elements are rectangles with rounded corners, then you can also pass in the parent's width, height and corner-radius(es) for each child, and use that same math to clip the child (either discard the pixel, or multiply it's alpha value with the parent's alpha value resulting from the math). This way, you can still use quads.


If you want a more general algorithm for clipping arbitrary geometry (child elements) against other arbitrary geometry (parent elements), you can represent each element as an array of rectangles, similar to how "region" objects are represented in Win32 GDI. In fact, you could use the Region Functions to generate regions for the shapes you want, clip them against the parents' region, then send all the rectangles returned by GetRegionData to the pipeline. However, if you want to use textures for your UI elements, you'd have to add the UV coordinates to all those rectangles - that might not be hard to do, but if you ask me, it's whole lot easier to work with UV coordinates when you have everything laid out as single quads, and use masking, than to generate geometry of the exact shape you want. There might be libraries out there that can do 2D geometry (polygon) intersections for you, but I don't know of any.


EDIT: On second thought, the region functions are a bad idea, because they probably wouldn't look very good when scaled or rotated, unless you used a really high resolution for them, which would probably mean that GetRegionData would return a whole lot of rectangles, which would probably slow down other parts of your UI-processing. You should use masking.

#5210253 Clip (mask out) child by parent bounds.

Posted by tonemgub on 12 February 2015 - 06:44 AM

I can't use separate mask for every element of my gui.

What CAN you do then? :)

#5209988 Clip (mask out) child by parent bounds.

Posted by tonemgub on 11 February 2015 - 05:07 AM

IMO, it's better to do the clipping on the CPU, by adjusting the vertices and their texture coordinates accordingly. You could do this when filling/updating the vertex buffer.


Do you have to clip the child quads against their rotated parent? You'll probably need stenciling for this.