DXLesson 1

今决定先看dx sample browser上的内容,毕竟好理解些。

Tutorial 0: Win32 Basics

1.setting up an empty window to prepare for Direct3D

基本上没看懂啥意思。。。。。。。。。待有空解读:

LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )??




Tutorial 1: Direct3D 11 Basics:


create three objects: a device, an immediate context, and a swap chain. The immediate context is a new object in Direct3D 11.

the immediate context is used by the application to perform rendering onto a buffer, and the devicecontains methods tocreate resources.

The swap chain is responsible for taking the buffer to which the device renders and displaying the content on the actual monitor screen. The swap chaincontains two or more buffers, mainly the front and the back.

The front bufferis what is beingpresented currently to the user. This buffer is read-only and cannot be modified. The back buffer is the render target to which the device will draw.Once it finishes the drawing operation, the swap chain will present the backbuffer by swapping the two buffers. The back buffer becomes the front buffer, and vice versa.

    DXGI_SWAP_CHAIN_DESC sd;   //describes the swap chain
    ZeroMemory( &sd, sizeof(sd) );
    sd.BufferCount = 1;
    sd.BufferDesc.Width = 640;
    sd.BufferDesc.Height = 480;
    sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    sd.BufferDesc.RefreshRate.Numerator = 60;
    sd.BufferDesc.RefreshRate.Denominator = 1;
    sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;//?什么意思? swapBuffer(back和front)  输出renderBuffer类型
    sd.OutputWindow = g_hWnd;//在g_hWnd这个window上
    sd.SampleDesc.Count = 1;//多重采样数 multi-Sampling Nums
    sd.SampleDesc.Quality = 0;//关闭multi-Sampling 
    sd.Windowed = TRUE;
    if( FAILED( D3D11CreateDeviceAndSwapChain( NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, featureLevels, numFeatureLevels,
                     D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, NULL, &g_pImmediateContext ) ) )
    {
        return FALSE;
    }



In Direct3D 10, the device object was used to perform both rendering and resource creation. In Direct3D 11, the immediate context is used by the application to perform rendering onto a buffer, and the device contains methods to create resources.//为什么会有这样的转变呢?有什么好处呢?

create a render target view,A render target view is a type of resource view in Direct3D 11.. A resource view allows a resource to be bound to the graphics pipeline at a specific stage.Think of resource views as typecast in C.  A chunk of raw memory in C can be cast to any data type.We can cast that chunk of memory to an array of integers, an array of floats, a structure, an array of structures, and so on. The raw memory itself is not very useful to us if we don't know its type. Direct3D 11 resource views act in a similar way. For instance, a 2D texture, analogous to the raw memory chunk, is the raw underlying resource. Once we have that resource we can create different resource views to bind that texture to different stages in the graphics pipeline with different formats: as a render target to which to render, as a depth stencil buffer that will receive depth information, or as a texture resource.

    // Create a render target view
    ID3D11Texture2D *pBackBuffer;//创建一个未定型的buffer,可以为renderView ,depth stencil buffer....as typecast in C
    if( FAILED( g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), (LPVOID*)&pBackBuffer ) ) )//bind the back buffer of our swap chain as a render target.. This enables Direct3D 11 to render onto it.
      
    hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, NULL, &g_pRenderTargetView );//device create resource  实例化此buffer为RenderTargetView
    pBackBuffer->Release();
    g_pImmediateContext->OMSetRenderTargets( 1, &g_pRenderTargetView, NULL );//to bind render target view to the pipeline. ensures the output that the pipeline renders gets  written to the back buffer.


小结:

1.   context:perform  rendering on the buffer....//context set在buffer上执行渲染

 g_pImmediateContext->OMSetRenderTargets   //to bind render target view to the pipeline.

  2.     device : create resources 

g_pd3dDevice->CreateRenderTargetView      
 g_pd3dDevice->ClearRenderTargetView( g_pRenderTargetView, ClearColor );


  3.  chain :  taking the buffer to which the device renders and displaying the content on the actual monitor screen

g_pSwapChain->GetBuffer //to get the back buffer object.负责前后buffer的交换
 g_pSwapChain->Present( 0, 0 );//Present() is responsible for displaying the swap chain's back buffer content onto the screen 

Tutorial 2: Rendering a Triangle

the application must specify a buffer size in bytes when creating a buffer resource.

how many bytes does each vertex need? To answer that question requires an understanding of vertex layout.

More often than not(通常,多半)

Vertex layout defines how these attributes lie in memory: whatdata type each attribute uses, whatsizeeach attribute has, and the order of the attributes in memory.

when we feed the GPU the vertex buffer containing our vertices, we are just feeding it a chunk of memory. The GPU must also know about the vertex layout in order to extract correct attributes out from the buffer.

(当推送含有vertex属性的buffer给GPU时,我们仅是给GPU一块内存,GPU通过vertex layout来明确vertexBuffer的属性结构)。

HRESULT??

// Compile the shader

CompileShaderFromFile(WCHAR* szFileName,LPCSTR szEntryPoint,LPCSTR szShaderModel,ID3DBlob **ppBlobOut)

文件名,shader的入口点(是vertexShader还是pixelShader),shaderModel 4.0 3.0.... ID3DBlob(翻译是 二进制大物件....)应该是说把shader编译成二进制形式,ppBlobOut用于地址索引?









  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
