|
Kel_ wrote: what is actually faster, wrap Direct3D with Managed C++ or in C# using standard C#
In theory, both compile to IL so there is no difference.
In practise, the compilers may produce slightly differing output.
The only way to know for certain would be to run some tests. I suspect there is no best answer for all cases, one way will be better in some circumstances, the other in different circumstances.
Simon
|
|
|
|
|
The .NET devs said that the speed difference between native DirectX and Managed DirectX was about 6%, so I suspect the difference between a managed wrapper in C++/CLI and C# won't be very large.
But as Simon said, only tests will show. But this can be a tedious task, since you have to create two wrappers with the same functionality.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thank you for the answers.
Yeah, so basically I think I'm just going to wrap the whole DirectX in C# and then test it against the managed C++ implementation.
Think it will worth a good codeproject article
-- Everything is possible, even the impossible! ^_^
|
|
|
|
|
You may also want to take a look at SlimDX - an open source wrapper intended as a replacement for Managed DirectX.
While C# is capable enough with unsafe code and interop, I'd suggest using C++/CLI if you are comfortable with it. Downside is of course more complexity.
|
|
|
|
|
Thanks again.
So basically I started the C# Wrapper to be able to compare it, after a few days and going to battle vs COM objets and performant InterOp, I finally managed to wrap a part of it.
For now I'm doing just the D3DDevice creation and a simple window clear.
I compared the exactly same function calls with Managed DirectX 1.1 ones (actually everything is the same, I compared every method parameter and call with PIX debugger).
So creating D3D factory, creating a device and showing.
(Just a first draft)
DirectX.Device.Clear(0, null, ClearFlags.D3DCLEAR_TARGET | ClearFlags.D3DCLEAR_ZBUFFER, 0, 1, 0);
DirectX.Device.BeginScene();
DirectX.Device.EndScene();
DirectX.Device.Present(null, null, IntPtr.Zero, null);
And guess what, the performance are almost exactly the same between MDX and my C# Wrapper.
I'm getting around 2180 FPS with both of them.
I still would like to check IL code generated for both.
-- Everything is possible, even the impossible! ^_^
|
|
|
|
|
hi, i m new to crystal reports.
can any one tell that
is it possible to diplay data in crystal reports on the basis of checkbox selection?
columns which i want to display in report should be displayed if that column name is checked in checkbox.Even displaying data from more than one table.
i m working in WinForms based application
|
|
|
|
|
Hi,
My win form application is using the following code to get the version number which is retrieved from the clickonce version.
This seems to work only when the application is installed on users machines.
if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed) //is this a clickonce application
{
//get he publish version...
_strVersion = System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();
this.Text = this.Text + " - " + _strVersion;
}
Question:
Do you know why I do not get the version number using the above code when this is used on my Dev machine where I am developing the application?
Thanks
|
|
|
|
|
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
|
Hi Friends,
I am working on access card . Its working fine. It reading when i am clicking on button. I have written the code in the button click only. I dont know in which event it reads automatically. Please tell me that in which event it will read when i touch the access card to the controller.
I want the event only. Please let me know asap.
Its RS232 micro controller.
Thanks in advance,
Vinod gupta
modified on Wednesday, July 30, 2008 8:34 AM
|
|
|
|
|
Which interface do you use ?
I was working in a barcode scanner using RS232, it's using SerialPort Class.
In that class, I can use event "DataReceived" to detect a new barcode.
|
|
|
|
|
Thanks alot for replying.
Ya its RS232 micro controller. I am not getting that in which event it will read the data when i touch the access card to the microcontroller.
Please help me out.
Thanks...
|
|
|
|
|
If you're using the SerialPort then remember to set the ReceivedBytesThreshold low enough to generate the event.
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
Hi,
I have a datatable ParentTable that contains 100 records
I created a Dataview that selects only UK users
Dataview dvUK=ParentTable.DefaultView();
dvUK..RowFilter= "Country='UK'";
now in my dataiview dvUK have 30 records
I want to copy all these 30 records to some other table(dtChildUK) that have same structures as the ParentTable
DataTable dtChildUK=ParentTable.Clone();
How to copy all the 30 rows ( rows from dataview) to dtChildUK
|
|
|
|
|
Try this after applying the filter to the DataView:
<br />
foreach (DataRowView rowView in dvUK)<br />
{<br />
dtChildUK.Rows.Add(rowView.Row);<br />
}<br />
Fernando Mendes
Senior .NET Developer, Architect
|
|
|
|
|
|
Hello
You can use only this method of dv:
DataTable dtChildUK=dvUK.ToTable();
Simple and efficient.
Be Happy
Syed Shahid Hussain
|
|
|
|
|
Hey all,
I'm just trying to figure out why this bubble sort algorithm is ignoring the last element of the array.
namespace Bubble_sort
{
class SortArray
{
void BubblesortArray(int[] array)
{
int Position = 0;
int endpos = 0;
bool swapped = true;
while (swapped)
{
swapped = false;
Position = 0;
endpos = array.Length;
while (Position < endpos)
{
if (array[Position] > array[Position + 1])
{
int Temp = array[Position];
array[Position] = array[Position + 1];
array[Position + 1] = Temp;
swapped = true;
}
Position++;
endpos--;
}
for (int i = 0; i < array.Length; i++)
{
Console.Write(array[i].ToString() + ", ");
}
Console.WriteLine();
}
}
public static void Main(string[] args)
{
SortArray Sort = new SortArray();
int[] a = {1, 2, 3, 4, 1, 45, 134, 762, 2};
Sort.BubblesortArray(a);
for (int i = 0; i < a.Length; i++)
{
Console.Write(a[i].ToString() + ", ");
}
Console.Read();
}
}
}
thats the code (its a console app).
I do this out of curiosity, and annoyance( ) but i would like any help you could offer me.
Thankyou.
|
|
|
|
|
I'm hesitant to just give you the answer because this is a classic homework problem. Instead I'll give you some hints. (You'll feel better if you solve it yourself anyway)
Start by attaching a debugger and stepping through the code in the bubble sort routine line by line.
Each pass of a bubble sort should compare each adjacent pair of values. This routine doesn't. Look closely at the indexes you are using to the array being sorted. (Put watches on the values)
Simon
|
|
|
|
|
Thankyou for your help, simon. I suppose it does look like a homework problem my apologies for making it so. But the only reason I asked this is the site where I got it from has it written in a similar way i was just trying to figure out why the program didnt work.
Again my apologies.
|
|
|
|
|
No need to apologise. It's not your fault, it's a common question.
Did you manage to figure it out?
Simon
|
|
|
|
|
Yes I did thank you Simon. The step through debugger in VS took a little while to get used to but eventually it worked a treat. And i figured it out.
So, as always, logic prevailed over the human condition.
|
|
|
|
|
Hi,
i want to sepearte and count the string
s="aacbbcccddehgvfdd"
i need the Outputlike,
aa
bb
dd
dd
Count =4.
My question is : how will i get the out like the above
Please answer any one
|
|
|
|
|
What are you counting? Pairs of letters?
Just loop through the string, searching for pairs and keeping count.
Simon
|
|
|
|
|
Simon Stevens wrote: What are you counting? Pairs of letters?
All of them, yes!
|
|
|
|