private void MipGenerationSimple2LevelsOn2DTexture() { //Given Material computeShader = LoadComputeShader(device); Texture2DDescription emptyTextureDesc = CreateTextureDescription(); SharpDX.Direct3D11.Texture2D emptyTexture = new SharpDX.Direct3D11.Texture2D(device, emptyTextureDesc); ShaderResourceViewDescription srvDesc = CreateSRVDescription(); ShaderResourceView srv = new ShaderResourceView(device, emptyTexture, srvDesc); UnorderedAccessViewDescription uavDesc = CreateUAVDescription(0); UnorderedAccessView uavMip0 = new UnorderedAccessView(device, emptyTexture, uavDesc); uavDesc = CreateUAVDescription(1); UnorderedAccessView uavMip1 = new UnorderedAccessView(device, emptyTexture, uavDesc); uavDesc = CreateUAVDescription(2); UnorderedAccessView uavMip2 = new UnorderedAccessView(device, emptyTexture, uavDesc); BufferDescription bufferDesc = CreateLocalBufferDesc(); SharpDX.Direct3D11.Buffer localbuffer = new SharpDX.Direct3D11.Buffer(device, bufferDesc); int mipSize = 0; int subIndex = emptyTexture.CalculateSubResourceIndex(1, 0, out mipSize); //When computeShader.SetParameterResource("gOutput", uavMip0); computeShader.SetParameterValue("fillColour", new Vector4(0.1f, 0.2f, 0.3f, 1.0f)); computeShader.Apply(); //IS THIS ACTUALLY DOING ANYTHING AT ALL? Do we need to set up more of the pipeline before this will actually work?? device.Dispatch(1, 32, 1); device.Copy(emptyTexture, 1, localbuffer, 0); DataStream data = new DataStream(8 * 32 * 32, true, true); ((DeviceContext)device).MapSubresource(localbuffer, MapMode.Read, MapFlags.None, out data); Half4 quickTest; for (int i = 0; i < 32 * 32; i++) { quickTest = data.ReadHalf4(); } ((DeviceContext)device).UnmapSubresource(localbuffer, 0); }