Jump to content

  • Log In with Google      Sign In   
  • Create Account

Starnick

Member Since 06 Oct 2010
Offline Last Active Today, 02:34 PM

Posts I've Made

In Topic: Suggest a name for my game(15$)

24 December 2015 - 04:52 PM

For some reason while reading that description the phrase "Rock'em sock'em gangnam style" popped into my head. Not sure why.

In Topic: Independence Day 2.... how do you feel about it as a programmer?

15 December 2015 - 08:06 AM

This isn't a random sequel either, there's been talk of an ID2 movie for at least the last 10 or 15 years and the script was in "development hell" with the folks involved wanting to do a sequel but unsure where to take the plot.

 

I really liked the first movie, it was shlock, but it was fun block-buster summer movie schlock. I'm pretty sure the sequel won't rise much above that, but I've been looking forward to this movie for a while now :)


In Topic: The model can't be showed completely when stl file exceeded 144MB.

29 October 2015 - 08:27 PM

Drake is right, you're hitting a limit with how big a single resource can be. Direct3D11 (guaranteed) limits can be found here. Direct3D10 had a 128 mb limit for vertex buffers, but I guess you can go higher in D3D11 depending on your hardware. SharpDX will follow these limits (think of it as a nearly 1-to-1 wrapper for the Direct3D libraries...all the documentation applies.

 

So split up the vertex data into two buffers and make two draw calls.


In Topic: How to Set Pixel Shader Constants

01 September 2015 - 07:54 AM

I fixed the link (not sure why copy and paste failed me...!). I was trying link to PSSetSamplers.

 

So the point of the default constant buffer is that you don't define it. If any of your parameters are defined in the global scope (as in, not inside an explicitly defined cbuffer or tbuffer) then they automatically will be in a buffer called $Global. There's also another default constant buffer called $Param for uniforms that are defined in the parameter list of your main function. (See this article). For pre-D3D10 shaders to work those parameters have to end up somewhere, so HLSL puts them in $Global rather than failing and forcing you to rewrite your shader code. I think $Global will always be bound to slot 0, but don't quote me on that.

 

As for the data types, they'll be 32-bit floats. See the HLSL data types page. Knowing the data type sizes is important. E.g. Bool in HLSL will be 4 bytes, but in C# it's 1 byte...I *think* the same is also in C++. I agree somewhat with not wanting to have to replicate your constant buffer as a struct on the CPU side. People just do that for convenience more than anything (although padding and alignment rules can throw a wrench in your direction). You may want to look up on how to do shader reflection when you compile your HLSL fragments. That way you can obtain metadata about what constant buffers have what parameters, the size/type of those parameters, and the offsets of each parameter in the buffer. I have something similar in my setup, where I can reference parameters by index/name and set individual floats, vectors, etc or even come up with a struct that represents everything and set it once. The buffer is just a bunch of bytes and can be treated as such. Doing graphics programming in C#, I tend to not want to worry about struct padding and just reference each parameter individually...

 

Depending on what you want to do and learn, you could also use Effects11. Everything I described above, Effects11 does for you. It's distributed separately from Direct3D now, but it still seems to be maintained by Microsoft.

 

 

 


In Topic: How to Set Pixel Shader Constants

31 August 2015 - 10:25 AM

Well samplers (and other resources) aren't set in a constant buffer. Those are separate calls (e.g. PSSetSamplers)

 

Those parameters in that HLSL file will wind up in a default global constant buffer (named $Global). So while not defined in the same fashion the other posters are talking about, at the end of the day it'll be treated as any other constant buffer that contains p0, p1, size1, args0.

 

Edit: Fixed the link...huh not sure why it was broken.


PARTNERS