东南亚位于我国倡导推进的“一带一路”海陆交汇地带,作为当今全球发展最为迅速的地区之一,近年来区域内生产总值实现了显著且稳定的增长。根据东盟主要经济体公布的最新数据,印度尼西亚2023年国内生产总值(GDP)增长5.05%;越南2023年经济增长5.05%;马来西亚2023年经济增速为3.7%;泰国2023年经济增长1.9%;新加坡2023年经济增长1.1%;柬埔寨2023年经济增速预计为5.6%。 东盟国家在“一带一路”沿线国家中的总体GDP经济规模、贸易总额与国外直接投资均为最大,因此有着举足轻重的地位和作用。当前,东盟与中国已互相成为双方最大的交易伙伴。中国-东盟贸易总额已从2013年的443亿元增长至 2023年合计超逾6.4万亿元,占中国外贸总值的15.4%。在过去20余年中,东盟国家不断在全球多变的格局里面临挑战并寻求机遇。2023东盟国家主要经济体受到国内消费、国外投资、货币政策、旅游业复苏、和大宗商品出口价企稳等方面的提振,经济显现出稳步增长态势和强韧性的潜能。 本调研报告旨在深度挖掘东南亚市场的增长潜力与发展机会,分析东南亚市场竞争态势、销售模式、客户偏好、整体市场营商环境,为国内企业出海开展业务提供客观参考意见。 本文核心内容: 市场空间:全球行业市场空间、东南亚市场发展空间。 竞争态势:全球份额,东南亚市场企业份额。 销售模式:东南亚市场销售模式、本地代理商 客户情况:东南亚本地客户及偏好分析 营商环境:东南亚营商环境分析 本文纳入的企业包括国外及印尼本土企业,以及相关上下游企业等,部分名单 QYResearch是全球知名的大型咨询公司,行业涵盖各高科技行业产业链细分市场,横跨如半导体产业链(半导体设备及零部件、半导体材料、集成电路、制造、封测、分立器件、传感器、光电器件)、光伏产业链(设备、硅料/硅片、电池片、组件、辅料支架、逆变器、电站终端)、新能源汽车产业链(动力电池及材料、电驱电控、汽车半导体/电子、整车、充电桩)、通信产业链(通信系统设备、终端设备、电子元器件、射频前端、光模块、4G/5G/6G、宽带、IoT、数字经济、AI)、先进材料产业链(金属材料、高分子材料、陶瓷材料、纳米材料等)、机械制造产业链(数控机床、工程机械、电气机械、3C自动化、工业机器人、激光、工控、无人机)、食品药品、医疗器械、农业等。邮箱:market@qyresearch.com
东南亚位于我国倡导推进的“一带一路”海陆交汇地带,作为当今全球发展最为迅速的地区之一,近年来区域内生产总值实现了显著且稳定的增长。根据东盟主要经济体公布的最新数据,印度尼西亚2023年国内生产总值(GDP)增长5.05%;越南2023年经济增长5.05%;马来西亚2023年经济增速为3.7%;泰国2023年经济增长1.9%;新加坡2023年经济增长1.1%;柬埔寨2023年经济增速预计为5.6%。 东盟国家在“一带一路”沿线国家中的总体GDP经济规模、贸易总额与国外直接投资均为最大,因此有着举足轻重的地位和作用。当前,东盟与中国已互相成为双方最大的交易伙伴。中国-东盟贸易总额已从2013年的443亿元增长至 2023年合计超逾6.4万亿元,占中国外贸总值的15.4%。在过去20余年中,东盟国家不断在全球多变的格局里面临挑战并寻求机遇。2023东盟国家主要经济体受到国内消费、国外投资、货币政策、旅游业复苏、和大宗商品出口价企稳等方面的提振,经济显现出稳步增长态势和强韧性的潜能。 本调研报告旨在深度挖掘东南亚市场的增长潜力与发展机会,分析东南亚市场竞争态势、销售模式、客户偏好、整体市场营商环境,为国内企业出海开展业务提供客观参考意见。 本文核心内容: 市场空间:全球行业市场空间、东南亚市场发展空间。 竞争态势:全球份额,东南亚市场企业份额。 销售模式:东南亚市场销售模式、本地代理商 客户情况:东南亚本地客户及偏好分析 营商环境:东南亚营商环境分析 本文纳入的企业包括国外及印尼本土企业,以及相关上下游企业等,部分名单 QYResearch是全球知名的大型咨询公司,行业涵盖各高科技行业产业链细分市场,横跨如半导体产业链(半导体设备及零部件、半导体材料、集成电路、制造、封测、分立器件、传感器、光电器件)、光伏产业链(设备、硅料/硅片、电池片、组件、辅料支架、逆变器、电站终端)、新能源汽车产业链(动力电池及材料、电驱电控、汽车半导体/电子、整车、充电桩)、通信产业链(通信系统设备、终端设备、电子元器件、射频前端、光模块、4G/5G/6G、宽带、IoT、数字经济、AI)、先进材料产业链(金属材料、高分子材料、陶瓷材料、纳米材料等)、机械制造产业链(数控机床、工程机械、电气机械、3C自动化、工业机器人、激光、工控、无人机)、食品药品、医疗器械、农业等。邮箱:market@qyresearch.com

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值