[D3D12] SRV and sampler bindings

This commit is contained in:
Triang3l
2018-08-03 16:39:13 +03:00
parent 471ff6f157
commit 35aaa72722
10 changed files with 588 additions and 154 deletions

View File

@@ -27,7 +27,7 @@ namespace d3d12 {
PipelineCache::PipelineCache(D3D12CommandProcessor* command_processor,
RegisterFile* register_file)
: command_processor_(command_processor), register_file_(register_file) {
shader_translator_.reset(new HlslShaderTranslator());
shader_translator_ = std::make_unique<HlslShaderTranslator>();
// Set pipeline state description values we never change.
// Zero out tessellation, stream output, blend state and formats for render
@@ -158,6 +158,14 @@ bool PipelineCache::TranslateShader(D3D12Shader* shader,
return false;
}
uint32_t texture_srv_count, sampler_count;
const HlslShaderTranslator::TextureSRV* texture_srvs =
shader_translator_->GetTextureSRVs(texture_srv_count);
const uint32_t* sampler_fetch_constants =
shader_translator_->GetSamplerFetchConstants(sampler_count);
shader->SetTexturesAndSamplers(texture_srvs, texture_srv_count,
sampler_fetch_constants, sampler_count);
// Prepare the shader for use (creates the Shader Model bytecode).
// It could still fail at this point.
if (!shader->Prepare()) {