3,034 questions
OK. For the size of position float counted at the C++ structure. I think I get that now.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
void Sample3DSceneRenderer::CreateDeviceDependentResources()
{
//...... .....
auto createPipelineStateTask = (createPSTask && createVSTask).then([this]() {
static const D3D12_INPUT_ELEMENT_DESC inputLayout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
};
D3D12_GRAPHICS_PIPELINE_STATE_DESC state = {};
state.InputLayout = { inputLayout, _countof(inputLayout) };
state.pRootSignature = m_rootSignature.Get();
state.VS = CD3DX12_SHADER_BYTECODE(&m_vertexShader[0], m_vertexShader.size());
state.PS = CD3DX12_SHADER_BYTECODE(&m_pixelShader[0], m_pixelShader.size());
state.RasterizerState = CD3DX12_RASTERIZER_DESC(D3D12_DEFAULT);
state.BlendState = CD3DX12_BLEND_DESC(D3D12_DEFAULT);
state.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC(D3D12_DEFAULT);
state.SampleMask = UINT_MAX;
state.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
state.NumRenderTargets = 1;
state.RTVFormats[0] = m_deviceResources->GetBackBufferFormat();
state.DSVFormat = m_deviceResources->GetDepthBufferFormat();
state.SampleDesc.Count = 1;
DX::ThrowIfFailed(m_deviceResources->GetD3DDevice()->CreateGraphicsPipelineState(&state, IID_PPV_ARGS(&m_pipelineState)));
// Shader data can be deleted once the pipeline state is created.
m_vertexShader.clear();
m_pixelShader.clear();
});
How is a 12 byte offset determined in the DirectX12 app as generated by Visual Studio?
"{ "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, -->12 <--, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }"
OK. For the size of position float counted at the C++ structure. I think I get that now.