So.....Ok iI understand the Syntaxsyntax of HLSL. like, for example letlet's pretend I have this as my HLSL:
struct VOut
{
float4 position : SV_POSITION;
float4 color : COLOR;
};
VOut VShader(float4 position : POSITION, float4 color : COLOR)
{
VOut output;
output.position = position;
output.position.xy *= 0.7f; // "shrink" the vertex on the x and y axes
output.color = color;
return output;
}
float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET
{
return color;
}
and I compile themit like this:
D3DX11CompileFromFile(L"shaders.hlsl", 0, 0, "VShader", "vs_5_0", 0, 0, 0, &VS, 0, 0);
D3DX11CompileFromFile(L"shaders.hlsl", 0, 0, "PShader", "ps_5_0", 0, 0, 0, &PS, 0, 0);
How does it like......know know to change....Im I'm confused about exactly atwhat the pipeline between HLSL and the actual Pixelspixels/Vertexvertices on the screen is.
isIs this what actually "applies" them:?
dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS);
dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), NULL, &pPS);
// set the shader objects
devcon->VSSetShader(pVS, 0, 0);
devcon->PSSetShader(pPS, 0, 0);
keepKeep in mind imI'm like a literal BEGINNERbeginner at this stuff. Can someone maybe explain WHATwhat it's doing, im? I'm assuming the Vertexvertex HLSL function goes through every vertex (as the input Position:POSITION and color: COLOR) and then changes them to whatever I have in the function, and the output is what was changed....(same goes and similarly for Pixel Shader).the pixel shader?
Another confusion, I know what a pixel is, and I understand what a vertex is.....but but what exactly does the Pixelpixel shader do......?