Jump to content

  • Log In with Google      Sign In   
  • Create Account


who has the biggest score


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 lomateron   Members   -  Reputation: 329

Like
0Likes
Like

Posted 04 April 2014 - 04:40 PM

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, 06 April 2014 - 02:49 AM.


Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 7822

Like
0Likes
Like

Posted 04 April 2014 - 06:10 PM

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.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#3 lomateron   Members   -  Reputation: 329

Like
0Likes
Like

Posted 04 April 2014 - 06:31 PM

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



#4 lomateron   Members   -  Reputation: 329

Like
1Likes
Like

Posted 05 April 2014 - 12:09 AM

whut, can I know why the downvotes?



#5 lomateron   Members   -  Reputation: 329

Like
0Likes
Like

Posted 05 April 2014 - 05:19 PM

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



#6 fir   Members   -  Reputation: -452

Like
-1Likes
Like

Posted 05 April 2014 - 05:38 PM

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, 05 April 2014 - 05:58 PM.


#7 Hodgman   Moderators   -  Reputation: 29493

Like
0Likes
Like

Posted 05 April 2014 - 05:49 PM

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, 05 April 2014 - 08:35 PM.


#8 mhagain   Crossbones+   -  Reputation: 7822

Like
0Likes
Like

Posted 05 April 2014 - 07:33 PM

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


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#9 lomateron   Members   -  Reputation: 329

Like
0Likes
Like

Posted 06 April 2014 - 02:52 AM

ok I edited the 1 post, more more clear






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS