Jump to content
  • Advertisement

rick_appleton

Member
  • Content Count

    1491
  • Joined

  • Last visited

Community Reputation

864 Good

About rick_appleton

  • Rank
    Contributor

Personal Information

  • Interests
    Programming
  1. I'm wondering about something that I haven't been able to find much info on. Assuming Virtual Texturing, how do you integrate materials with non-virtual textures? What ID to give meshes with that material, so that it is rendered into the feedback buffer, and so you know that that ID maps to an unloaded piece of plain old texture. I see two options: I can give it any unique number initially, and then when it is actually needed to be paged into the physical texture change the ID so that it points at the right location in the indirection texture. Manage a BSP for the entire Virtual Texture space. Then when a plain texture comes in, find a place in the virtual texture that is empty, and assign it an id for that space. No need to actually load the texture yet, until the system determines that id is needed. In this case the ID will always point to a valid place in the indirection texture. Is either of these the 'usual' solution or am I missing something?
  2. rick_appleton

    Gather operation in Entity Component System

    I think this will only work if the components are sorted. If the array with components is not sorted by ID it'll give incorrect results. This is the main idea of having the extra indirection there I didn't think of eliminating the values array like that, it's definately a good point. It makes it a bit easier to think about that way, since I then only need to reconcile the two arrays: array from LocationSystem: [0, 1, 2]; array from RenderSystem: [0, 2]; I think I can safely set the extra limitation that those indexes will be sorted, although that does mean I'll need to move a lot of components if I erase an item in the middle.
  3. I've started working on an Entity Component System where an entity is only an ID and all the data is held in the different systems. As an example I have two systems: RenderSystem and LocationSystem. Each system stores the data of the entities that have that component in a flat array, and has map of 'entity id'->'array index' for that system. - LocationSystem contains a position/orientation/bounding box for each entity - RenderSystem renders each entity using it's position/orientation Now imagine I have three entities: Entity 0: Location Render Entity 1: Location Entity 2: Location Render In the LocationSystem the contents will look like this: array = [Location Component A, Location Component B, Location Component C] map = [0->0, 1->1, 2->2] In the RenderSystem the contents will look like this: array = [Render Component A, Render Component B] map = [0->0, 2->1] Currently the update for each system is called manually, passing in the map and array from the other systems that are needed, such that each system can then get at the proper data (basically a gather operation): renderSystem->update( locationSystem.map, locationSystem.array ); RenderSystem::Update( lsMap, lsArray ) { for( entityID in this.map ) { RenderComponent rc = this.array[this.map[entityID]]; LocationComponent lc = lsArray[lsMap[entityID]]; // Do stuff with the two components here } } However, I'd like to change this so that the system can iterate over it's own array in it's update function, and doesn't need to bother with the map: RenderSystem::UpdateNew( ... ) { for( i in this.array ) { RenderComponent rc = this.array; LocationComponent lc = ???; // Do stuff with the two components here } } I guess I could do the reverse lookup outside the function, but I'm wondering if there is some kind of more efficient way to do this, taking into account that if an entity has a RenderComponent, then it also always has a LocationComponent.
  4. rick_appleton

    From: Opengl texture quality

    You'll need to give your exact matrices and draw call info for us to really help. It probably has to do with the sampling position of the texels. The best link I could find in a few minutes is http://www.gamedev.net/topic/396461-solved-pixel-perfect-textures-opengl/
  5. rick_appleton

    Compile times?

    Thank you all for your replies. Looks like I'm not the only one then. And thanks for the tips everyone.
  6. rick_appleton

    Compile times?

    I'm wondering how long it takes to compile your projects. Here at work, I am constantly waiting on the compiler. A full compile of the project takes hours! Touching a single file still takes minutes to compile.
  7. rick_appleton

    iPhone Development Pitfalls

    Thanks for the tips!
  8. rick_appleton

    Argument-Dependent Lookup error Visual Studio

    Thank you all for your replies. I suspected the non-fundamental type thing, but always thought that HWND was actually a void*. After some digging it seems that by default HWND is actually a pointer to a proxy struct. However, adding #define NO_STRICT before including Windows.h reverts HWND to being an actual void* again, which causes the code to work as expected. It obviously won't work for other types, but I think I won't encounter anything else anyway.
  9. I'm having an issue with Visual Studio and Argument-Dependent Lookup of functions. The following code compiles without problem. void testFunction( int i ) { printf("::\n"); } namespace n1 { void testFunction( int i ) { printf("n1\n"); } void callingFunction( void ) { testFunction(5); } } yet, this similar code doesn't. It gives me an error about ambigious call to overloaded function, due to finding the global function through ADL. void testFunction2( HWND i ) //found using argument-dependent lookup { printf("::\n"); } namespace n1 { void testFunction2( HWND i ) { printf("n1\n"); } void callingFunction2( void ) { testFunction2((HWND)5); } } Is this correct behaviour or a compiler error? If it is correct, is there something I can do to fix this WITHOUT explicitly adding which function I want called? I have a large list of generated functions and I want to selectively replace a few.
  10. rick_appleton

    Setting up a GL capabilities database

    Thanks for the info. I could have used this just a week ago I'd also see the value in what driver versions support what extensions, so I'm wondering if you've got a specific reason for merging driver version together?
  11. After a couple more lengthy debug sessions involving gDebugger, glIntercept and lots of suppositions about the OpenGL state, I once again have gotten thoroughly frustrated by the state of OpenGL debugging tools. Being a programmer though, there is something I can do about that. As such I'd like to get a feeling for what useful features would be in such a tool. Some things I can think of, some of which are inspired by PIX or gDebugger: - Frame saving, replaying. Being able to exactly save the calls and data that generate a specific frame, and then replay them at will later. - Image and movie capture. - Shader debugging. - Performance analysis. - Bottleneck detection; (fillrate, vertex setup, texture bandwidth). - Error checking. - Deprecated function detection. - Live shader editing. - Viewing (and modification) of all data; textures, buffers, shaders - Stepping through calls. - See what calls render to specific pixel(s). What would be useful to you?
  12. rick_appleton

    Storing function arguments

    You are indeed correct. For now I'm not really interested in the contents of the pointers, I'm just going to print the value out. I realize this is not really useful info to have, but I can't very well leave out arguments if I'm logging the function calls. Later on I will indeed copy any info that is passed as a pointer. Likely I'll use a scratch heap for that as well, similar to how I plan to use scratch heaps to store the arguments on.
  13. rick_appleton

    Storing function arguments

    Thanks for this. I'll likely go for something along these lines. This is generally a bad idea. If processing the logs takes longer than it does to generate them, then logging thread will lag behind the main application. Since it stores unprocessed logs, it will consume increasing amounts of memory. And if logs can be processed faster than they are generated, then it makes no sense to shuffle them to another thread, just do it at call site. I think one of the fastest ways to store this data is to have a large block of memory, and simply 'push' the function pointer, the arguments, and the return value onto this sequentially.[/quote]True - what happens when this storage is exhausted? Do you block until memory is available? If so - then having a separate thread doesn't help - average throughput will be limited by how long it takes to process logs. With extra thread, there is also additional overhead so it's worse than just processing logs directly. And for high performance applications, operations should take O(1). Since some operations cannot be done in such time, different approach is often taken. Java VM, for example, is unsuitable for real time control due to garbage collection. Apart from being non-deterministic it also has unbounded running time, meaning that application can spend seconds, in worst case even minutes doing the GC pass. [/quote] I'm not sure I'm following you Antheus. In general I expect applications using this to fall in two categories: either high-performance multi-core, or high-performance single-core. The functions I will be logging will generally be accessed from a single, or at most two threads. The applications will be doing other stuff than just my logging, so on the main thread the logging will take a small amount of time compared to the total program time. It is this small amount of time that I want to minimize. If it's a single core application, then other cores will be free to be 'heavy' logging/analytics. If the application is truely CPU bound on all the cores, then the user will just have to take the resulting performance hit, and it won't really matter on which thread I do what. I'll be swapping blocks of memory, to keep the consumption down. However, I will take your comment into account. If the system is fully loaded, I expect it might be possible for the logs to be processed slower than they are generated, so I'll need to do something about the memory spiraling out of control. As far as I can tell varargs are useful when accessing a variable amount of arguments, not for storing them. I have many functions, each of which I know the exact number and type of arguments, and I want to store each call such that I can analyse it later. varargs might be useful at the other end though, when I decode this data. I also remembered an article by Mark Jawad about deferred function calling. It's in Game Programming Gems 7, so I'll take another look at that.
  14. rick_appleton

    Storing function arguments

    Thank you for your reply. This is pretty much the other option, and certainly more generic. Luckily the functions are plain C functions, and I do know the number of arguments, so I could certainly specify the number by hand. I already expect that however I end up solving this I'll always need to do that, and possibly explicitly note if there is a return value. Not having access to the memory pointed to by pointers is fine.
  15. For a logging utility I'm making I want to log function calls, with the parameters, and optionally the return value. Since the apps using this are usually high-performance, I don't want to take the time converting the parameters to a string inline with the function call. I've decided I want to store this data, and then in another thread I'll retrieve it and do the printing/analysing. I think one of the fastest ways to store this data is to have a large block of memory, and simply 'push' the function pointer, the arguments, and the return value onto this sequentially. The question I'm now pondering is how to do this efficiently, and in clear code. Each function that will be logged this way can have a different number and type of arguments. Since arguments can have different sizes (bool vs double), I suspect I'll need to use some template or define magic to get this done nicely. However, so far I've not been able to think of a nice way to do it other than writing it out for each argument. Basically I want to find a way to achieve the following with only a single line of code (or two when adding the return value): int currentPositionInBlock; int MyFunction( bool arg1, char* arg2 ) { void* fncPtr = &MyFunction; memcpy((char*)currentPositionInBlock, &fncPtr, sizeof(fncPtr)); currentPositionInBlock += sizeof(fncPtr); memcpy((char*)currentPositionInBlock, &arg1, sizeof(arg1)); currentPositionInBlock += sizeof(arg1); memcpy((char*)currentPositionInBlock, &arg2, sizeof(arg2)); currentPositionInBlock += sizeof(arg2); int result = ... memcpy((char*)currentPositionInBlock, &result, sizeof(result)); currentPositionInBlock += sizeof(result); Of course I'll also need to retrieve this data and handle it, but since that isn't time sensitive and I know what function takes what parameters, I'm sure I'll manage that. Kind regards, Rick
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!