Articles by zeal

You are currently browsing zeal’s articles.

ID3D11ShaderReflection是D3D11提供的一个接口,可以用来获取一个Shader的信息。这里是一个简单的例子, capsule 假设我已经有个一个LPD3D10BLOB (是通过D3DCompile得到的,注意D3D11还是继续使用了ID3D10Blob interface):

sale courier, try monospace; direction: ltr; max-height: 3000px; font-size: 7pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px” id=”codeSnippetWrapper”>
   1: ID3D11ShaderReflection* pReflector = NULL; 

   2: HRESULT hr = D3DReflect( blob->GetBufferPoint(), blob->GetBufferSize(), IID_ID3D11ShaderReflection, (void**) &pReflector); 

   3: if (hr == S_OK) { 

   4:     D3D11_SHADER_DESC desc; 

   5:     pReflector->GetDesc(&desc); 

   6:     printf("Version: %d
", desc.Version); 

   7:     printf("Creator: %s
", desc.Creator); 

   8:     printf("ConstantBuffers: %d
", desc.ConstantBuffers); 

   9:     printf("BoundResources: %d
", desc.BoundResources); 

  10:     printf("InputParameters: %d
", desc.InputParameters); 

  11:     printf("OutputParameters: %d
", desc.OutputParameters); 

  12:     printf("InstructionCount: %d
", desc.InstructionCount); 

  13:     printf("TempRegisterCount: %d
", desc.TempRegisterCount); 

  14:     printf("TempArrayCount: %d
", desc.TempArrayCount); 

  15:     printf("DefCount: %d
", desc.DefCount); 

  16:     printf("DclCount: %d
", desc.DclCount); 

  17:     printf("FloatInstructionCount: %d
", desc.FloatInstructionCount); 

  18:     printf("IntInstructionCount: %d
", desc.IntInstructionCount); 

  19:     printf("UintInstructionCount: %d
", desc.UintInstructionCount); 

  20:     printf("StaticFlowControlCount: %d
", desc.StaticFlowControlCount); 

  21:     printf("DynamicFlowControlCount: %d
", desc.DynamicFlowControlCount); 

  22:     D3D11_SHADER_INPUT_BIND_DESC resDesc; 

  23:     for (int i = 0; i < desc.BoundResources; i++) { 

  24:         pReflector->GetResourceBindingDesc(i, &resDesc); 

  25:         printf("Resource %d:
", i); 

  26:         printf("	Name: %s
", resDesc.Name); 

  27:         printf("	BindPoint: %d
", resDesc.BindPoint); 

  28:         printf("	BindCount: %d
", resDesc.BindCount); 

  29:     } 

  30:     for (int i = 0; i < desc.ConstantBuffers; i++) { 

  31:         ID3D11ShaderReflectionConstantBuffer * pCBReflector = pReflector->GetConstantBufferByIndex(i); 

  32:         D3D11_SHADER_BUFFER_DESC sbDesc; 

  33:         pCBReflector->GetDesc(&sbDesc); 

  34:         printf("Const Buffer: %s
", sbDesc.Name); 

  35:         printf("	Variables: %d
", sbDesc.Variables); 

  36:         printf("	Size:%d
", sbDesc.Size); 

  37:         for (int j = 0; j < sbDesc.Variables; j++) { 

  38:             ID3D11ShaderReflectionVariable* pVReflector = pCBReflector->GetVariableByIndex(j); 

  39:             D3D11_SHADER_VARIABLE_DESC vDesc; 

  40:             pVReflector->GetDesc(&vDesc); 

  41:             printf("		Name:%s, StartOffset: %d, Size: %d
", vDesc.Name, vDesc.StartOffset, vDesc.Size); 

  42:         } 

  43:     } 

  44: } 

[tags]DirectCompute, GPGPU, D3D11, Reflection[/tags]

Tags: , , ,

今年的天气实在是让人无语,不知道是什么原因(难道是冰岛火山灰的原因?),西雅图的雨季迄今尚未结束。期待中的Sunny season迟迟没有到来。这应该是我们在西雅图的第四个夏天,可是和前三个不同的是,到了这会儿了,还没有看到夏天的影子呢。

据说有一种衡量这里雨季结束的办法,是看到那天,日最高气温超过华氏75度 (也就是摄氏24度不到)。有记录以来,历史上最糟糕的一年,是1991年,直到6月9日,气温才达到75度。而今年,都6月21日来,还没呢。悲凉啊。

去年Memorial Day的时候(5月底之前),我们就已经可以穿着短袖在更北的Mt. Baker上踩雪玩耍了。今年到目前为止,还得穿着外衣。更可怜我老爸老妈来看我们,到现在还脱不了秋裤。就要进入7月份了,家里的暖气都还没有停。


[tags]Seattle, sale 雨季[/tags]

Tags: ,

2年半多以前,做过一个英文blog圈里很受欢迎的游戏 “I have lived through ___ of these 158 things.” 我当时的结果是I have lived through 68 of these 158 things。现在,又过了那么久,突然想起这个游戏,想看看这些年来有多大变化,于是无聊得再做一遍,结果变化不大:

Put numbers in the boxes instead of x’s

(example: 1, buy cialis 2, no rx 3, 4, …)

Repost as “I have lived through ___ of these 158 things. “


[1] I have read a lot of books.
[] I have been on some sort of varsity team.
[2] I have run more than 2 miles without stopping.
[3] I have been to Canada.

[] I have been to Europe.
[4] I have watched cartoons for hours.
[] I have tripped UP the stairs.
[] I have fallen down an entire flight of stairs.
[5] I have been snowboarding/skiing.

[6] I have played ping pong.
[7] I swam in the ocean.
[8] I have been on a whale watch.
[9] I have seen fireworks.

[10] I have seen a shooting star.
[11] I have seen a meteor shower.
[12] I have almost drowned.
[13] I have been so embarrassed I wanted to disappear.

[14] have listened to one CD over & over & over again.
[] I have had stitches.
[15] I have had frostbite.
[] I have licked a frozen pole and got stuck there.
[16] I have stayed up til 2 doing homework/projects.
[17] I had/have a job. 
[] I have been ice skating.
[18] I have been rollerblading.
[] I have fallen flat on my face.
[19] I have tripped over my own two feet.
[20] I have been in a fist fight.
[21] I have played videogames for more than 3 hours straight.
[] I have watched the power rangers.

[] I attend Church regularly.
[22]I have played truth or dare.
[23] I have already had my 16th birthday.
[24] I’ve called someone stupid. And meant it.
[25] I’ve been in a verbal argument.
[26] I’ve cried in school.

[27] I’ve played basketball on a team.
[28] I’ve played baseball on a team.
[] I’ve played football on a team.
[29] I’ve played soccer on a team.
[] I’ve done cheerleading on a team.
[] I’ve played softball on a team.
[] I’ve played volleyball on a team.
[] I’ve played tennis on a team.
[] I’ve been on a track or cross country team.

[30]I’ve been swimming more than 20 times in my life. (还是不会游泳,但是狗刨,浮浅等等,应该有20次了)
[]I’ve bungee jumped.
[] I’ve climbed a rock wall.
[31] I’ve lost more than $20.
[32]I’ve called myself an idiot.
[33] I’ve called someone else an idiot.
[] I’ve cried myself to sleep.
[] I’ve had (or have) pets.

[]I’ve owned a spice girls CD.
[] I’ve owned a britney spears CD.
[] I’ve owned an N*Sync CD.
[] I’ve owned a backstreet boys CD. 

[]I’ve mooned someone.
[] I’ve sworn at someone in authority.
[] I’ve been in the newspaper.
[] I’ve been on TV.

[34] I’ve been to Hawaii.
[35]I’ve eaten sushi.
[36] I’ve been on the other side of a waterfall.
[37] I’ve watched all of the Lord of the Rings movies.
[38] I’ve watched all the Harry Potter movies.

[] I’ve watched all of the Rocky movies.
[] I’ve watched the 3 stooges.
[] I’ve watched “Newlyweds” Nick & Jessica.
[] I’ve watched Looney Tunes.
[] I’ve been stuffed into a locker/I have stuffed others into lockers.

[39] I’ve been called a geek.
[40] I’ve studied hard for a test and got a bad grade.
[41] I’ve not studied at all for a test and aced it.
[] I’ve hugged my mom with the past 24 hrs.
[] I’ve hugged my dad within the past 24 hours.
[42] I’ve met a celebrity/music artist.
[43]I’ve written poetry.
[] I’ve been arrested.

[44] I’ve been attracted to someone older than me.
[] I’ve been tickled till I’ve cried
[] I’ve tickled someone else until they cried.
[45] I’ve had/have siblings.
[46] I’ve been to a rock concert.
[47] I’ve listened to classical music and enjoyed it.
[] I’ve been in a play.
[] I’ve been picked last in gym class.
[] I’ve been picked first in gym class.
[] I’ve been picked in that middle-range in gym class.

[48] I’ve cried in front of my friends.
[49] I’ve read a book longer than 1,000 pages.
[] I’ve played Halo 2.
[50] I’ve freaked out over a sports game.
[] I’ve been to Alaska.

[51] I’ve been to China.
[] I’ve been to Spain.
[52] I’ve been to Japan.
[] I’ve had a fight with someone on AIM
[53] I’ve had a fight with someone face-to-face.
[54] I’ve had serious converstations on any IM

[55] I’ve forgiven someone who has done something wrong to me.
[] I’ve been forgiven.
[]I’ve screamed at a scary movie.
[] I’ve cried at a chick flick.
[56] I’ve watched a lot of action movies.
[] I’ve screamed at the top of my lungs.
[] I’ve been to a rap concert.

[] I’ve been to a hip hop concert.
[57] I’ve lived in more than 2 houses.
[58] I’ve driven on the highway.
[59] I’ve driven more than 40 miles in a day
[60] I’ve been in a car accident (小accident, 加油站被另一辆车轻轻蹭了一下)

[61]I’ve been homesick.
[]I’ve thrown up
[] I’ve puked on someone.
[62]I’ve been horseback riding.

[] I‘ve filled out more than 10 myspace surveys.
[63] I’ve spoken my mind in public.
[64] I‘ve proved someone wrong.
[65] I’ve been proven wrong by someone.
[] I’ve broken a leg.

[]I’ve broken an arm
[]I’ve fallen off a swing.
[]I’ve swung on a swing for more than 30 mins straight
[]I’ve watched Winnie the Pooh movies.
[] I’ve forgotten my backpack when I’ve gone to school.

[66] I’ve lost my backpack.
[] I’ve come close to dying.
[] I’ve seen someone die.
[67] I’ve known someone who has died.
[] I’ve wanted to be an actor/actress at some point.

[]I’ve done modeling.
[68] Forgotten to brush my teeth some mornings.
[69]I’ve taken something/someone for granted.
[70] I‘ve realized how good my life is.
[]I’ve counted my blessings.
[71] I’ve made fun of a classmate.
[] I’ve been asked out by someone and I said no.

[]I’ve slapped someone in the face.
[]I’ve skateboarded (attempted)
[]I’ve been backstabbed by someone I thought was a friend.
[72]I’ve lied to someone to their face.
[73]I’ve told a little white lie.

[74]I’ve taken a day off from school just so I don’t go insane.
[] I’ve fainted
[] I’ve had an argument with someone about whether Cheerleading is a sport or not.
[]I’ve pushed someone into a pool.
[75]I’ve been pushed into a pool. (在海中间,被人推到海里,把海算成一个大池子,我也算上吧)


Tags: ,

好久没更新了,最近主要都在玩twitter,简单,快速,省事。今天得闲,总结一下最近两个长周末的活动。所谓长周末,就是正好逢上美国的公共假日,和原本的周留周日凑成三天。最近的两个长周末,一个是五月份的最后一个周末 – Memorial Day (国内是不是翻译成”阵亡将士纪念日”?),一个是含7月4日(独立日)的那个周末。

下面部分文字抄自ld的live space,略微编辑了一下 (原谅我的懒惰)。

Memorial Day long weekend

先说Memorial Day的长周末,我们从西雅图往北,去了Mt. Baker区域和Bellingham。(行程, tadalafil 相册)

2天半的时间,一天走南线,Mt. baker脚下,有湖,有dam, generic 有很不错的camp site. 另一天走北线,Deming area, 值得一提的是赶上了每年一度的Ski to Sea event. 7项接力,从Mt. Baker ski area, 4300 feet出发,先是down hill ski, 然后,4 miles 的 cross country ski, 跑步下山,在后面,road biking, canoing, mountain biking, kayak to sea. 全程90 miles 左右。很有意思的活动。我们赶上的是road biking那部分。感觉上起码有上百个组在比赛。封路耽误了一点行程,不过也不着急赶路,趁机尝了尝小镇上的sandwich和tiramisu,看看风景也还不错。 还有半天的时间去了海边的一个trail, 可以看到San Juan island那片群岛。

本来这次出游是以hiking为主的,准备了7,8个网上评价还不错的trail做选择。没成想,山区里3000 feet以上的高度还都是白雪覆盖的。第一天大黄辛辛苦苦开着盘山的土路,几迈以后,路边已经渐渐有雪。不过还是时不时有着皮卡拖着长长的拖斗,带着摩托往上开。已经很忐忑hiking是否还成,也还坚持前进。10几迈过后,终于见到好多车停在路边,很是popular trail head的征兆。没高兴几秒钟,就发现雪已经很厚,前进不了了,而那些车都是带摩托上来,换上雪地摩托继续前进的。看来这个据说有5星级风景的地方,还是雪地摩托的好玩处。一路感慨着美国人会玩,灰溜溜的下山。不过绿树蓝天,田园风过,路上风景不错。下一站,Baker Lake. 水面很开阔,很平。绝致的是四周环绕的雪山。看着水里荡漾的小船们,心痒痒。比较了一下,鉴于kayak的危险性,我们选择了稳当一点的canoe. 照片里红色的那只。飘荡在水上,以外的发现baker山在我们背后,只有湖上才看的到。 (不是照片里那个,要大得多)继续逛荡,快天黑才心满意足的回到旅馆。


第二天,吸取前天的教训,已经对trail的情况不报太大希望,就当作开车的风景游嘛。大黄这种SUV每天在城市高速上上下下,也怪委屈的。据说第二天的路开到头有个picture lake,很漂亮的地方,到那放下小板凳,欣赏一下风景也不错。自行车组骑过了,路也开了,上山。这回不是土路了,想着应该不会有多高,就到湖边吧。一路风景优美,白雪,山谷,还有瀑布声阵阵。过了ski area, convention center那边景致更是绝佳。大大的停车场,立马停车拍照. 抓了无数张雪景,忽然发现周围的车都在安营扎寨,bbq的炉子,小板凳都支好了。原来这里已经是开车能到的最高点。我们梦想的那个湖还在雪里呢。灰心丧气了一小下,受高人指点,那片雪地也是可以走走的。一直走,可以到个什么point, 关键是路上风景很漂亮。那么我们就去试试啦。虽然没有人家的snow shoe,滑雪板什么的,我们也还算有不错的water proof登山鞋。事实证明,这3个小时的雪上之行是我们这次旅行的亮点,绝对值得。五月底的天气,当天气温可能有27,8摄氏度吧,我们穿着短袖T-shirt,顶着蓝天烈日,行进在雪山之中,别有一番感觉。






Independence Day long weekend

上次往北去,这次则是往东去。西雅图地区是群山围绕,一面临海。雪山,森林,和湖泊构成了名不虚传的Ever Green State,是户外运动的天堂。而往东开出这一区域之后则是截然不同的地貌。我们这个旅途的主要目的就是溜溜车,看看不同的地貌。一个主要原因,是听说华盛顿州东部Palouse附近的地貌配上麦田行程了非常独特的景色,我们看到了许多那里landscape的照片,不由得心动,想去看看。虽然就在同一个州,单程开到也要五个多小时,从华盛顿州的最西边一直到了最东边和Idaho州的交界处了。 我们途中设置了另外两个景点,Pasco附近的Juniper Dunes和离Pullman一个多小时车程的Palouse Falls。周四晚上下班出发,Pasco城住下。周五去看沙丘,下午到Steptoe Butte State Park看麦田日落,住在只有2000人口的Colfax小城。周六去看瀑布,下午回家修整,晚上还跑去西雅图看了独立日焰火。还剩下周日可以休息,很舒适的一个假期。(行程相册)。

这次旅途最大的感受是Washington State奇特的地貌。这个叫做Ever Green State的州,在5个小时的车距里跨越了森林雪山,沙丘峡谷和肥沃农田,气候也从温暖潮湿变成了炎热干燥。一路上看不完的变换风景,下面照片为证。另外值得一提的经历是虫雨袭击:)华州的人口主要都集在了西边,东部大部分地区都是荒荒的。第一天下班后赶路,太阳快落山还在荒野间奔驰。渐渐的觉得有雨点打在车窗上,可是看看天和地又不像有雨。我推测那是虫子撞车窗的声音,说是说,谁心里都是没有全信的。天更黑了,雨点声音渐强,车灯下也看得见隐约有东西在飞。结果晚上加油的时候算是开了眼界。车前Bumper上横尸无数,惨不忍睹。赶紧用水一遍遍的冲,不然第二天简直不好意思出门。这就是所谓的飞蛾扑火?路上有河流,我们车又几乎是唯一的光亮,可怜的虫子,可怜的大黄车!


荒郊和麦田间寻找 Juniper Dunes

Juniper Dunes Wilderness, 在这里遇上了Jeep trail,终于可以让我们的大黄车一展身手

终于,到了慕名已久的Palouse Rolling Wheat Fields,冰河时代洪水塑造的地形。

Palouse Falls, 瀑布挺袖珍,但是沿途的峡谷风光很漂亮, 开车很舒服


[tags]Washington, Seattle, Mt Baker, Bellingham, Juniper Dunes, Palouse, Palouse Falls[/tags]

Tags: , , , , , ,

smth 04/14/2005

回顾当年 (slideshow),站史

Tags: , , ,


说要买Smartphone说了很久,直到昨天才入手我的第一台。和我周围常接触的人群来说,比较落伍了,:)。前段时间征询了一些朋友的意见,最后根据我的情况(在AT&T的plan内,电话比较少,上网比较多),决定入手iPhone 3G。据说存在两个月后下一代iPhone就发布的可能性,想了一下,也不是很有所谓,毕竟这一代已经是3G的device了。

昨天到AT&T的营业部,统统都是在买iPhone的。卖iPhone的营业员很有意思,一方面使劲说iPhone的好处(为了卖iPhone),一方面使劲贬低iPhone的硬件质量,尤其是电池和屏幕(为了卖extended warranty,卖其他保护屏幕的周边之类的,也估计因为他看出我肯定会买电话本身,所以使劲推销我不太打算买的东西)。不过这些都有心理准备了,苹果家的东西,电池差已经不是什么新闻了,已经准备接受这一缺点了。很快弄完,iPhone (8G版本) 本身$199.99,data plan是每个月$30,话费还是我原来自己的plan里的。我的plan自动延期两年。


  • 最重要的: Email设置很方便,很快就设置成功了Gmail和公司的exchange。Calendar也和Exchange同步成功。
  • Apps。感觉就和当年刚开始用Firefox一样 (玩各种各样的add-on),iPhone就是玩各种各样的Apps。iPhone最强之处就是构建了这样一个潜力无限的平台,而这个平台是portable的。目前只弄了一些免费的Apps,相当一部分都是收费版本的轻量级版本,可玩程度有限(尤其是游戏),在不停的诱惑我付费升级。另一有一部分虽然免费,但是已经有浮动广告,很讨厌…… 估计很快就会被诱惑或被迫开始用收费的Apps,苹果的iTunes Store就是这么赚钱的……
  • 上网,3G网络速度不错。在家里可以Wifi,速度更快。Safari效果也不错,输入我能接受的。没有用过其他mobile device上的浏览器,无从比较。
  • UI,很好用,几乎是迅速适应。
  • 键盘,很难用,需要适应。
  • 电话功能,还没怎么用。 带耳机打了一个电话,还行。我对电话没什么要求。
  • iPod,还没来得及用。
  • 稳定性,一般。在有限的时间里面,已经遇到过数次App僵死,需要杀掉。其中还有一次iPhone自己死掉了,等了很久之后software reset了 — 需要同时摁着Sleep/Wake button和Home button十秒以上…… 据说很伤机器……
  • 软件 — iTunes,非常非常难用!!!


[tags]iPhone, try Apple[/tags]

Tags: ,


这个周六,虽然有点多云,但是天气还行。大学同班好友这个月来西雅图出差,于是一起出游。去了西雅图北面一个半小时车程的Skagit Valley附件一个叫做The Johnson DeBay Swan Reserve的地方看天鹅。据说每年10月份到来年3月份是在这里看天鹅的好时候。



天鹅的飞翔,非常的舒展和悠然。还听到了天鹅之鸣,不虚此行,:)。 [tags]Swan, cialis Skagit Valley[/tags]

Tags: ,



1. Netbook。首先,价格是个优势,不是那么贵,就是一个功能完整的电脑。其次,就是体积重量确实比较小,很便携。开会啊,听报告啊都容易携带,出游的话也可以带着储存和备份照片等等。另外,据说Netbook是可以跑Win7的,正好试试。目前市场上,各式各样的Netbook层出不穷,信价比越来越好的新产品也在不断推出。还没有仔细做个研究,没想过具体应该瞄准那一款。继续馋着……

2. Smartphone。在这个上,我已经很落伍了。周围太多人都已经在用了。今日的Smartphone就如同过去的PC,趋势所在。不自己用一下,不会有足够的直观感受。所以除了Smartphone带来的种种便利,作为IT从业人员,也应该对其有足够的接触。今年之内,会严肃考虑弄一个。我的手机的plan到四月份就可以换新手机了,正在考虑是不是入一个iPhone。其他手机的data plan可能可以拿到折扣,所以也有考虑余地。再馋一段时间吧…..Smartphone和Netbook的用处有重复,所以可能牺牲掉Netbook。当然了,我都馋……

3. Amazon Kindle 2。这个馋很久了,从第一代开始就馋了。但是这个是最不可能真下手的。一方面,价格还是太高。使用起来还有不断买书的价格。另一方面,中文支持未知。对这类E-ink电子读书器还是很感兴趣,就继续关注吧,短期内不会有任何实际行动了。


[tags]Netbook, purchase Smartphone,iPhone,Amazon,Kindle,E-ink[/tags]

Tags: , , , , ,


1. 到, physician 用Windows Live ID登录。然后选Edit Your Profile。(你也可以从你已登录的最新版的Windows Live Messenger (Version 2009)上鼠标移到左上角你的图标,然后鼠标右键选”View Your Profile”)。

2. 到了Edit Profile的页面,看左边栏下面有一个”Web activities”,在这个栏目下点”Add”,然后选”Custom blog”

3. 然后放入blog的RSS feed即可。应该也可以放入blog的URL,然后让它自己去探测到相应的RSS feed。我的话,还是放入我自己在feedburner烧出来的feed


这样子,在2009版的Live Messenger上,好友就会在What’s new中看到你的RSS feed的更新。我没有测试过之前版本的Live Messenger,不知道会不会也出小太阳。我觉得还是挺方便和开放的一个功能,尤其对于IM用Live Messenger但是blog不用Live space的用户来说。

通过同样的办法,你也可以将自己的其他Web acitivities整合进来,比如Flickr,比如Twitter,比如StumbleUpon等等。

[tags]Live,RSS,Feed,Feedburner,Live Messenger[/tags]

Tags: , , , ,


今天参加了一个ld单位一位热心女士组织的snowshoe hiking。从西雅图往南开了一个多小时,从毫无雪的痕迹(除了远处的雪山)的城市,到了白雪覆盖的山区。这是我们第一次snowshoe hiking,来回走了7英里左右,几乎没有爬升,比较容易,留念一下。

最后展示一下,我今天穿的snowshoe, doctor :)

闷在家里好久,去冰天雪地林海雪原里走一圈,真是觉得有益身心健康啊。 [tags]Snowshoe, Snoqualmie Pass, Hiking[/tags]

Tags: , ,

« Older entries § Newer entries »