• Advertisement
Sign in to follow this  

who has the biggest score

This topic is 1387 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In D3D10

I will render around 100,000 vertex with one VertexBuffer of just one vertice using DrawInstanced(), D3D10_PRIMITIVE_TOPOLOGY_POINTLIST

the output of the vertex shader is a random ID the can go from 0 to 2^32, and a random score that can go from 0 to 2^32

Various vertex can output the same ID, the total score of the ID is the sum of all scores with the same ID

I want to know which ID has the highest score, just using the GPU

Edited by lomateron

Share this post


Link to post
Share on other sites
Advertisement

This sounds an awful lot like homework so I'm going to err on the side of caution and give hints.

 

With 2^32 people and 2^32 possible scores, you need an awful lot more than 64mb to store everything: it's nearer 16gb.  You don't want to do that.

 

You only need to track two numbers: what the current highest score is, and who has it.  Initialize the current highest score to 0, the number of the person who has it doesn't need to be initialized (because nobody has a score yet).

 

Then run your tests.

 

Each test that's run, once the result is in, compare the score with the current highest.  If it's higher, then store it as the new current highest and store the id of the person.

 

When all tests have completed you have your result.

 

Doing this on the GPU, you can use D3DBLENDOP_MAX (for 9)  or D3D11_BLEND_OP_MAX (for 11) combined with render-to-texture to do the comparison.

Share this post


Link to post
Share on other sites

Doing this on the GPU, you can use D3DBLENDOP_MAX (for 9)  or D3D11_BLEND_OP_MAX (for 11) combined with render-to-texture to do the comparison.

 

Nop, that can't be done, because every person takes various test, and In the GPU I can put every test in a vertex shader, who makes the test and how much score it gets is random. for example lets say I have a texture with every person and its individual scores, every pixel represents a person with its score, the vertex shader will render points to random pixels, that means I will give a test to random people and this people will get random scores from that test.

 

it's no homeowork

Share this post


Link to post
Share on other sites

Is it being down voted because you think I am asking homework question? it is not

The original problem I am trying to solve doesn't has to do anything with people and scores, I related the problem to people and scores expecting you will see some familiarity with the problem.

I already solved the original problem by changing some basic things of the problem which changes the original problem, but i would still like to see what people think about this one

Share this post


Link to post
Share on other sites

whut, can I know why the downvotes?

 

downwotes are not much wise on this forum anyone can dovnvote you for any reason - perfect recipe for downvotes here is to say something that mas of readers disagree (it can be for example to much wise and you will be downwoted) - recipe for upvotes is say something extreamlly easy to read banal and lame and make readers wanted to easy agree with that ;/ you will get click-click just like in ant-hill

Edited by fir

Share this post


Link to post
Share on other sites

Do you really have 232 objects active at the same time? And each of them needs a 4-byte score variable?

That's 16 gigabytes of RAM just to store the score variable for all those players!!

Or do you have a smaller number of objects, but they use 32-bit identifiers?

 

If you do have gigabytes worth of 'players' active at once, then there's no simple answer. You'll have to operate on them in batches, moving the data between GPU-RAM, system RAM and disk caches...

 

If you've got a smaller number of objects per-frame, but they use 32-bit identifiers, then you can first do a remapping pass that generates linear indexes (0,1,2...) for each object that is going to be used this frame, or you can use a hash-map to store the scores for the active objects.

 

Are you targetting Dx9, 10 or 11 level hardware?

 

I would guess your OP got downvoted because it's written in a very confusing way, making it hard to help you? I can tell you that the people who downvoted it (so far) haven't actually posted in this thread though.

Edited by Hodgman

Share this post


Link to post
Share on other sites

Is it being down voted because you think I am asking homework question? it is not

 

Just to clarify, I didn't say I thought it was homework, I said it sounds like homework (in other words I suspected that it might have been homework), and the reason why was the way the question was written.  The terse statement of the problem, the seemingly arbitrary memory constraint, the requirement to use two passes: when you see enough homework questions you get to recognise the writing style and other elements.  However, and for the record, I'm not one of those who downvoted because I do recognise sufficient doubt (in other words, I accept that my suspicion may have been wrong).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement