游戏开发论坛

 找回密码
 立即注册
搜索
查看: 9023|回复: 11

HLSL怎样DEBUG?我的是Visual Studio2008

[复制链接]

7

主题

26

帖子

26

积分

注册会员

Rank: 2

积分
26
发表于 2008-4-4 22:00:00 | 显示全部楼层 |阅读模式
小弟刚开始写HLSL

但HLSL仿佛只在Visual Studio 2003 可以Debug(有个Starts with Direct3D )

在2005和2008都不能设断点Debug,连高亮都不行。

SDK里面的PIX好像又不太好用,只能看一些Shader前后的顶点信息。

nVidia的FX Composer也装了,好像只能高亮,不能设断点


谁帮帮我啊!!!

7

主题

26

帖子

26

积分

注册会员

Rank: 2

积分
26
 楼主| 发表于 2008-4-5 10:50:00 | 显示全部楼层

Re:HLSL怎样DEBUG?我的是Visual Studio2008

各路大侠,知道的可以帮帮小弟吗???

31

主题

249

帖子

259

积分

中级会员

Rank: 3Rank: 3

积分
259
发表于 2008-4-5 12:24:00 | 显示全部楼层

Re:HLSL怎样DEBUG?我的是Visual Studio2008

DX SDK里面有个 PIX for Windows工具

7

主题

26

帖子

26

积分

注册会员

Rank: 2

积分
26
 楼主| 发表于 2008-4-5 13:58:00 | 显示全部楼层

Re:HLSL怎样DEBUG?我的是Visual Studio2008

PIX好像不太好用哦……
我查过很多网站了,到现在都没有找到好的在VS里面DEBUG的方法……

31

主题

249

帖子

259

积分

中级会员

Rank: 3Rank: 3

积分
259
发表于 2008-4-6 19:37:00 | 显示全部楼层

Re:HLSL怎样DEBUG?我的是Visual Studio2008

我用着感觉还不错,觉得比直接用VS2003调试方便。毕竟是充分考虑到了GPU的并行性。

VS8.0以上的你想用来直接调不太可能,因为根本就不支持

22

主题

309

帖子

353

积分

中级会员

Rank: 3Rank: 3

积分
353
QQ
发表于 2008-4-6 20:47:00 | 显示全部楼层

Re:HLSL怎样DEBUG?我的是Visual Studio2008

借地问一下..
我用PIX调试hlsl只能查看顶点数据,不能查看变量值,是哪儿出了问题?
hlsl的编译选项是D3DXSHADER_DEBUG

31

主题

249

帖子

259

积分

中级会员

Rank: 3Rank: 3

积分
259
发表于 2008-4-7 12:33:00 | 显示全部楼层

Re:HLSL怎样DEBUG?我的是Visual Studio2008

可能和 D3DXSHADER_SKIPOPTIMIZATION 有关。很久没弄了,很多都忘记掉了。

119

主题

1367

帖子

1393

积分

金牌会员

Rank: 6Rank: 6

积分
1393
发表于 2008-4-7 12:59:00 | 显示全部楼层

Re:HLSL怎样DEBUG?我的是Visual Studio2008

rendermonkey

7

主题

26

帖子

26

积分

注册会员

Rank: 2

积分
26
 楼主| 发表于 2008-4-12 15:10:00 | 显示全部楼层

Re:HLSL怎样DEBUG?我的是Visual Studio2008

再问一下,PIX调试时出现
“An Error occurred while preparing to debug the shader”
什么意思?
PIX可以直接调试effect(即既有VertexShader也有PixelShader)的吗?

7

主题

26

帖子

26

积分

注册会员

Rank: 2

积分
26
 楼主| 发表于 2008-4-12 15:18:00 | 显示全部楼层

Re:HLSL怎样DEBUG?我的是Visual Studio2008

哦,在GameDev找到PixDebug的方法了:

1. Open Pix for Windows and go to File->New Experiment
2. To the right of the Program path dialog box you’ll see a epsilon button (…). Click it and navigate the file browser to you C project’s output directory and select the output executable of the Direct3D program that you want to debug. You will return to the previous dialog.
3. In the lower area of the dialog you will see “What information do you want to gather?”. Select the 2nd option “A single-frame capture of Direct3D whenever F12 is pressed.
4. In the lower right of the dialog click the Start Experiment.
5. Your program will start and you will see a frame count in the upper left of the applications renderable area. Whenever you’re at the area that you want to debug press the F12 button. It will flash a notice under the frame count for a second saying that it has successfully captured frame data. You can now close you application.
6. When you’re application closes the Pix application loads the captured frame. In the lower right area of Pix you will see a Details window. In the Details window there will be three tabs (“Summary”, “Render” and “Mesh”) . Activate the “Render” tab.
7. A visible rendition of your projects screen will appear in the “Render” tab’s window. Position the mouse over a particular pixel you wish to debug and right-click with the mouse. This will bring up the context menu with a few options. Left-click on the option that says “Debug This Pixel”.
8. The “Debugger” Tab will then be added to the Details window. You can scroll down thru this window’s Pixel History and you will see different events for each pass of the video hardware. Within the different events you will see a few hyperlinks that say “Debug Vertex 0” or “Debug Pixel (405,231)”. As you can guess these correspond to debugging the vertex and pixel shader programs respectively. Left-clicking on a desired hyper-link will bring you to a debug window that allows you to debug the shaders.
9. In the shader debugger window there is a top bar that has icon buttons for stepping forward or backward etc. You can left-click on the blank area to the left of the debug window to set break points.
10. There is a lower pane within the Shader Debugger that displays register values. Use these to track values and such.

Good Luck and I hope this helps,
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-22 21:03

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表