MapMode Enumeration
Last Update: Dec 2012

MapMode Enumeration (SharpDX.Direct3D10)

Identifies a resource to be accessed for reading and writing by the CPU. Applications may combine one or more of these flags.

Assembly: SharpDX.Direct3D10 (SharpDX.Direct3D10.dll
Namespace: SharpDX.Direct3D10
Unmanaged: D3D10_MAP
Documentation for unmanaged references are generated from MSDN documentation. Please refer to the original documentation for further details.
  • C#
  • VB
  • C++
  • F#
public enum MapMode

Syntax for VB is not yet implemented.

Syntax for C++ is not yet implemented

Syntax for F# is not yet implemented.

The MapMode type exposes the following members.

  Platforms Name Unmanaged Description

Resource is mapped for reading. The resource must have been created with read access (see Read).


Resource is mapped for writing. The resource must have been created with write access (see Write).


Resource is mapped for reading and writing. The resource must have been created with read and write access (see Read and Write).


Resource is mapped for writing; the previous contents of the resource will be undefined. The resource must have been created with write access (see Write).


Resource is mapped for writing; the existing contents of the resource cannot be overwritten (see Remarks). This flag is only valid on vertex and index buffers. The resource must have been created with write access (see Write). Cannot be used on a resource created with the ConstantBuffer flag.


This enumeration is used in Map, SharpDX.Direct3D10.Texture1D.Map, SharpDX.Direct3D10.Texture2D.Map, and SharpDX.Direct3D10.Texture3D.Map.

These remarks are divided into the following topics:

  • Meaning
  • Common
Meaning of WriteNoOverwrite

WriteNoOverwrite signifies that the application promises not to write to data that the Input Assembler (IA) stage is using. In exchange, the GPU allows the application to write to other parts of the same buffer. The application must ensure that it does not write over any data in use by the IA stage.

For example, consider the buffer illustrated in the following diagram. If a Draw call has been issued that uses vertices 4-6, an application that calls Map on this buffer must ensure that it does not write to the vertices that the Draw call will access during rendering.

However, ensuring this can be difficult, because the GPU is often many frames behind the CPU in terms of which frame it is currently processing. Keeping track of which sections of a resource are being used because of calls made 2 to 5 frames ago is difficult and error-prone. Because of this, it is recommended that applications only write to the uninitialized portions of a resource when using WriteNoOverwrite.

Common Usage of WriteDiscard with WriteNoOverwrite

WriteDiscard and WriteNoOverwrite are normally used in conjunction with dynamic index/vertex buffers, although they can also be used with dynamic textures.

A common use of these two flags involves filling dynamic index/vertex buffers with geometry that can be seen from the camera's current position. The first time that data is entered into the buffer on a given frame, Map is called with WriteDiscard; doing so invalidates the previous contents of the buffer. The buffer is then filled with all available data.

Subsequent writes to the buffer within the same frame should use WriteNoOverwrite. This will enable the CPU to access a resource that is potentially being used by the GPU as long as the restrictions described previously are respected.

Supported in:

 All Windows Desktop - .NET 2.0+ - .NET 4.0+