summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-09-21 15:51:02 +0200
committerLuca Barbieri <[email protected]>2010-09-21 15:51:02 +0200
commitf815b57b888d00228dcb355cbd34ed0f4c44a620 (patch)
treef77610f2654d631789c65cbb437b840042a02cd8 /src/gallium
parentcb7cc36fff63e1bbdf4820538a8133f150541be4 (diff)
d3d1x: add missing file
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
new file mode 100644
index 00000000000..239a5bb98cb
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
@@ -0,0 +1,87 @@
+#if API < 10
+HRESULT D3D10CreateBlob(
+ __in SIZE_T NumBytes,
+ __out LPD3D10BLOB *ppBuffer
+)
+{
+ void* data = malloc(NumBytes);
+ if(!data)
+ return E_OUTOFMEMORY;
+ *ppBuffer = new GalliumD3DBlob(data, NumBytes);
+ return S_OK;
+}
+
+LPCSTR STDMETHODCALLTYPE D3D10GetPixelShaderProfile(
+ __in ID3D10Device *pDevice
+)
+{
+ return "ps_4_0";
+}
+
+LPCSTR STDMETHODCALLTYPE D3D10GetVertexShaderProfile(
+ __in ID3D10Device *pDevice
+)
+{
+ return "vs_4_0";
+}
+
+LPCSTR STDMETHODCALLTYPE D3D10GetGeometryShaderProfile(
+ __in ID3D10Device *pDevice
+)
+{
+ return "gs_4_0";
+}
+
+static HRESULT dxbc_assemble_as_blob(struct dxbc_chunk_header** chunks, unsigned num_chunks, ID3D10Blob** blob)
+{
+ std::pair<void*, size_t> p = dxbc_assemble(chunks, num_chunks);
+ if(!p.first)
+ return E_OUTOFMEMORY;
+ *blob = return new GalliumD3DBlob(p.first, p.second);
+ return S_OK;
+}
+
+HRESULT D3D10GetInputSignatureBlob(
+ __in const void *pShaderBytecode,
+ __in SIZE_T BytecodeLength,
+ __out ID3D10Blob **ppSignatureBlob
+)
+{
+ dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, BytecodeLength, false);
+ if(!sig)
+ return E_FAIL;
+
+ return dxbc_assemble_as_blob(&sig, 1, ppSignatureBlob);
+}
+
+HRESULT D3D10GetOutputSignatureBlob(
+ __in const void *pShaderBytecode,
+ __in SIZE_T BytecodeLength,
+ __out ID3D10Blob **ppSignatureBlob
+)
+{
+ dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, BytecodeLength, true);
+ if(!sig)
+ return E_FAIL;
+
+ return dxbc_assemble_as_blob(&sig, 1, ppSignatureBlob);
+}
+
+HRESULT D3D10GetInputOutputSignatureBlob(
+ __in const void *pShaderBytecode,
+ __in SIZE_T BytecodeLength,
+ __out ID3D10Blob **ppSignatureBlob
+)
+{
+ dxbc_chunk_signature* sigs[2];
+ sigs[0] = dxbc_find_signature(pShaderBytecode, BytecodeLength, false);
+ if(!sigs[0])
+ return E_FAIL;
+ sigs[1] = dxbc_find_signature(pShaderBytecode, BytecodeLength, true);
+ if(!sigs[1])
+ return E_FAIL;
+
+ return dxbc_assemble_as_blob(&sigs, 2, ppSignatureBlob);
+}
+
+#endif