[D3D12] DXBC STAT writing

This commit is contained in:
Triang3l
2018-08-30 14:42:17 +03:00
parent 501bec8e5e
commit c6e0c66c44
2 changed files with 63 additions and 0 deletions

View File

@@ -32,6 +32,8 @@ void DxbcShaderTranslator::Reset() {
rdef_constants_used_ = 0;
writes_depth_ = false;
std::memset(&stat_, 0, sizeof(stat_));
}
std::vector<uint8_t> DxbcShaderTranslator::CompleteTranslation() {
@@ -85,6 +87,18 @@ std::vector<uint8_t> DxbcShaderTranslator::CompleteTranslation() {
(uint32_t(shader_object_.size()) - chunk_position_dwords - 2) *
sizeof(uint32_t);
// TODO(Triang3l): Write SHEX.
// Write STATistics.
chunk_position_dwords = uint32_t(shader_object_.size());
shader_object_[12] = chunk_position_dwords * sizeof(uint32_t);
shader_object_.push_back('TATS');
shader_object_.push_back(sizeof(stat_));
shader_object_.resize(shader_object_.size() +
sizeof(stat_) / sizeof(uint32_t));
std::memcpy(&shader_object_[chunk_position_dwords + 2], &stat_,
sizeof(stat_));
// Fill the remaining fields of the header and copy bytes out.
uint32_t shader_object_size =
uint32_t(shader_object_.size() * sizeof(uint32_t));