Specify rendertarget view descriptions.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Tue, 20 Nov 2012 17:06:43 +0000 (17:06 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Tue, 20 Nov 2012 17:06:43 +0000 (17:06 +0000)
To exercise unions.

apps/d3d10/tri.cpp
apps/d3d10_1/tri.cpp
apps/d3d10_1/tri_level_9_1.cpp
apps/d3d11/tri.cpp

index 8c26be958ab027a0584f829f21b6db0235ff3c4f..08b67017edb1d5ce96f28c07912ce7c81b7b4a8a 100644 (file)
@@ -125,7 +125,12 @@ int main(int argc, char *argv[]){
     if (FAILED(hr)) {
         return 1;
     }
-    hr = g_pDevice->CreateRenderTargetView(pBackBuffer, NULL, &pRenderTargetView);
+    D3D10_RENDER_TARGET_VIEW_DESC RenderTargetViewDesc;
+    ZeroMemory(&RenderTargetViewDesc, sizeof RenderTargetViewDesc);
+    RenderTargetViewDesc.Format = SwapChainDesc.BufferDesc.Format;
+    RenderTargetViewDesc.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
+    RenderTargetViewDesc.Texture2D.MipSlice = 0;
+    hr = g_pDevice->CreateRenderTargetView(pBackBuffer, &RenderTargetViewDesc, &pRenderTargetView);
     if (FAILED(hr)) {
         return 1;
     }
index 2186d39411cd37bc848eecfe640e2befce5bef94..4aed3508ad693edc8cee319efc3a28a13b8fefc3 100644 (file)
@@ -126,7 +126,12 @@ int main(int argc, char *argv[]){
     if (FAILED(hr)) {
         return 1;
     }
-    hr = g_pDevice->CreateRenderTargetView(pBackBuffer, NULL, &pRenderTargetView);
+    D3D10_RENDER_TARGET_VIEW_DESC RenderTargetViewDesc;
+    ZeroMemory(&RenderTargetViewDesc, sizeof RenderTargetViewDesc);
+    RenderTargetViewDesc.Format = SwapChainDesc.BufferDesc.Format;
+    RenderTargetViewDesc.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
+    RenderTargetViewDesc.Texture2D.MipSlice = 0;
+    hr = g_pDevice->CreateRenderTargetView(pBackBuffer, &RenderTargetViewDesc, &pRenderTargetView);
     if (FAILED(hr)) {
         return 1;
     }
index 4c65e7671a1b4af8459b00b59bd3d281ed3c2f20..7c1ae0e1067b4f96c55e4f597ab1da557938b219 100644 (file)
@@ -126,7 +126,12 @@ int main(int argc, char *argv[]){
     if (FAILED(hr)) {
         return 1;
     }
-    hr = g_pDevice->CreateRenderTargetView(pBackBuffer, NULL, &pRenderTargetView);
+    D3D10_RENDER_TARGET_VIEW_DESC RenderTargetViewDesc;
+    ZeroMemory(&RenderTargetViewDesc, sizeof RenderTargetViewDesc);
+    RenderTargetViewDesc.Format = SwapChainDesc.BufferDesc.Format;
+    RenderTargetViewDesc.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
+    RenderTargetViewDesc.Texture2D.MipSlice = 0;
+    hr = g_pDevice->CreateRenderTargetView(pBackBuffer, &RenderTargetViewDesc, &pRenderTargetView);
     if (FAILED(hr)) {
         return 1;
     }
index b8a2c042903806ebc62b7e0c0a4c0c6001fd1acb..a380ca7c7b4581a0cc5be554ea1cc3cb25b7a6ca 100644 (file)
@@ -136,7 +136,12 @@ int main(int argc, char *argv[]){
     if (FAILED(hr)) {
         return 1;
     }
-    hr = g_pDevice->CreateRenderTargetView(pBackBuffer, NULL, &pRenderTargetView);
+    D3D11_RENDER_TARGET_VIEW_DESC RenderTargetViewDesc;
+    ZeroMemory(&RenderTargetViewDesc, sizeof RenderTargetViewDesc);
+    RenderTargetViewDesc.Format = SwapChainDesc.BufferDesc.Format;
+    RenderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+    RenderTargetViewDesc.Texture2D.MipSlice = 0;
+    hr = g_pDevice->CreateRenderTargetView(pBackBuffer, &RenderTargetViewDesc, &pRenderTargetView);
     if (FAILED(hr)) {
         return 1;
     }