ID3D11Device1::CreateDeviceContextState method (d3d11_1.h)

Membuat objek status konteks yang menyimpan semua status Microsoft Direct3D dan beberapa perilaku Direct3D.

Sintaks

HRESULT CreateDeviceContextState(
                  UINT                    Flags,
  [in]            const D3D_FEATURE_LEVEL *pFeatureLevels,
                  UINT                    FeatureLevels,
                  UINT                    SDKVersion,
                  REFIID                  EmulatedInterface,
  [out, optional] D3D_FEATURE_LEVEL       *pChosenFeatureLevel,
  [out, optional] ID3DDeviceContextState  **ppContextState
);

Parameter

Flags

Jenis: UINT

Kombinasi nilai D3D11_1_CREATE_DEVICE_CONTEXT_STATE_FLAG yang digabungkan dengan menggunakan operasi OR bitwise. Nilai yang dihasilkan menentukan cara membuat objek status konteks. Bendera D3D11_1_CREATE_DEVICE_CONTEXT_STATE_SINGLETHREADED saat ini adalah satu-satunya bendera yang ditentukan. Jika perangkat asli dibuat dengan D3D11_CREATE_DEVICE_SINGLETHREADED, Anda harus membuat semua objek status konteks dari perangkat tersebut dengan bendera D3D11_1_CREATE_DEVICE_CONTEXT_STATE_SINGLETHREADED .

Jika Anda mengatur bendera utas tunggal untuk objek status konteks dan perangkat, Anda menjamin bahwa Anda akan memanggil seluruh set metode konteks dan metode perangkat hanya dari satu utas. Oleh karena itu, Anda tidak perlu menggunakan bagian penting untuk menyinkronkan akses ke konteks perangkat, dan runtime dapat menghindari bekerja dengan bagian penting prosesor tersebut.

[in] pFeatureLevels

Jenis: const D3D_FEATURE_LEVEL*

Penunjuk ke array nilai D3D_FEATURE_LEVEL . Array dapat berisi elemen dari daftar berikut dan menentukan urutan tingkat fitur yang pembuatannya dicoba. Tidak seperti D3D11CreateDevice, Anda tidak dapat mengatur pFeatureLevels ke NULL karena tidak ada array tingkat fitur default.

{
    D3D_FEATURE_LEVEL_11_1,
    D3D_FEATURE_LEVEL_11_0,
    D3D_FEATURE_LEVEL_10_1,
    D3D_FEATURE_LEVEL_10_0,
    D3D_FEATURE_LEVEL_9_3,
    D3D_FEATURE_LEVEL_9_2,
    D3D_FEATURE_LEVEL_9_1,
};
          

FeatureLevels

Jenis: UINT

Jumlah elemen dalam pFeatureLevels. Tidak seperti D3D11CreateDevice, Anda harus mengatur FeatureLevels ke lebih besar dari 0 karena Anda tidak dapat mengatur pFeatureLevels ke NULL.

SDKVersion

Jenis: UINT

Versi SDK. Anda harus mengatur parameter ini ke D3D11_SDK_VERSION.

EmulatedInterface

Jenis: REFIID

Pengidentifikasi unik global (GUID) untuk antarmuka yang ditiru. Nilai ini menentukan perilaku perangkat saat objek status konteks aktif. Nilai yang valid diperoleh dengan menggunakan operator __uuidof pada antarmuka ID3D10Device, ID3D10Device1, ID3D11Device, dan ID3D11Device1 . Lihat Keterangan.

[out, optional] pChosenFeatureLevel

Jenis: D3D_FEATURE_LEVEL*

Penunjuk ke variabel yang menerima nilai D3D_FEATURE_LEVEL dari array pFeatureLevels . Ini adalah nilai array pertama di mana CreateDeviceContextState berhasil membuat objek status konteks. Jika panggilan ke CreateDeviceContextState gagal, variabel yang diarahkan oleh pChosenFeatureLevel diatur ke nol.

[out, optional] ppContextState

Jenis: ID3DDeviceContextState**

Alamat penunjuk ke objek ID3DDeviceContextState yang mewakili status perangkat Direct3D.

Nilai kembali

Jenis: HRESULT

Metode ini mengembalikan salah satu Kode Pengembalian Direct3D 11.

Keterangan

Nilai REFIID dari antarmuka yang ditimulasi adalah GUID yang diperoleh dengan menggunakan operator __uuidof . Misalnya, __uuidof(ID3D11Device) mendapatkan GUID antarmuka ke perangkat Microsoft Direct3D 11.

