• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
reaperrar

ID3D11Buffer question...

8 posts in this topic

When a ID3D11Buffer is created, is a .bytewidth(from desc) sized block of memory reserved? Is it dependant on the flags for creation?

0

Share this post


Link to post
Share on other sites

How do I work out exactly where the memory is reserved.... video, agp or ram & how much is available (is this something we keep track of or can dx tell us how much is left)?

 

When mapping the buffer for writing (e.g dynamic with write access) I'm assuming this is agp memory. If I map with D3D11_MAP_WRITE_DISCARD it writes to a different memory location if I'm not mistaken (as the gpu may still be using the previous block of memory)? If that's the case... how can the memory be reserved?

 

I'm just thinking about memory limitations and ensuring my app doesn't exceed them... though I cannot find much information on how to go about this.

0

Share this post


Link to post
Share on other sites

First thing, that your memory mapping will depend on is if your device is created by DriverType as HARDWARE or REFERENCE.

Assuming it's HAL, memory allocations happen on GPU.

AGP is just a channel. It's purpose is more like registers.

Refer to this link for further clarity --> http://gamedev.stackexchange.com/questions/18026/directx11-how-do-i-manage-and-update-multiple-shader-constant-buffers

0

Share this post


Link to post
Share on other sites

I'm still confused regarding everything in my previous post lol.

 

I'm getting the impression AGP is reserved RAM that increases/decreases dynamically as needed? So the vertex buffer i created as dynamic with cpu write access points to a block of memory there... always, so at minimum there is .bytewidth memory reserved. But If I map the buffer with D3D11_MAP_WRITE_DISCARD there are now two blocks of memory reserved of bytewidth size?

0

Share this post


Link to post
Share on other sites

That 2 blocks of memory is because of the dynamic usage nature of D3D11_MAP_WRITE_DISCARD.

I am guessing that it always appends the same chunk of memory to the originally requested one, for catering to the needs of D3D11_MAP_WRITE_DISCARD.

And again, AGP is just a channel that provides direct access to main memory. There is no memory allocation happening on AGP.

0

Share this post


Link to post
Share on other sites

"AGP memory" is a fairly old term (from when GPU's generally used an AGP-port, instead of a PCIe port).
It's basically refers to regular "main memory" that the OS has allowed the GPU to access over the AGP/PCI channel. This type of memory means you can quickly update it from the CPU (as it's just regular RAM), but the GPU can also access it as if it were GPU-RAM (aka video RAM), albiet it will be a bit slower than reading from local GPU-RAM, depending on the AGP/PCI bus speeds.

 

The way D3D/GL are made, you can never actually know where your buffers are stored. They might be stored in main memory, or in "AGP memory" (AKA GPU-accessible main memory) or in GPU-memory. All you can do is give the API/Driver the appropriate hints (e.g. DYNAMIC, READ_ONLY, etc) and hope that the driver allocates your memory in the appropriate place. Also, on PC, there's really no reliable way to measure the amount of available RAM in any of these places either, and tell exactly how much RAM your buffers are using.

 


For the next part, keep in mind that the GPU/CPU are not synchronized. All D3D/GL commands to the GPU are sent through a pipe, which typically has a lot of latency (e.g. 10-100ms). Whenever you ask the GPU to do something, it will do it some time in the future.

When you map a resource that's being used by the GPU -- e.g. 1. put data in buffer, 2. draw from buffer, 3. put new data in same buffer, 4. draw from buffer -- the driver has two choices once the CPU gets up to #3:

1) It introduces a sync point. The CPU stops and waits for the first "draw" (#2) to be complete, and then maps the buffer. This could stall the CPU for dozens of milliseconds.

2) It creates another internal allocation for that buffer, which the CPU writes to during #3. From your code, you still just have the one handle to the buffer, but internally, there can be any number of versions of the buffer "in the pipe", on their way to being consumed by the GPU. Some time after the GPU executes #2, the allocation from #1 will be freed/recycled automatically by the driver.

 

Specifying a "DISCARD" hint will help the driver choose option 2.

Edited by Hodgman
2

Share this post


Link to post
Share on other sites

Tyvvm for your explanation. So it is probably best to use D3D11_MAP_WRITE_NO_OVERWRITE if the buffer has not been filled entirely and write to the unused parts of the buffer... attempting to avoid the sync points?

0

Share this post


Link to post
Share on other sites
Yes, the NO_OVERWRITE hint gives the driver a 3rd option -- just give the application access to the buffer without syncing or creating extra allocations -- however, the results are undefined if you disobey the hint and do actually overwrite existing data ;)
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0