Test
This commit is contained in:
parent
bd7c8fd668
commit
76a60de65a
@ -6,6 +6,6 @@ int main(int argc, char* argv[]) {
|
|||||||
init.size = {800, 600};
|
init.size = {800, 600};
|
||||||
init.resizable = true;
|
init.resizable = true;
|
||||||
init.centered = true;
|
init.centered = true;
|
||||||
// init.api = mirage::renderer_api::opengl;
|
init.api = mirage::renderer_api::opengl;
|
||||||
return run(init);
|
return run(init);
|
||||||
}
|
}
|
||||||
|
@ -34,17 +34,17 @@ SHADER_EXTENSIONS = {
|
|||||||
'spirv': 'spirv',
|
'spirv': 'spirv',
|
||||||
'dxil': 'dxil',
|
'dxil': 'dxil',
|
||||||
'dxbc': 'dxbc',
|
'dxbc': 'dxbc',
|
||||||
'Metal Library Bytecode assembly': 'metallib',
|
'metallib': 'metallib',
|
||||||
'wgsl': 'wgsl'
|
'wgsl': 'wgsl'
|
||||||
}
|
}
|
||||||
|
|
||||||
# 不同目标平台的编译配置
|
# 不同目标平台的编译配置
|
||||||
TARGET_PROFILES = {
|
TARGET_PROFILES = {
|
||||||
'glsl': ['-profile', 'glsl_460'],
|
'glsl': ['-profile', 'glsl_460', '-capability', 'spirv_latest'],
|
||||||
'spirv': ['-profile', 'glsl_460', '-capability', 'glsl_spirv_1_6'],
|
'spirv': ['-profile', 'spirv_1_6'],
|
||||||
'dxbc': ['-profile', 'sm_5_0'],
|
'dxbc': ['-profile', 'sm_5_0'],
|
||||||
'dxil': ['-profile', 'sm_6_6'],
|
'dxil': ['-profile', 'sm_6_6'],
|
||||||
'Metal Library Bytecode assembly': ['-capability', 'metallib_3_1']
|
'metallib': ['-capability', 'metallib_3_1']
|
||||||
}
|
}
|
||||||
|
|
||||||
class ShaderEntry:
|
class ShaderEntry:
|
||||||
@ -245,17 +245,18 @@ def generate_pipeline_header_preamble() -> List[str]:
|
|||||||
" throw std::runtime_error(\"Failed to read shader file: \" + std::string(e.what()));",
|
" throw std::runtime_error(\"Failed to read shader file: \" + std::string(e.what()));",
|
||||||
" }",
|
" }",
|
||||||
"",
|
"",
|
||||||
" bool is_string_source = rendererID == LLGL::RendererID::OpenGL;",
|
" if (rendererID == LLGL::RendererID::OpenGL) {",
|
||||||
" if (is_string_source) {",
|
" // 添加终止符",
|
||||||
" shaderData.push_back('\\0');",
|
" shaderData.push_back('\\0');",
|
||||||
" }",
|
" }",
|
||||||
" // 创建着色器",
|
" // 创建着色器",
|
||||||
" LLGL::ShaderDescriptor desc = shaderDesc;",
|
" LLGL::ShaderDescriptor desc = shaderDesc;",
|
||||||
" desc.source = shaderData.data();",
|
" desc.source = shaderData.data();",
|
||||||
" desc.sourceSize = shaderData.size();",
|
" desc.sourceSize = shaderData.size();",
|
||||||
" desc.entryPoint = entryPoint;",
|
" desc.entryPoint = rendererID == LLGL::RendererID::OpenGL ? \"main\" : entryPoint;",
|
||||||
" desc.type = type;",
|
" desc.type = type;",
|
||||||
" desc.sourceType = is_string_source ? LLGL::ShaderSourceType::CodeString : LLGL::ShaderSourceType::BinaryBuffer;",
|
" desc.profile = \"460\";",
|
||||||
|
" desc.sourceType = rendererID == LLGL::RendererID::OpenGL ? LLGL::ShaderSourceType::CodeString : LLGL::ShaderSourceType::BinaryBuffer;",
|
||||||
"",
|
"",
|
||||||
" auto shader = renderer->CreateShader(desc);",
|
" auto shader = renderer->CreateShader(desc);",
|
||||||
" if (auto report = shader->GetReport()) {",
|
" if (auto report = shader->GetReport()) {",
|
||||||
|
@ -84,6 +84,7 @@ namespace mirage {
|
|||||||
command_buffer->SetPipelineState(*pipeline.pipeline_state);
|
command_buffer->SetPipelineState(*pipeline.pipeline_state);
|
||||||
command_buffer->SetResource(0, param_buffer->get_raw());
|
command_buffer->SetResource(0, param_buffer->get_raw());
|
||||||
|
|
||||||
|
|
||||||
command_buffer->DrawIndexed(index_buffer->get_size() / sizeof(uint32_t), 0);
|
command_buffer->DrawIndexed(index_buffer->get_size() / sizeof(uint32_t), 0);
|
||||||
}
|
}
|
||||||
command_buffer->EndRenderPass();
|
command_buffer->EndRenderPass();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user