Panggil metode ID3D11DeviceContext1::SwapDeviceContextState untuk mengaktifkan objek status konteks. Ketika objek status konteks aktif, perilaku perangkat yang terkait dengan tingkat fitur objek status konteks dan antarmuka yang kompatibel diaktifkan pada perangkat Direct3D hingga panggilan berikutnya ke SwapDeviceContextState.

Saat objek status konteks aktif, runtime menonaktifkan metode tertentu pada perangkat dan antarmuka konteks. Misalnya, objek status konteks yang dibuat dengan __uuidof(ID3D11Device) akan menyebabkan runtime menonaktifkan sebagian besar antarmuka perangkat Microsoft Direct3D 10, dan objek status konteks yang dibuat dengan __uuidof(ID3D10Device1) atau __uuidof(ID3D10Device) akan menyebabkan runtime menonaktifkan sebagian besar metode ID3D11DeviceContext . Perilaku ini memastikan bahwa pengguna dari salah satu antarmuka yang ditimulasikan tidak dapat mengatur status perangkat yang tidak dapat diekspresikan oleh antarmuka lain yang tidak dapat diekspresikan. Pembatasan ini membantu menjamin bahwa antarmuka yang ditiru ID3D10Device1 secara akurat mencerminkan status penuh alur dan bahwa antarmuka yang ditiru tidak akan beroperasi bertentangan dengan definisi antarmuka aslinya.

Misalnya, tahap tessellation dibuat aktif melalui antarmuka ID3D11DeviceContext saat Anda membuat perangkat melalui D3D11CreateDevice atau D3D11CreateDeviceAndSwapChain, alih-alih melalui Direct3D 10 yang setara. Karena konteks Direct3D 11 aktif, antarmuka Direct3D 10 tidak aktif saat Anda pertama kali mengambilnya melalui QueryInterface. Ini berarti Anda tidak dapat segera meneruskan antarmuka Direct3D 10 yang Anda ambil dari perangkat Direct3D 11 ke fungsi. Anda harus terlebih dahulu memanggil SwapDeviceContextState untuk mengaktifkan objek status konteks yang kompatibel dengan Direct3D 10.

Tabel berikut menunjukkan metode yang aktif dan tidak aktif untuk setiap antarmuka yang ditiru.

Antarmuka yang ditimulasikan Perangkat aktif atau antarmuka konteks langsung Perangkat tidak aktif atau antarmuka konteks langsung

ID3D11Device atau

ID3D11Device1

ID3D11Device

IDXGIDevice +

IDXGIDevice1 +

IDXGIDevice2

ID3D10Multithread

ID3D10Device

ID3D10Device1 atau

ID3D10Device

ID3D10Device

ID3D10Device1

IDXGIDevice +

IDXGIDevice1

ID3D10Multithread

ID3D11Device

ID3D11DeviceContext (Seperti yang diterbitkan oleh konteks langsung. Antarmuka yang ditiru Direct3D 10 atau Microsoft Direct3D 10.1 tidak berpengaruh pada konteks yang ditangguhkan.)

 

Tabel berikut menunjukkan metode konteks langsung yang dinonaktifkan runtime saat objek status konteks yang ditunjukkan aktif.

Metode ID3D11DeviceContext saat __uuidof(ID3D10Device1) atau __uuidof(ID3D10Device) aktif Metode ID3D10Device saat __uuidof(ID3D11Device) aktif

ClearDepthStencilView

ClearDepthStencilView

ClearRenderTargetView

ClearRenderTargetView

ClearState

ClearState

ClearUnorderedAccessViewUint

ClearUnorderedAccessViewFloat

CopyResource

CopyResource

CopyStructureCount

CopySubresourceRegion

CopySubresourceRegion

CSGetConstantBuffers

CSGetSamplers

CSGetShader

CSGetShaderResources

CSGetUnorderedAccessViews

CSSetConstantBuffers

CSSetSamplers

CSSetShader

CSSetShaderResources

CSSetUnorderedAccessViews

Pengiriman

DispatchIndirect

CreateBlendState

Tarik

Tarik

DrawAuto

DrawAuto

DrawIndexed

DrawIndexed

DrawIndexedInstanced

DrawIndexedInstanced

DrawIndexedInstancedIndirect

DrawInstanced

DrawInstanced

DrawInstancedIndirect

DSGetConstantBuffers

DSGetSamplers

DSGetShader

DSGetShaderResources

