directx

How to query GPU Usage in DirectX?

旧城冷巷雨未停 提交于 2019-11-30 05:30:12
问题 How to query GPU Usage in DirectX? Specifically DirectX 11. If someone ever did it, could you provide me the code snippet? 回答1: Process Hakcer is able to do this. See here: http://processhacker.svn.sourceforge.net/viewvc/processhacker/2.x/trunk/plugins/ExtendedTools/gpumon.c?revision=4927&view=markup A similar question has been asked here: How do you calculate the load on a nvidia (cuda capable), gpu card? 来源: https://stackoverflow.com/questions/16376218/how-to-query-gpu-usage-in-directx

The desktop capture with DirectX does not work

馋奶兔 提交于 2019-11-30 05:26:09
问题 Because processing was slow by D3DPOOL_SCRATCH, I wrote the desktop capture program to reference for the report on the Internet. However, a result is a pitch-black picture. Is this the result of a console program or is there any other cause? #include <stdio.h> #include <Windows.h> #include <d3d9.h> void main() { CoInitialize(NULL); LPDIRECT3D9 d3d9; LPDIRECT3DDEVICE9 d3ddev; d3d9 = Direct3DCreate9(D3D_SDK_VERSION); int ww = GetSystemMetrics(SM_CXSCREEN); int wh = GetSystemMetrics(SM_CYSCREEN)

Drawing 3D lines in WPF

删除回忆录丶 提交于 2019-11-30 05:17:58
I am working on a CAD application and thinking of using WPF for rendering my entities. But it seems like WPF doesnt support drawing 3D lines. Is there any ways for drawing 3D lines in WPF? I dont like to create a mesh for each line entity I need to draw as I am afraid, this would cause a major performance hitch for me as I would have to create number of line entities in my application. If this is not possible through WPF, will it be possible to do this in DriectX 9 or 10? Can I mix directX in WPF? I mean some way of interops? Many Thanks, WPF does do 3D, and it does it well . You'll need to

3D in WinForms?

我与影子孤独终老i 提交于 2019-11-30 05:11:21
问题 How can i use 3D view inside WinForms? Should i use XNA ? I found this tutorial: http://create.msdn.com/en-US/education/catalog/sample/winforms_series_1 But i dont understand how can i add just ContentLibrary and Content to my WinForms project. Or is it possbile to use Scaleform GFx ? for Half2D or 3D ? 回答1: Use WPF. You can mix and match the forms. WPF has a winforms container you can drop in a window and make fill it. But you can use WPF out of the box fine with little education - tip =

What can cause D3D11CreateDevice() to fail with E_FAIL?

房东的猫 提交于 2019-11-30 04:41:17
问题 I'm invoking D3D11CreateDevice() with the following code: ID3D11Device* md3dDevice; ID3D11DeviceContext* md3dImmediateContext; D3D_DRIVER_TYPE md3dDriverType = D3D_DRIVER_TYPE_HARDWARE; createDeviceFlags = D3D11_CREATE_DEVICE_DEBUG; HRESULT hr = D3D11CreateDevice( 0, md3dDriverType, 0, createDeviceFlags, 0, 0, D3D11_SDK_VERSION, &md3dDevice, &featureLevel, &md3dImmediateContext); However, the result stored in HRESTUL hr is E_FAIL . The console has the following output: First-chance exception

How do I calculate pixel shader depth to render a circle drawn on a point sprite as a sphere that will intersect with other objects?

情到浓时终转凉″ 提交于 2019-11-30 03:24:14
I am writing a shader to render spheres on point sprites, by drawing shaded circles, and need to write a depth component as well as colour in order that spheres near each other will intersect correctly. I am using code similar to that written by Johna Holwerda : void PS_ShowDepth(VS_OUTPUT input, out float4 color: COLOR0,out float depth : DEPTH) { float dist = length (input.uv - float2 (0.5f, 0.5f)); //get the distance form the center of the point-sprite float alpha = saturate(sign (0.5f - dist)); sphereDepth = cos (dist * 3.14159) * sphereThickness * particleSize; //calculate how thick the

OpenGL/DirectX: How does Mipmapping improve performance?

混江龙づ霸主 提交于 2019-11-30 03:01:47
问题 I understand mipmapping pretty well. What I do not understand (on a hardware/driver level) is how mipmapping improves the performance of an application (at least this is often claimed). The driver does not know until the fragment shader is executed which mipmap level is going to be accessed, so anyway all mipmap levels need to be present in the VRAM, or am I wrong? What exactly is causing the performance improvement? 回答1: You are no doubt aware that each texel in the lower LODs of the mip

Faster method of reading screen pixel in Python than PIL?

不打扰是莪最后的温柔 提交于 2019-11-30 02:24:59
Currently I'm using a pixel reader via AutoItv3 to perform some actions in a program that is running direct X; A game. Right now the program works fine but as an exercise I've been rewriting it in python. Right now I can do: import ImageGrab # Part of PIL image = ImageGrab.grab() #Define an area to capture. rgb = image.getpixel((1, 90)) #What pixel do we want? And that grabs the pixel info I want just fine, but I'm doing this quite rapidly (needs to be done 3x a second or faster), but the result is that it majorly affects the framerate of this DirectX-based game. Is there a faster way in

Programmatically creating directx 11 textures, pros and cons of the three different methods

≯℡__Kan透↙ 提交于 2019-11-30 02:05:57
The msdn documentation explains that in directx 11 there are multiple ways to fill a directx 11 texture programmatically: (1) Create the texture with default usage texture and initialize it with data from memory (2) Create the texture with dynamic usage, use DeviceContext Map to get a pointer to texture memory, write to it, then use Unmap to indicate you are done (at which point I guess it is copied to the gpu) (3) Create the texture with staging usage and follow same steps as for dynamic texture, but follow that with a call to ID3D11DeviceContext.CopyResource to use this staging texture to in

SlimDX: Joystick.Poll() succeeds on disconnected gamepad

£可爱£侵袭症+ 提交于 2019-11-30 00:01:30
问题 I've got a curious problem with SlimDX: we've seen this on Windows 7, and haven't yet tested other versions: I'm using a bundle of cheap USB gamepads (no serial number), and sometimes one physical gamepad ends up providing the input to more than one Joystick object. The scenario is: Plug in gamepad 1 to hub slot 1. Pad appears in DirectInput.GetDevices as GUID f17b2d30. Create Joystick object for pad. Plug in gamepad 2 to hub slot 2. Pad appears in DirectInput.GetDevices as GUID 5187d2d0.