错误0x80070057,具体取决于包含顶点着色器代码

时间:2017-01-10 00:19:43

标签: uwp directx directx-11 direct3d11 directxtk

这是我的第一个问题,请给我一点怜悯。我目前正在使用Pixel Shader中的以下着色器代码:

struct PixelShaderInput
{
        float4 pos : SV_POSITION;
};

float4 main(PixelShaderInput input) : SV_TARGET
{
    return float4(0.1f, 0.1f, 0.1f, 1.0f);
}

在顶点着色器中:

cbuffer ModelViewProjectionConstantBuffer : register(b0)
{
    matrix model;
    matrix view;
    matrix projection;
};

struct VertexShaderInput
{
    float3 pos : POSITION;
};

struct PixelShaderInput
{
    float4 pos : SV_POSITION;
};

PixelShaderInput main(VertexShaderInput input)
{
    PixelShaderInput output;
    float4 pos = float4(input.pos, 1.0f);

    pos = mul(pos, model);
    pos = mul(pos, view);
    pos = mul(pos, projection);
    output.pos = pos;

    return output;
}

现在来了奇怪的部分。在没有DirectX11支持的虚拟机上,如果我将上面的着色器代码复制到项目框架创建的两个文件中,则此版本的代码可以正常工作:

void SUS3DApp1Main::SUSCreateDeviceResources()
{
    //auto loadVSTask = DX::ReadDataAsync(L"SUSPixelShader.cso");
    //auto loadPSTask = DX::ReadDataAsync(L"SUSVertexShader.cso");

    // Load shaders asynchronously.
    //this version works
    auto loadVSTask = DX::ReadDataAsync(L"SampleVertexShader.cso");
    auto loadPSTask = DX::ReadDataAsync(L"SamplePixelShader.cso");

虽然这个没有:

void SUS3DApp1Main::SUSCreateDeviceResources()
{
    auto loadVSTask = DX::ReadDataAsync(L"SUSPixelShader.cso");
    auto loadPSTask = DX::ReadDataAsync(L"SUSVertexShader.cso");

我检查并重新检查了Visual Studio中的编译设置,但它们看起来和我一样。有没有人知道在创建项目框架期间创建的“特殊”文件有什么不同?

0 个答案:

没有答案
相关问题