Jump to content

  • Log In with Google      Sign In   
  • Create Account

zero_t98

Member Since 02 May 2005
Offline Last Active Mar 20 2013 06:40 PM

Topics I've Started

template texture object as function parameter in sm4+

23 May 2012 - 04:19 PM

Hi,

In SM4 or above, we have


Texture Object (DirectX HLSL). Here is the syntax for creating all texture objects (except multisampled objects).
Object1 [<Type>] Name;

Suppose I want to write a function that takes a Texture2D parameter. What should the syntax look like?

Depends on the surface format, Texture2D could have many declarations like

Texture2D<int>

Texture2D<int2>

Texture2D<float>

Texture2D<float4> etc.

It is unrealistic to write functions for all possible combinations, say


MyFunc(Texture2D<int> tex2d)
MyFunc(Texture2D<int2> tex2d)
MyFunc(Texture2D<float> tex2d)
MyFunc(Texture2D<float4> tex2d)

ideally, I want something like
template<type>

MyFunc(Texture2D<type> tex2d){}

but it gives me errror message like
error X3000: syntax error: unexpected token 'template'

any idea? thank you very much for your help.

hlsl Gather vs Sample, SM5.0

08 February 2012 - 04:21 PM

Hi,

I have a simple pixel shader like below. the result looks wrong if I use "texture2d.Gather". But, if I use "texture2d.Sample", the result is correct. the shader resource is RGB8_UNORM, my questions are

1. Gather and Sample should both return float4 in this case, right?

2. I searched the archive, some posts suggest that Gather will return the values of 4 texels. Since TemplateType is float4 here, the return value should be float4. where does "4 texels" come into picture?

3. based on the document, both Gather and Sample should return un-filtered values at one specific texture, correct?

Thank you for helps.



Texture2D<float4> texture2d;
sampler samplerState;

struct PSIn { float2 texcoord : TEXCOORD; };
struct PSOut{ float4 color : SV_Target; };

PSOut main( in PSIn input )
{
PSOut output;

output.color = texture2d.Gather(samplerState, input.texcoord, int2(0,0) );
// output.color = texture2d.Sample(samplerState, input.texcoord);

return output;
}

games running in internet explorer

29 March 2008 - 05:21 PM

HI, I have seen games that are running in internet explorer, such as World of Warcraft. I plan to write a simple 3D navigation game that a character can walk around in a town. Anybody know what kind of programming tools I should use?(NOT art authoring tool). Flash? or use C++? if I write the game in C++, is there any magic interface library that run my game in internet explorer? Thanks very much,

Flash

23 February 2006 - 02:25 PM

Anybody know if there are free flash libraries that we can use to create front end UIs? thanks,

car racing

20 July 2005 - 07:00 PM

Hi, Gurus: I am planning to develop a mini game which will look like Need of speed. Basically, I am good at 3D math, kinematics/dynamics, collision detection. I have access to 3DS max. I am wondering how I should build the roads? which tools to use? thanks very much,

PARTNERS