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

tr0x

Members
  • Content count

    23
  • Joined

  • Last visited

Community Reputation

100 Neutral

About tr0x

  • Rank
    Member
  1. Oh dear.. I didn't even know about this feature. Thanks for pointing it out, it should make life a lot easier! The actual error code is x4580. It states that the shader that uses the concerned function does not return the values it should. I guess that just means that there is an error during the execution of the shader, doesn't it?
  2. [quote name='ankhd' timestamp='1304654212' post='4807232'] Hi there. Could you use texture to hold your data and not an array [/quote] It is important not only to read but also to write the data in the shader function. As far as I know that is not really possible with textures, is it? [quote name='Hodgman' timestamp='1304654746' post='4807235'] [quote name='MJP' timestamp='1304546050' post='4806605']What's the actual error that you get?[/quote] [/quote] I get pretty much the the "standard" error messages, that always pop up, when there's something wrong with the shader code: "The Direct3D device has a non-zero reference count, meaning some objects were not released." "An error occurred in the device create callback function." (from DXUT) Since this error also appears if there's a missing semicolon or whatever, I don't think it really helps here. I was able to increase the performance dramatically by using an array with just two rows, as the values of each hierarchy level are only dependent on its child-level. Though I still think it is bad style of coding to do it statically.
  3. [quote name='Hodgman' timestamp='1304580327' post='4806783'] BTW, 17*31 is 527 registers, which is a lot. Why do you need so many temp registers? [/quote] As recursion is not supported in HLSL, this function solves a recursion formula using an iterative approach. To accomplish that, I use the array as a binary tree, where the value of (x,y) is based on the values of (x,y-1) and (x+1, y-1). As result the function returns two arrays.
  4. [quote name='MJP' timestamp='1304546050' post='4806605'] What's the actual error that you get? Is it a compiler error? [/quote] Yeah, if I declare the arrays global and static it works - with the mentioned drawbacks. If I declare the arrays within the function using the static keyword, the program has the same problems but only draws a blank screen. i.e. the result of the function is probably always zero. If I don't use the static keyword within the function the program throws an error at startup. Same thing happens if I try to declare it globally and non static. It's really frustrating.. all I need is a small temporal storage place, which I can read and write to. The function is admittedly critical and is called up to million times each frame. But obviously the pure allocation of memory and not the computational effort causes the performance to decrease dramatically.
  5. I'd have a neat screenshot to offer if the problem gets solved! Sorry for double posting all the time, but I don't have ideas anymore, to solve my issue and this is the only place I know, where I can anticipate help.
  6. [quote name='MJP' timestamp='1304445097' post='4806044'] So if I understand you correctly, you just have a 2D array of temporary data that is written to and read by your shader program? [/quote] Thank's for you answer! That's right. The function uses internally two 2D arrays for computation and returns two 1D arrays (i've changed that now). Do you have any proposals how to circumvent the problem? What I still don't get: why can't I just declare the arrays within the function? As they are only used by this function, I don't see any reason for them to be global and static. Is there any reasonable explanation or might this be only a strange side-effect caused by something else?
  7. Anyone an idea maybe? Is the problem description still unclear? As I said, everything works correctly but here an example how the performance is related to the array size: [code]static array1[5][7] static array2[5][7] [/code] launch time: 5 seconds fps: 50 [code]static array1[17][31] static array2[17][31] [/code] launch time: 80 seconds fps: 12 The computational effort of the function is the same, as I use in both cases only the first 5 lines and the first 7 columns of the array. So there's something terribly wrong with those arrays. Any help would be much appreciated!
  8. [quote name='MJP' timestamp='1304270660' post='4805117'] Could you explain what you're actually trying to implement here? [/quote] I implemented an iterative solution of a recursion. Based on two input variables and certain criteria the result is computed bottom up, so that the actual result is in the very first line of the array. ( i.e. it would be enough to return the first lines of both arrays, I just realized ) During the execution of the function both the arrays are written and read. I have to add that the mentioned effects ( longer launch time, lower fps ) are not occuring because the function complexity increases with increasing array size. Even if I only operate within [5][10], but declare the array as [10][20] the effects appear.
  9. So basically the question is: how to effectively write and read two-dimensional data in the shader.
  10. Hey, in my shader I use a function that stores and returns the resulting data in two arrays. Everything works correctly but I assume it is very bad style of coding. The result is correct, but the bigger those arrays are, the longer the program takes to start and the lower the framerate. Here the relevant code snippets: [code] struct RET { float a1[10][20]; float a2[10][20]; }; static float array1[10][20]; static float array2[10][20]; [/code] [code] RET foo1() { RET r; // write and read array1 and array2 r.a1 = array1; r.a2 = array2; return r; } [/code] Well, this is awkward but it was the only way to get it working. I actually don't see any reason for array1 and array2 to be static and global. But if I try it like follows the program throws an error message at start: [code] RET foo2() { RET r; // write and read r.a1 and r.a2 return r; } [/code] 1. Is this behaviour comprehensible? 2. How could I realize my task in a proper and more efficient way? 3. Do I maybe need to pack the data into float4s?
  11. Oh well.. the reason of my problem is just as simple as it could be: I was stupid. It's working now - thanks for your efforts.
  12. Hi there, in my program I use five buffers like the following (hlsl declaration): [code] Buffer<float4> bufferExample : register( c1 ); [/code] Everything is working as intended so far. But somehow, when I add a sixth one - no matter what data I fill into it - the content appears to be zero, when I want to read it in the shader. I don't see any logical explanation for that behaviour and it really drives me mad! Can anyone enlighten me or is it probably a bug in my code? (as I coded it three times from scratch and the other five buffers are working, I don't think it is a bug) For the sake of completeness, here the code I use in the application to set the buffer: [code] ID3D11ShaderResourceView* g_srvTest; ID3D11Buffer* g_Test; int size = 4000; D3D11_BUFFER_DESC DescTest; DescTest.Usage = D3D11_USAGE_DYNAMIC; DescTest.BindFlags = D3D11_BIND_SHADER_RESOURCE; DescTest.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; DescTest.MiscFlags = 0; DescTest.ByteWidth = sizeof(D3DXVECTOR4) * size; hr = pd3dDevice->CreateBuffer( &DescTest, NULL, &g_Test ); if( FAILED( hr ) ) return; DXUT_SetDebugName( g_Test, "g_Test" ); D3D11_BUFFER_SRV srvBTest; srvBTest.ElementOffset = 0; srvBTest.ElementWidth = size; // create a Resource View and attach the Buffer to it D3D11_SHADER_RESOURCE_VIEW_DESC srvDescTest; srvDescTest.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; srvDescTest.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; srvDescTest.Buffer = srvBTest; hr = pd3dDevice->CreateShaderResourceView( g_Test, &srvDescTest, &g_srvTest ); if( FAILED( hr ) ) return; D3D11_MAPPED_SUBRESOURCE MappedResourceTest; pd3dImmediateContext->Map( g_Test, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedResourceTest ); D3DXVECTOR4* testData = ( D3DXVECTOR4* )MappedResourceTest.pData; for( int i = 0; i < size; i++) { testData[i][0] = 20.0f; testData[i][1] = 20.0f; testData[i][2] = 20.0f; testData[i][3] = 20.0f; } pd3dImmediateContext->Unmap( g_Test, 0 ); pd3dImmediateContext->PSSetShaderResources(1, 1, &g_srvTest); [/code] PS I also experienced the weird behaviour, that the program crashes, when I swap the index of two buffers. i.e. I change: [code] Buffer<float4> bufferExample1 : register( c1 ); Buffer<float4> bufferExample2 : register( c2 ); [/code] to: [code] Buffer<float4> bufferExample2 : register( c1 ); Buffer<float4> bufferExample1 : register( c2 ); [/code] and at the same time: [code] pd3dImmediateContext->PSSetShaderResources(1, 1, &g_srvTest1); pd3dImmediateContext->PSSetShaderResources(2, 1, &g_srvTest2); [/code] to: [code] pd3dImmediateContext->PSSetShaderResources(1, 1, &g_srvTest2); pd3dImmediateContext->PSSetShaderResources(2, 1, &g_srvTest1); [/code] Does someone know the reason therefore?
  13. It works! I can't thank you enough!
  14. Thanks for your detailed explanation! Though I' am afraid I need your help once again. I desperately tried to code what you told me, but I am simply not able to figure it out. Here is my (awkward) code: [code] ID3D11ShaderResourceView* srv; ID3D11Buffer* cps; struct POINTS { float coords[512][4]; }; ... // create resource D3D11_BUFFER_DESC Desc; Desc.Usage = D3D11_USAGE_DYNAMIC; Desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; Desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; Desc.MiscFlags = 0; Desc.ByteWidth = sizeof( POINTS ) ; V_RETURN( pd3dDevice->CreateBuffer( &Desc, NULL, &cps ) ); DXUT_SetDebugName( cps, "BUFFER" ); D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc; srvDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; pd3dDevice->CreateShaderResourceView( NULL, &srvDesc, &srv ); // what's the first parameter for? // I can't see a connection between the buffer and the resource view here.. ... // per frame D3D11_MAPPED_SUBRESOURCE MappedResource; pd3dImmediateContext->Map( cps, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedResource ); POINTS* pData = (POINTS* )MappedResource.pData; for( int i = 0; i < 512; i++) for( int k = 0; k < 4; k++) pData->coords[i][k] = 1.0f; pd3dImmediateContext->Unmap( cps, 0 ); [/code] and in the shader: [code] Buffer<float4> testBuffer : register( c0 ); ... float4 test = testBuffer.Load(0); [/code] I really hope you do take the time to look at it.
  15. Thanks a lot for your answers! So I want to transmit an array of float4s. What would be the best way to do so? I guess a 1D Texture would be appropriate, right? Could you give me a hint, how to fill the array with the data? Searching on msdn did not really enlighten me how to do that. I suppose it is a really easy thing to do, but as I am new to directX and hlsl things are a bit arcane to me yet.