1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 19:24:12 +01:00

[dxbc] Don't use rvalue references for file streams

This commit is contained in:
Philip Rebohle 2018-03-23 18:17:16 +01:00
parent 0a2fa590f5
commit ba9e1f307d
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 16 additions and 13 deletions

View File

@ -40,8 +40,11 @@ namespace dxvk {
m_shader->setDebugName(m_name); m_shader->setDebugName(m_name);
if (dumpPath.size() != 0) { if (dumpPath.size() != 0) {
m_shader->dump(std::ofstream(str::format(dumpPath, "/", m_name, ".spv"), std::ofstream dumpStream(
std::ios_base::binary | std::ios_base::trunc)); str::format(dumpPath, "/", m_name, ".spv"),
std::ios_base::binary | std::ios_base::trunc);
m_shader->dump(dumpStream);
} }
// If requested by the user, replace // If requested by the user, replace
@ -53,7 +56,7 @@ namespace dxvk {
std::ios_base::binary); std::ios_base::binary);
if (readStream) if (readStream)
m_shader->read(std::move(readStream)); m_shader->read(readStream);
} }
} }

View File

@ -86,13 +86,13 @@ namespace dxvk {
} }
void DxvkShader::dump(std::ostream&& outputStream) const { void DxvkShader::dump(std::ostream& outputStream) const {
m_code.store(std::move(outputStream)); m_code.store(outputStream);
} }
void DxvkShader::read(std::istream&& inputStream) { void DxvkShader::read(std::istream& inputStream) {
m_code = SpirvCodeBuffer(std::move(inputStream)); m_code = SpirvCodeBuffer(inputStream);
} }
} }

View File

@ -137,7 +137,7 @@ namespace dxvk {
* Can be used to store the SPIR-V code in a file. * Can be used to store the SPIR-V code in a file.
* \param [in] outputStream Stream to write to * \param [in] outputStream Stream to write to
*/ */
void dump(std::ostream&& outputStream) const; void dump(std::ostream& outputStream) const;
/** /**
* \brief Reads SPIR-V shader * \brief Reads SPIR-V shader
@ -145,7 +145,7 @@ namespace dxvk {
* Can be used to replace the compiled SPIR-V code. * Can be used to replace the compiled SPIR-V code.
* \param [in] inputStream Stream to read from * \param [in] inputStream Stream to read from
*/ */
void read(std::istream&& inputStream); void read(std::istream& inputStream);
/** /**
* \brief Sets the shader's debug name * \brief Sets the shader's debug name

View File

@ -16,7 +16,7 @@ namespace dxvk {
} }
SpirvCodeBuffer::SpirvCodeBuffer(std::istream&& stream) { SpirvCodeBuffer::SpirvCodeBuffer(std::istream& stream) {
stream.ignore(std::numeric_limits<std::streamsize>::max()); stream.ignore(std::numeric_limits<std::streamsize>::max());
std::streamsize length = stream.gcount(); std::streamsize length = stream.gcount();
stream.clear(); stream.clear();
@ -122,7 +122,7 @@ namespace dxvk {
} }
void SpirvCodeBuffer::store(std::ostream&& stream) const { void SpirvCodeBuffer::store(std::ostream& stream) const {
stream.write( stream.write(
reinterpret_cast<const char*>(m_code.data()), reinterpret_cast<const char*>(m_code.data()),
sizeof(uint32_t) * m_code.size()); sizeof(uint32_t) * m_code.size());

View File

@ -22,7 +22,7 @@ namespace dxvk {
SpirvCodeBuffer(); SpirvCodeBuffer();
SpirvCodeBuffer(uint32_t size, const uint32_t* data); SpirvCodeBuffer(uint32_t size, const uint32_t* data);
SpirvCodeBuffer(std::istream&& stream); SpirvCodeBuffer(std::istream& stream);
template<size_t N> template<size_t N>
SpirvCodeBuffer(const uint32_t (&data)[N]) SpirvCodeBuffer(const uint32_t (&data)[N])
@ -146,7 +146,7 @@ namespace dxvk {
* exists mostly for debugging purposes. * exists mostly for debugging purposes.
* \param [in] stream Output stream * \param [in] stream Output stream
*/ */
void store(std::ostream&& stream) const; void store(std::ostream& stream) const;
/** /**
* \brief Retrieves current insertion pointer * \brief Retrieves current insertion pointer