diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-03-21 14:36:49 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-09-14 16:48:23 +0300 |
commit | 143dc4d896fbaa02e79052a9ae0d73166d13dbf9 (patch) | |
tree | 3b6c2898d28829b1e6a3b2d23893a7a6891240be | |
parent | e0b566ce995cb14717fad5d3370368a96c5d4823 (diff) |
vkd3d: Stub out DXBC code duplication for later.
When we have the ability to load PSO from identifiers only, we need to
retain DXBC blobs for later.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
-rw-r--r-- | libs/vkd3d/state.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 913eb1cd..415b60f4 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -3850,8 +3850,29 @@ static HRESULT d3d12_pipeline_state_init_static_pipeline(struct d3d12_pipeline_s static HRESULT d3d12_pipeline_state_finish_graphics(struct d3d12_pipeline_state *state) { struct d3d12_graphics_pipeline_state *graphics = &state->graphics; + unsigned int i; + void *new_code; HRESULT hr; + /* If we got here successfully without SPIR-V code, + * it means we'll need to defer compilation from DXBC -> SPIR-V. + * Dupe the DXBC code. + * TODO: This codepath is not relevant yet. */ + for (i = 0; i < graphics->stage_count; i++) + { + if (graphics->code[i].size || graphics->stages[i].module != VK_NULL_HANDLE || + !graphics->cached_desc.bytecode[i].BytecodeLength) + continue; + + new_code = vkd3d_malloc(graphics->cached_desc.bytecode[i].BytecodeLength); + if (!new_code) + return E_OUTOFMEMORY; + memcpy(new_code, graphics->cached_desc.bytecode[i].pShaderBytecode, + graphics->cached_desc.bytecode[i].BytecodeLength); + graphics->cached_desc.bytecode[i].pShaderBytecode = new_code; + graphics->cached_desc.bytecode_duped_mask |= 1u << i; + } + list_init(&graphics->compiled_fallback_pipelines); if (FAILED(hr = vkd3d_private_store_init(&state->private_store))) return hr; |