0
\$\begingroup\$

hey i am studying different types of shaders in directx. and it comes to hull shader. so i write hlsl codes for both constant hull shader and control point hull shader in same file in visual studio 2019 .

i compile this file and this is showing these errors enter image description here

the shader type is hull shader and 5.0 model.

struct VS_OUT
{
    float3 pos : TEXCOORD0;
};

struct Patch
{
    float edgeTessFactor[3] : SV_TessFactor;
    float inTessFactor : SV_InsideTessFactor;
};

struct HS_OUTPUT
{
    float3 pos : TEXCOORD0;
};



Patch ConstantHS(InputPatch<VS_OUT,3> patch, uint pI:SV_PrimitiveID)
{
    Patch p;
    p.edgeTessFactor[0] = 3.0f;
    p.edgeTessFactor[1] = 3.0f;
    p.edgeTessFactor[2] = 3.0f;
    p.inTessFactor = 3.0f;

    return p;
}

[domain("tri")]
[partitioning("fractional_even")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(3)]
[patchconstantfunc("ConstantHS")]
[maxtessfactor(16.0f)]
HS_OUTPUT ControlPointHS(InputPatch<VS_OUT, 3> patch, uint i : SV_OutputControlPointID, uint pI : SV_PrimitiveID)
{
    HS_OUTPUT output;
    output.pos = patch[i].pos;

    return output;
}

any advice would be really helpful.

\$\endgroup\$
  • 1
    \$\begingroup\$ Have you set up the compiler to look for "ControlPointHS" as shader entry point function? By default, it's going to look for a function named "main". \$\endgroup\$ – János Turánszki Sep 25 '19 at 16:04
  • \$\begingroup\$ you are right!!! thanks man. i checked the setting is main!!! \$\endgroup\$ – KIM CHANGJUN Sep 25 '19 at 23:05
  • \$\begingroup\$ Cool, I've also written it as an answer, could you accept if it solved your question? It is better to not leave question opened, and it might help other people. \$\endgroup\$ – János Turánszki Sep 27 '19 at 20:41
1
\$\begingroup\$

You might need to set up the compiler to look for "ControlPointHS" as shader entry point function. By default, it's going to look for a function named "main".

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.