<commit_before>#if API < 11
extern "C" HRESULT STDMETHODCALLTYPE D3D10CreateBlob(
	__in   SIZE_T NumBytes,
	__out  LPD3D10BLOB *ppBuffer
);

HRESULT STDMETHODCALLTYPE 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 = 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((dxbc_chunk_header**)&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((dxbc_chunk_header**)&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((dxbc_chunk_header**)&sigs, 2, ppSignatureBlob);
}<commit_msg>d3d1x: fix API name<commit_after>#if API < 11
extern "C" HRESULT STDMETHODCALLTYPE D3D10CreateBlob(
	__in   SIZE_T NumBytes,
	__out  LPD3D10BLOB *ppBuffer
);

HRESULT STDMETHODCALLTYPE 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 = 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((dxbc_chunk_header**)&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((dxbc_chunk_header**)&sig, 1, ppSignatureBlob);
}

HRESULT  D3D10GetInputAndOutputSignatureBlob(
	__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((dxbc_chunk_header**)&sigs, 2, ppSignatureBlob);
}
{'fraction_non_alphanumeric': 0.09469784672377865, 'fraction_numerical': 0.03241491085899514, 'mean_word_length': 6.5, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1211921', 'n_tokens_mistral': 1862, 'n_tokens_neox': 1748, 'n_words': 327}