• 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
ucfchuck

AMD APU 6520g fails on texture map from size

4 posts in this topic

i have a texture of some random size, usually a base 2 but recently i have had to accommodate random sizes like 128x455 instead of 128x512. in the hardware it wants some multiple of 32 or else it will wrap around and mess up the image so i rearranged the sizing


the texture is still only xsize*ysize (ie 128 x 455)

[CODE]newtdesc.Width = xsize;
newtdesc.Height = ysize;
...
pTexture = new SlimDX.Direct3D10.Texture2D(g_pd3dDevice, newtdesc);
[/CODE]

i map the texture and fill with new data like normal but if i am using the actual size of the texture on the new data it will wrap when it is not a 32 multiple


[CODE]DataRectangle mappedTex = null;
mappedTex = pTexture.Map(0, D3D10.MapMode.WriteDiscard, D3D10.MapFlags.None);
mappedTex.Data.WriteRange<byte>(NewData);
pTexture.Unmap(0);[/CODE]


so i have to pad the new data with zeros to get the multiple of 32 for the total new data size even though the texture is smaller

[CODE]int texsizefix = ysize + (32 - (ysize % 32));
Byte[] NewData = new Byte[(int)((texsizefix * xsize) * 4)]; // * 4 due to r8g8b8a8
[/CODE]
(ie 128x480 zero padded on each line)


so now this all works fine on several cards, im running a gtx 460m, a gtx 560m, and an amd 6750m but now i picked up a bottom end amd apu with a 6520g integrated gpu and it will not work, it gives me an 'attempted to read past the end of stream' error from this size difference between the texture and the NewData on the map instruction. i tried upgrading drivers and slimdx/directx versions etc but nothing seems to change it. i know i am being a little lazy about it in that i could force all the textures to be some multiple of 32 and handle some stretching in the shaders/vertex mapping but it will set me back significantly if i have to recalculate everything involved with that. am i missing something obvious that fixes the wrapping bug in slimdx/directx or is this just an issue with the new chips not having mature enough drivers to handle this. Edited by ucfchuck
0

Share this post


Link to post
Share on other sites
I'm not super-familiar with SlimDX so I wouldn't know for sure, but perhaps you need to account for the pitch of the mapped texture when writing the new data? This is what you normally have to do in native DX. The pitch will change for different hardware/drivers, so it would account for the strange behavior you're experiencing. There shouldn't be any limitations regarding power-of-2 textures or dimensions being a multiple of 32, so I'm thinking that was the same problem.
2

Share this post


Link to post
Share on other sites
Yes, the returned DataRectangle object will tell you the pitch so that you don't have to guess at the amount of padding, like you're currently doing. Take that into account when writing the data and you should be good.
2

Share this post


Link to post
Share on other sites
ok cool i moved texsizefix to a global and plugged this in everywhere i change the dimensions of the texture, to try and minimize the locking time on the texture resource, and it works great.

[CODE]DataRectangle tempTex = null;
tempTex = pTexture.Map(0, D3D10.MapMode.WriteDiscard, D3D10.MapFlags.None);
pTexture.Unmap(0);
texsizefix = tempTex.Pitch / 4; // div by 4 as the returned value is for r8g8b8a8 [/CODE]

thanks guys
0

Share this post


Link to post
Share on other sites
The pitch could be potentially different every time you map the resource. This is because the driver can relocate the physical memory for the resource when it deems it necessary. To your application, this is a completely transparent operation.

GPU resource virtualization - as implemented in DXGI - can cause very frequent physical GPU memory relocations.

If you map a resource for writing, it is generally not the map/unmap operation itself that causes performance loss. The true reason for performance drop is usually the fact that the GPU may have to wait for access to the resource, if it is - for example - used in a rendering operation at the same time. Of course, large copies will also consume bus bandwidth, which is a separate potential performance hog. Edited by Nik02
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