HLSL: Empty fx file: X3000: unexpected token '{'
Asked Answered
P

1

6

The following error appears: Test.fx(1,1): error X3000: syntax error: unexpected token '{'

Text.fx contains this: Nothing.

I also tried it with an effect file that works fine in another test project:

float4x4 mWorld;

struct TInputVertex {
    float3 vPosition    : POSITION0;
    float3 vNormal      : NORMAL0;
    float2 vTexCoord    : TEXCOORD0;
    float4 vColor       : COLOR0;
};

struct TOutputVertex {
    float4 vPosition    : POSITION0;
    float3 vNormal      : TEXCOORD1;
    float4 vColor       : COLOR0;
};

TOutputVertex vsMain(TInputVertex i) {
    TOutputVertex o;

    o.vPosition = mul(float4(i.vPosition, 1), mWorld);
    o.vColor = i.vColor;

    o.vNormal = mul(float4(i.vNormal, 1), mWorld).xyz;

    //o.vColor += pow(dot(normal_world, float3(0, 0, 1)) * 2 + 0.3, 10);

    return o;
}

struct TInputFragment {
    float3 vNormal      : TEXCOORD1;
    float2 vTexCoord    : TEXCOORD0;
    float4 vColor       : COLOR0;
};

struct TOutputFragment {
    float4 vColor       : COLOR0;
};

TOutputFragment psMain(TInputFragment i) {
    TOutputFragment o;

    o.vColor = i.vColor;
    o.vColor += pow(dot(i.vNormal, float3(0, 0, 1)) * 2 + 0.3, 10);

    return o;
}

technique mytech {
    pass p0 {
        //ShadeMode = Flat;
        //ZEnable = false;

        WorldTransform[0] = mWorld;

        VertexShader = compile vs_1_1 vsMain();
        PixelShader = compile ps_2_0 psMain();
    }
}

With the same error as result.

Included dx files from the same dx sdk in both projects. Including and linking the same headers and libraries.

I literally copied the loading function from the test project. I wrote the entire test project myself.

HRESULT res = D3DXCreateEffectFromFile(device, file_name, NULL, NULL, 0,  0, &effect, &error_buffer);

Google doesn't turn up with anything like this. I'd really appreciate it if you could remove the dagger from my wetware.

Antoon

Plattdeutsch answered 20/6, 2010 at 20:24 Comment(0)
P
5

Solution: Don't create RTF files and then rename them and edit with wordpad. Wordpad will still interpret it as rtf because the file starts with "{\rtf1}". Dragging it into visual studio showed me the real contents. Oh world, you are so much fun.

Plattdeutsch answered 20/6, 2010 at 22:44 Comment(1)
Yeah, definitely don't edit code with a text editor. They do things like not output the result in anything remotely approaching what a compiler expects, conform to text format standards (which aren't the same as code standards,) and don't have most of the features of IDEs we all depend on.Peag

© 2022 - 2024 — McMap. All rights reserved.