• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

173 Neutral

About MikeBMcL

  • Rank

Personal Information

  1. Try changing   if(FAILED(m_dxgiFactory->CreateSwapChainForHwnd( m_device, p_hWnd, &m_swapChainDesc, &m_swapChainFullscreenDesc, m_dxgiOutput, m_swapChain.ptr()))) throw "Failed to create DXGI swap chain";   to   HRESULT hr; hr = m_dxgiFactory->CreateSwapChainForHwnd( m_device, p_hWnd, &m_swapChainDesc, &m_swapChainFullscreenDesc, m_dxgiOutput, m_swapChain.ptr()); if (FAILED(hr)) { std::stringstream str; str << "Failed to create DXGI swap chain. HR: 0x" << std::hex << std::uppercase << static_cast<unsigned long>(hr) << std::endl; OutputDebugStringA(str.str().c_str()); throw str.str().c_str(); }   Note that you'll need to #include <string> <sstream> <ios> and <ostream>. Also, I'd generally recommend throwing C++ standard library-based exceptions rather than raw ASCII strings and working in Unicode (e.g. L"Something" rather than "Something") along with the corresponding wide character variants of the STL functionality (e.g. std::wstringstream) and Windows API calls (OutputDebugStringW). Once you have the HRESULT code from the swap chain failure, you'll potentially have much more information than just that the call failed. At a guess, what's probably going on based on the code you provided you are passing in for the HWND a parameter named "p_hWnd". If that's really a pointer to an HWND, you should be passing in "*p_hWnd" since the API call is expecting an HWND, not a pointer to one. Also, from the documentation - http://msdn.microsoft.com/en-us/library/hh768891(v=vs.85).aspx , you are calling m_dxgiFactory->IsWindowedStereoEnabled to check for stereo support but this just tells you whether or not you can render a windowed app in stereo. The proper check for a full screen app is to call IDXGIOutput1::GetDisplayModeList1 and see if any of the returned modes supports stereo. You are doing that anyway but your initial call to IsWindowedStereoEnabled is superfluous and might even improperly exclude stereo if the card didn't support windowed stereo with its current settings but would support full screen stereo.
  2. Try changing line 50 to: float dotProduct = abs(dot(lightDirection, normalize(normal)));
  3. You can, yes, though it's probably better to just use an include file for common structs and define the shader-specific buffers in each shader's HLSL file. Or are you planning to put all of the shaders into one file? (Note: By "you can" I mean that I tested compiling a vertex and pixel shader with two cbuffers both assigned to register(b0) where only one of those cbuffers is used and that I received no compile errors using the built-in shader compilation with VS 2012 and the Windows 8 SDK; you might have different results if you compile using an older version of fxc even though it should in theory work fine. It's not super hard to test so if you are using an older fxc, just try it and see what happens.).
  4. The only other forums I regularly use are the forums at [url="http://xboxforums.create.msdn.com/"]http://xboxforums.create.msdn.com/[/url] and they do not suffer from this issue. Also, if I switch IE to compatibility mode then I can use the enter key in IE here. But that messes up some other alignments. I dug further and noticed that the [url="http://public.gamedev.net/public/js/3rd_party/ckeditor/ckeditor.js"]http://public.gamedev.net/public/js/3rd_party/ckeditor/ckeditor.js[/url] file is doing version checking (rather than feature checking) and doesn't have a check for IE 10 so its possible that that is the problem (or partially it, or related to being it).
  5. I'm not sure if this applies to all versions or just to IE 10, but whenever I try hitting enter to add a line break it does nothing in IE 10 (the desktop version on Windows 8 Pro x64, not using "compatibility mode"). It's as though I pressed a dead key. Pressing enter works just fine in Firefox on the same machine so it seems to be browser-specific. I'm using Firefox for this post (hence this new paragraph), but for various reasons typically use IE for most web browsing, I have no interest in a browser flame war or in a discussion of the relative merits of the different browsers. Just wanted to report a bug that I'm experiencing. Thanks!
  6. Virtual DirectCompute

    If you use a WARP device then you can run compute shaders. It's a lot faster than a ref device but still may fall flat on its face in terms of real performance. So I'd be leery of doing it without some heavy perf testing on low-end and older hardware.It could end up being a lot faster to do those calculations CPU-side using DirectXMath (or other vector math functionality) and parallelization (e.g. PPL's parallel_for and parallel_for_each) without being a huge time-sink in terms of writing and maintaining the separate code path for non-compute class hardware.
  7. You can bind up to 14 constant buffers per pipeline stage (and up to 128 texture buffers per pipeline stage). See the remarks here: [url="http://msdn.microsoft.com/en-us/library/bb509581(VS.85).aspx"]http://msdn.microsoft.com/en-us/library/bb509581(VS.85).aspx[/url] .
  8. You can but you need to be careful about alignment issues. XMMATRIX and XMVECTOR need to be 16-byte aligned. See here for more on it: [url="http://msdn.microsoft.com/en-us/library/ee418732(VS.85).aspx#Properly_Align_Alloc"]http://msdn.microsoft.com/en-us/library/ee418732(VS.85).aspx#Properly_Align_Alloc[/url] . You can see an example of how to deal with a 'new' alignment in the SpriteBatch class in DirectXTK - [url="http://directxtk.codeplex.com/"]http://directxtk.codeplex.com/[/url] - and its AlignedNew.h header file.
  9. Pixel shader executing wrong

    You didn't mention which shader model you are using, but I'm guessing you aren't familiar with branch and flatten attributes: [url="http://msdn.microsoft.com/en-us/library/bb509610(VS.85).aspx"]http://msdn.microsof...610(VS.85).aspx[/url] . Try moving your tex2d call before the if and then just assign the correct float4 color inside the if-else.
  10. XNA's Future

    [quote name='Daaark' timestamp='1351830180' post='4996424'] Engine and system level development is in C++. 'Most' of the game world programming game logic in scripting languages for their engines or doing other tasks. There are many tasks in game development. [/quote] I forgot about point sprites. But they could easily be replicated with quads (even improved upon) so it's hard to argue that anything was lost through their removal. And I saw their removal as one of many steps preparatory to moving the code base to DX10/11 (even though that ultimately hasn't happened). I do agree with PC being the least-loved platform for XNA. Anyway, I quoted that snippet because yeah I know there are other aspects of game development. But if you are planning to work in the programming aspects at all, you need only look through the job postings to see that (for the most part) people without C++ knowledge need not apply (even if you ultimately end up in a sub-discipline where you never end up writing any C++). Indeed, things like Lua interpreters written in C++ are some of the many things in the "libraries, tool chains" groups that made it impossible for most shops to consider going to C#. The expense of writing a Lua interpreter in C# likely wouldn't be too high as a stand-alone task, but add in physics, content ingestion, other ad-hoc interpreters and parsers, and everything else, (not to mention 3rd party middleware that you have little to no control over) and the costs can quickly become prohibitive. It's the same reason that people like my father are paid well to write new COBOL code (and maintain and update existing code); the existing millions upon millions of lines of COBOL code that his company has represent an astronomical sum of time and money when looked at from a replacement cost point of view but a relatively minor sum when looked at from a maintenance and update cost point of view. The same is true with C++ and game development, and that was my point.
  11. When he (Jason Zink) started writing Hieroglyph3 there was no DirectXMath nor any XNAMATH. According to the book he co-wrote, [i]Practical Rendering & Computation with Direct 3D 11,[/i] he started the project in 2000 with D3D 8. I'm not even sure if there was a D3DX math back then, honestly. I expect he created the custom structures and math functions simply to fill a void (or possibly as a learning experience) and has kept them up to now since changing away from them would be a big undertaking. I think he does have plans to switch to DirectXMath, but I'm not positive and it would be quite a few hours of free time needed to complete it and test it out at any rate.
  12. XNA's Future

    Several things. First, XNA is in the WP8 SDK. And if you want to write Windows Phone games that target WP7 and WP8 hardware then XNA is the only real option since the DirectX stuff is WP8 hardware only. If you want to develop XNA games for Xbox or PC then you need to download the WP7.1 SDK and the WP7.1.1 update to it. Second, XNA 4 didn't throw Xbox games under the bus. Off hand, the only thing that Xbox lost from 3.1 to 4.0 was 8192x8192 textures. As long as your switched to the HiDef profile you could do everything else (and a lot of it even got faster since they batched up state changes rather than pushing them one-by-one to the GPU). And if you look at the API changes made to XNA 4, they seem clearly designed towards moving XNA's guts from DX9 to DX10/11. But it seems extremely unlikely that that will happen at this point. If I had to guess why, I would say it was a combination of too many studios and developers being unwilling/unable to move from C++ to C# (due to experience, familiarity, libraries, tool chains, etc.) combined with the new Windows Runtime accomplishing all the sandboxing without the requirement to use C# and .NET. At this point it seems that DirectX 11+ and Windows Runtime are the future of the MS game development stack. XNA is in some sort of maintenance mode. It remains a good tool for teaching the basics of game development, but as most of the game development world can't or won't move away from a core of C++, anyone who really wants to get into the industry will need to learn C++ and DirectX/OpenGL eventually anyway. And there will continue to be projects like SharpDX, SlimDX, and MonoGame to keep things alive for developers who do want .NET game development.
  13. I'm not sure if it's a good idea or not, but if you want the desktop window's HWND, call GetDesktopWindow - [url="http://msdn.microsoft.com/en-us/library/ms633504(VS.85).aspx"]http://msdn.microsoft.com/en-us/library/ms633504(VS.85).aspx[/url] .
  14. Over the summer I wrote a free (reg-ware) eBook for SyncFusion targeted at C# developers aiming to learn modern C++. You might find it helpful as it covers const-correctness, the cast operators and their use cases, references, the ins and outs of all the constructors and assignment operators, namespaces (something I think is important in modern C++ but which is easy for people coming back to it to overlook or ignore), RAII and the Standard Library's smart pointers (unique_ptr, shared_ptr, the make_shared function) and (for Windows) ComPtr, strings (much better than they used to be but they could be better still), lambdas, some basic idioms, and some of the other important features of the C++ Standard Library (std::vector and other containers, iterators in general, and some miscellany suggestions for things to look into further). It's not as strong on the Standard Library as it could be, but the design goal was approximately 100 pages with a focus on practical examples (there are ~20 sample programs with full code). Link here: [url="http://www.syncfusion.com/resources/techportal/ebooks/cplusplus"]http://www.syncfusion.com/resources/techportal/ebooks/cplusplus[/url] ; intro/overview here: [url="http://channel9.msdn.com/coding4fun/blog/C-for-C-Developers-with-C-Succinctly"]http://channel9.msdn.com/coding4fun/blog/C-for-C-Developers-with-C-Succinctly[/url] . Comes in PDF and MOBI and the code samples are available on bitbucket: [url="https://bitbucket.org/syncfusion/cpp_succinctly"]https://bitbucket.org/syncfusion/cpp_succinctly[/url] . (I've already been paid for it and don't get any bonuses for downloads or anything so I'm recommending it purely on a "you may find it useful" basis, without any ulterior motives. If you download it and it helps you, great! If you skip it, that's fine too.) Ultimately when the next edition of The C++ Programming Language comes out in March, that'll definitely be the book to get.
  • Advertisement