[D3D12] DXBC string append
This commit is contained in:
parent
1dc98d9133
commit
285de2a521
|
@ -14,6 +14,8 @@
|
|||
#include "third_party/dxbc/DXBCChecksum.h"
|
||||
#include "third_party/dxbc/d3d12TokenizedProgramFormat.hpp"
|
||||
|
||||
#include "xenia/base/math.h"
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
using namespace ucode;
|
||||
|
@ -58,5 +60,17 @@ std::vector<uint8_t> DxbcShaderTranslator::CompleteTranslation() {
|
|||
return shader_object_bytes;
|
||||
}
|
||||
|
||||
uint32_t DxbcShaderTranslator::AppendString(std::vector<uint32_t>& dest,
|
||||
const char* source) {
|
||||
size_t size = std::strlen(source) + 1;
|
||||
size_t size_aligned = xe::align(size_aligned, sizeof(uint32_t));
|
||||
size_t dest_pos = dest.size();
|
||||
dest.resize(dest_pos + size_aligned / sizeof(uint32_t));
|
||||
std::memcpy(&dest[dest_pos], source, size);
|
||||
std::memset(reinterpret_cast<uint8_t*>(&dest[dest_pos]) + size, 0xAB,
|
||||
size_aligned - size);
|
||||
return uint32_t(size_aligned);
|
||||
}
|
||||
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
|
|
@ -29,6 +29,9 @@ class DxbcShaderTranslator : public ShaderTranslator {
|
|||
std::vector<uint8_t> CompleteTranslation() override;
|
||||
|
||||
private:
|
||||
// Appends a string to a DWORD stream, returns the DWORD-aligned length.
|
||||
static uint32_t AppendString(std::vector<uint32_t>& dest, const char* source);
|
||||
|
||||
// Executable instructions - generated during translation.
|
||||
std::vector<uint32_t> shader_code_;
|
||||
// Complete shader object, with all the needed chunks and dcl_ instructions -
|
||||
|
|
Loading…
Reference in New Issue