Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


phil_t

Member Since 06 Oct 2006
Online Last Active Today, 10:17 PM

Posts I've Made

In Topic: Why high level languages are slow

15 April 2015 - 11:39 AM


I'm trying to point out the argument cuts both ways. You can't say that "C# is slow by design" and ignore that the de-facto "high-performance" language (C++) also has slow features (i.e. virtual dispatch).

 

I would argue: "Everything on the heap" is at the core of C#. Virtual dispatch is not at the core of C++ in the same way.

 


As I already pointed out - C# does not require the heap for everything, and garbage collected (or at least loosely-pointed) memory has it's own advantages (memory compaction).

 

It doesn't, but then you're fighting the language. Trying to manage an array of value types comes with significant limitations in C#. True though, memory compaction is a potential advantage. And in practice, if you use an array of reference types and pre-allocate all the objects at the same time, they tend to end up sequential in heap memory anyway - so that does mitigate some of the cache performance issues.


In Topic: Deferred shading: advanteges and disadvanteges and is it really faster

13 April 2015 - 02:24 PM

The fact that you're doing a depth pass at all means you are submitting extra geometry. You have to draw each object twice, right? Once for the depth pass, and once for the lighting.

And I don't understand why a dynamic scene means you can't sort your objects. Pretty much every 3d game in existence has "dynamic scenes", and sorts their objects.

In Topic: Stream Leaks in SharpDX

13 April 2015 - 09:37 AM


This is likely the source of the problem. It appears you create (new) vectors without deleting them

 

Vector3 is a value type, so new in this case is just allocating on the stack. It's not the source of the leak.

 

 


DataStream s = new DataStream(sizeof(float) * vertexCount);
s.Position = 0;
for(int i = 0; i < vertexCount; i++)
{
    s.Write(new Vector3(x, y, z));
    // More vectors if it's a more complicated vertex data format
}
s.Position = 0;
// Draw it here
s.Dispose();

 

Why are you not using "using" syntax? It may not be the source of your leak, but if any exceptions are thrown in there, the DataStream won't be Dispose'd. It should be written like this:

 

using(DataStream s = new DataStream(sizeof(float) * vertexCount))

{

    // blah blah blah

}


In Topic: How does boost::shared_ptr/make_shared equality work?

12 April 2015 - 03:24 PM


How does the syntax work for using multiple shared_ptr objects to refer to the same pointer? I think now it must be very different to how I might have imagined it.

 

How to create and use share_ptr instances

 

It's for std::shared_ptr, but it should be nearly identical for the boost version.

 

Lots of resources on the web for this.


In Topic: [HLSL] Decreasing Shader Model from SM5 to SM2 (vs_5_0 to vs_4_0_level_9_3)

12 April 2015 - 02:00 PM


error X4541: veretex shader must minimally write all four components of SV_position

 

I'm confused... if you're getting errors about SV_POSITION, that implies you're compiling your shaders for DX10 and above? What parameters are you passing to fxc?


PARTNERS