2 Star 0 Fork 1

mirrors_jrmuizel/d3d-compiler-winelib

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
test.c 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
Jeff Muizelaar 提交于 2017-06-14 11:47 . Initial commit
// fxc2.cpp : Defines the entry point for the console application.
//
#define COBJMACROS
//#include "stdafx.h"
#include <d3dcompiler.h>
#include <d3dcommon.h>
#include <direct.h>
#include <stdio.h>
#define D3D_COMPILE_STANDARD_FILE_INCLUDE ((ID3DInclude*)(UINT_PTR)1)
typedef HRESULT(__stdcall *pCompileFromFileg)(LPCWSTR, const D3D_SHADER_MACRO[], ID3DInclude*, LPCSTR, LPCSTR, UINT, UINT, ID3DBlob**, ID3DBlob**);
int main()
{
/*
HRESULT WINAPI D3DCompileFromFile(
in LPCWSTR pFileName,
in_opt const D3D_SHADER_MACRO pDefines,
in_opt ID3DInclude pInclude,
in LPCSTR pEntrypoint,
in LPCSTR pTarget,
in UINT Flags1,
in UINT Flags2,
out ID3DBlob ppCode,
out_opt ID3DBlob ppErrorMsgs
);
*/
HMODULE h = LoadLibrary("d3dcompiler_47.dll");
printf("module %x\n", h);
pCompileFromFileg ptr = (pCompileFromFileg)GetProcAddress(h, "D3DCompileFromFile");
printf("ptr %x\n", ptr);
HRESULT hr;
ID3DBlob* output = NULL;
ID3DBlob* errors = NULL;
const D3D_SHADER_MACRO defines[] =
{
"VERTEX_SHADER", "1",
NULL, NULL
};
LPCSTR entryPoint = "LayerQuadVS";
LPCWSTR srcFile = L"CompositorD3D11.hlsl";
hr = ptr(
srcFile,
defines,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
"vs_4_0_level_9_3",
D3DCOMPILE_DEBUG,
0,
&output,
&errors
);
#if 1
if (FAILED(hr))
{
if (errors)
{
char *error_message = (char*)ID3D10Blob_GetBufferPointer(errors);
printf("errors: %s\n", error_message);
}
return hr;
}
int* foo = (int*)ID3D10Blob_GetBufferPointer(output);
printf("%x\n", *foo);
foo++;
printf("%x\n", *foo);
foo++;
printf("%x\n", *foo);
foo++;
printf("%x\n", *foo);
foo++;
printf("%x\n", *foo);
#endif
return 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_jrmuizel/d3d-compiler-winelib.git
git@gitee.com:mirrors_jrmuizel/d3d-compiler-winelib.git
mirrors_jrmuizel
d3d-compiler-winelib
d3d-compiler-winelib
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385