title: Create 1D Texture in DirectX 11
body: <p>I try to create the 1D Texture in DirectX 11 wih this code:</p>
  
  <h1>PARAMETER: ID3D11Device* pDevice</h1>
  
  <pre><code>D3D11_TEXTURE1D_DESC text1_desc;
  
  ::ZeroMemory(&amp;text1_desc, sizeof(D3D11_TEXTURE1D_DESC));
  
  text1_desc.Width = 258
  
  text1_desc.MipLevels = 2;
  
  text1_desc.ArraySize = 2;
  
  text1_desc.Usage = D3D11_USAGE_IMMUTABLE;
  
  text1_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
  
  text1_desc.Format = R8G8B8A8_UNORM;
  
  FLOAT* pData = new FLOAT[text1_desc.MipLevels * text1_desc.ArraySize * text1_desc.Width];
  
  D3D11_SUBRESOURCE_DATA sr_data;
  
  ::ZeroMemory(&amp;sr_data, sizeof(D3D11_SUBRESOURCE_DATA));
  
  sr_data.pSysMem = pData;
  
  ID3D11Texture1D* pTexture1D = nullptr;
  
  auto hr = pDevice-&gt;CreateTexture1D(&amp;text1_desc, &amp;sr_data, &amp;pTexture1D);
  </code></pre>
  
  <p>When <code>text1_desc.MipLevels = 1</code> and <code>text1_desc.ArraySize = 1</code> everything is good.</p>
  
  <p>When <code>text1_desc.MipLevels = 0</code> or <code>text1_desc.MipLevels &gt; 1</code> it raises Unhandled exception at 0x000007FEE6D14CC0 (nvwgf2umx.dll): 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.</p>
  
  <p>Can anyone help me to solve this problem?</p>