DSSetConstantBuffers

DSSetSamplers

DSSetShader

DSSetShaderResources

ExecuteCommandList

FinishCommandList

Flush

Flush

GenerateMips

GenerateMips

GetPredication

GetPredication

GetResourceMinLOD

GetType

GetTextFilterSize

GSGetConstantBuffers

GSGetConstantBuffers

GSGetSamplers

GSGetSamplers

GSGetShader

GSGetShader

GSGetShaderResources

GSGetShaderResources

GSSetConstantBuffers

GSSetConstantBuffers

GSSetSamplers

GSSetSamplers

GSSetShader

GSSetShader

GSSetShaderResources

GSSetShaderResources

HSGetConstantBuffers

HSGetSamplers

HSGetShader

HSGetShaderResources

HSSetConstantBuffers

HSSetSamplers

HSSetShader

HSSetShaderResources

IAGetIndexBuffer

IAGetIndexBuffer

IAGetInputLayout

IAGetInputLayout

IAGetPrimitiveTopology

IAGetPrimitiveTopology

IAGetVertexBuffers

IAGetVertexBuffers

IASetIndexBuffer

IASetIndexBuffer

IASetInputLayout

IASetInputLayout

IASetPrimitiveTopology

IASetPrimitiveTopology

IASetVertexBuffers

IASetVertexBuffers

OMGetBlendState

OMGetBlendState

OMGetDepthStencilState

OMGetDepthStencilState

OMGetRenderTargets

OMGetRenderTargets

OMGetRenderTargetsAndUnorderedAccessViews

OMSetBlendState

OMSetBlendState

OMSetDepthStencilState

OMSetDepthStencilState

OMSetRenderTargets

OMSetRenderTargets

OMSetRenderTargetsAndUnorderedAccessViews

PSGetConstantBuffers

PSGetConstantBuffers

PSGetSamplers

PSGetSamplers

PSGetShader

PSGetShader

PSGetShaderResources

PSGetShaderResources

PSSetConstantBuffers

PSSetConstantBuffers

PSSetSamplers

PSSetSamplers

PSSetShader

PSSetShader

PSSetShaderResources

PSSetShaderResources

ResolveSubresource

ResolveSubresource

RSGetScissorRects

RSGetScissorRects

RSGetState

RSGetState

RSGetViewports

RSGetViewports

RSSetScissorRects

RSSetScissorRects

RSSetState

RSSetState

RSSetViewports

RSSetViewports

SetPredication

SetPredication

SetResourceMinLOD

SetTextFilterSize

SOGetTargets

SOGetTargets

SOSetTargets

SOSetTargets

UpdateSubresource

UpdateSubresource

VSGetConstantBuffers

VSGetConstantBuffers

VSGetSamplers

VSGetSamplers

VSGetShader

VSGetShader

VSGetShaderResources

VSGetShaderResources

VSSetConstantBuffers

VSSetConstantBuffers

VSSetSamplers

VSSetSamplers

VSSetShader

VSSetShader

VSSetShaderResources

VSSetShaderResources

 

Tabel berikut menunjukkan metode konteks langsung yang tidak dinonaktifkan runtime saat objek status konteks yang ditunjukkan aktif.

Metode ID3D11DeviceContext saat __uuidof(ID3D10Device1) atau __uuidof(ID3D10Device) aktif Metode ID3D10Device saat __uuidof(ID3D11Device) aktif

Mulai

Akhir

GetCreationFlags

GetPrivateData

GetContextFlags

GetData

Peta

Batalkan peta

 

Tabel berikut menunjukkan metode antarmuka ID3D10Device yang tidak dinonaktifkan oleh runtime karena bukan metode konteks langsung.

Metode ID3D10Device

CheckCounter

CheckCounterInfo

Buat*, seperti CreateQuery

GetDeviceRemovedReason

GetExceptionMode

OpenSharedResource

SetExceptionMode

SetPrivateData

SetPrivateDataInterface

 

Windows Phone 8: API ini didukung.

Persyaratan

Persyaratan Nilai
Klien minimum yang didukung Windows 8 dan Pembaruan Platform untuk Windows 7 [aplikasi desktop | Aplikasi UWP]
Server minimum yang didukung Windows Server 2012 dan Pembaruan Platform untuk Windows Server 2008 R2 [aplikasi desktop | Aplikasi UWP]
Target Platform Windows
Header d3d11_1.h
Pustaka D3D11.lib

Lihat juga

ID3D11Device1