Modeller

Hi!

I have been trying to implement (or translate) BasicHLSL example from the sample bundle with Managed C++. Every thing is OK but I have encountered problems with effect SetValue method. It appears that integer and floating point numbers are creating problems for me because I get the following compiler error :

fatal error C1001: An internal error has occurred in the compiler. (compiler file 'msc1.cpp', line 1393)To work around this problem, try simplifying or changing the program near the locations listed above.

The code is exactly the same as the code from the example, but in Managed C++:

effect->SetValue("worldViewProjection", worldMatrix * cameraProduct);

effect->SetValue("worldMatrix", worldMatrix);

//effect->SetValue("appTime", (float)appTime); /// Error C1001

effect->SetValue("g_MaterialDiffuseColor", WhiteColor);

//effect->SetValue("g_nNumLights", NLights); /// Error C1001

As in the example, the variable appTime is double - casted down to float, and NLights is integer. Everything else seems to be OK because when I comment these two lines out, the code compiles and links. What is causing this problem Is it because I am using Managed C++

Thanks for any help : comment/advice/link/etc.

Regards,

M.



Re: Game Technologies: Graphics Problems setting parameters in HLSL effect

shade

First of personnaly I am not really sure what managed C++ is. But I will try to assist you any ways.

Try to look at the SetMatrix, SetTexture SetFloat, Set... interface of effects in the DirectX SDK.
(Yes that means to read in the SDK). Also it seems like you are parsing every parameter by value instead of per-reference. (Google on C++ parsing per value and per reference, and again that means learning by reading)





Re: Game Technologies: Graphics Problems setting parameters in HLSL effect

Modeller

To the person with nick "shade" :

First of all, I thank you very much for your post. However when I wrote that I appreciated any kind of help I meant "qualified help from compotent people"!

If you do not know what the subject is or you do not have any idea about it, I strongly recommend that you not post answers to the threads by suggesting some more readings. In the case of managed C++, you can find a number of books and articles where you can study how a programmer use value and reference passing. In this way, you do not waste other people's time by advising them googling something which people already know.

I cannot see any place in my code that I am getting error on every parameter I am using. I strongly recommend that you read my post once more to understand it. For your interest, you can find BaseEffect class in the help documentation where int and float overloads are described as such :

public:
void SetValue(
    EffectHandle^ parameter,
    float f
);

public:
void SetValue(
    EffectHandle^ parameter,
    int n
);

Just for a word of advice : these forums are meant to help the users. If you want to get cheap credit please find yourself something else to do instead of spamming the threads.

Regards,

M





Re: Game Technologies: Graphics Problems setting parameters in HLSL effect

Andreas Johansson

These forums are free and open to all to try to help others without being qualified for it. This also means that there is no guarantee that an answer will actually be helpful, relevant or even correct.

The reply from shade is relevant to the original question but as far as I know the compiler error you get is more related to the compiler than DX/XNA and you might get better help in the forum for C++ compiler issues.
http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=96&SiteID=1






Re: Game Technologies: Graphics Problems setting parameters in HLSL effect

Modeller

Andreas Johansson wrote:

These forums are free and open to all to try to help others without being qualified for it. This also means that there is no guarantee that an answer will actually be helpful, relevant or even correct.

The reply from shade is relevant to the original question but as far as I know the compiler error you get is more related to the compiler than DX/XNA and you might get better help in the forum for C++ compiler issues.
http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=96&SiteID=1

You see Andreas this is the biggest problem here. You help somebody if you have qualified knowledge about the subject. You divert them otherwise. When I need some medical help I go to a Doctor of Medicine, not to a cab driver even if he tries to help me with his sincerety and good intention. You are right that this is a compiler issue but not the C++ compiler as you mention. This is the question about the effect compiler that translates the c++ code into DX shader language. This question should be answered until know if Microsoft supports Dx with the Managed C++ and somebody knows about it.

It is also worth to mention here that there is clear subtlety about what the managed code is when considering DirectX. Until know C# and DX are being defined as the managed directx but the definition of the managed language includes also the managed c++ and vb, and the documentation, strangely enough, includes description of using DX with the other managed codes - just go to how to pages in Express Edition. My question above suggests otherwise!

If you have qualifications about DX with Managed C++ and shader language you are welcome to post an answer to my question, which might describe the exact nature of the problem or some approximation such that I can proceed. However, if you want just to chat, why don't you try some chat rooms on the net I suggest Google!

In the case of 3D graphics, I have already uninstalled the DirectX and I am going for OpenGL with .NET. The reason is very simple : when you look for documentation/samples/examples/free code about OpenGL you get articles of academic paper quality - not series for dummies - and there are at least 10 "QUALIFIED" developer sites for OpenGL on the net.

Those of you who are interested in implementing 3D graphics with "ANY" of .NET languages, try this link : http://www.taoframework.com/Home. It is for free. If you want to get a professional help - e.i it costs money - with your application using OpenGL and "ANY" of the .NET languages, try this one: http://www.devdept.com/eyeshot/

Take care guys. Good luck with your DirectX adventure!

M





Re: Game Technologies: Graphics Problems setting parameters in HLSL effect

shade

My comments are still relevant.

You do not seem to have grapsed the difference between managed C++ and C++, knowing your programming language of choice is a prerequisite unfortuantely many does not have.




Re: Game Technologies: Graphics Problems setting parameters in HLSL effect

Andreas Johansson

Modeller wrote:

If you have qualifications about DX with Managed C++ and shader language you are welcome to post an answer to my question, which might describe the exact nature of the problem or some approximation such that I can proceed. However, if you want just to chat, why don't you try some chat rooms on the net I suggest Google!

I am a MSDN forums community moderator and my only intention to respond to this thread was based on the abuse report you had left and not any desire to just chat.

I tried to explain the nature of these forums and why you can not demand any level of quality. I also found that the reply you got was relevant though you do not agree and it is your right. If you engage in a discussion with those that try to help you might find that you will work out the problem together rather in expecting a perfect answer to a question.

Something that would be helpful for others to help you would have been to include all relevant details about the failing calls, like how the variables are declared and if they get set to any values. Where is the call, how is the method declared, how is the class declared.