[dxbc] Removed <optional> dependency

This commit is contained in:
Philip Rebohle 2017-12-12 13:00:37 +01:00
parent 0558955388
commit 0f26d1c627
3 changed files with 28 additions and 24 deletions

View File

@ -547,13 +547,10 @@ namespace dxvk {
result = this->selectOperandComponents(token, result, dstMask);
// Apply source operand modifiers, if any
auto operandModifiers = operand.queryOperandExt(
DxbcOperandExt::OperandModifier);
DxbcOperandTokenExt token;
if (operandModifiers) {
result = this->applyOperandModifiers(
result, operandModifiers->data());
}
if (operand.queryOperandExt(DxbcOperandExt::OperandModifier, token))
result = this->applyOperandModifiers(result, token.data());
}
return result;

View File

@ -136,9 +136,9 @@ namespace dxvk {
}
std::optional<DxbcOperandTokenExt> DxbcOperand::queryOperandExt(DxbcOperandExt ext) const {
bool DxbcOperand::queryOperandExt(DxbcOperandExt ext, DxbcOperandTokenExt& token) const {
if (!this->token().isExtended())
return { };
return false;
uint32_t extTokenId = 1;
DxbcOperandTokenExt extToken;
@ -146,11 +146,13 @@ namespace dxvk {
do {
extToken = m_info.getWord(extTokenId++);
if (extToken.type() == ext)
return extToken;
if (extToken.type() == ext) {
token = extToken;
return true;
}
} while (extToken.isExtended());
return { };
return false;
}
@ -185,9 +187,9 @@ namespace dxvk {
}
std::optional<DxbcOpcodeTokenExt> DxbcInstruction::queryOpcodeExt(DxbcExtOpcode extOpcode) const {
bool DxbcInstruction::queryOpcodeExt(DxbcExtOpcode extOpcode, DxbcOpcodeTokenExt& token) const {
if (!this->token().isExtended())
return { };
return false;
uint32_t extTokenId = 1;
DxbcOpcodeTokenExt extToken;
@ -195,11 +197,13 @@ namespace dxvk {
do {
extToken = m_op.getWord(extTokenId++);
if (extToken.opcode() == extOpcode)
return extToken;
if (extToken.opcode() == extOpcode) {
token = extToken;
return true;
}
} while (extToken.isExtended());
return { };
return false;
}
}

View File

@ -1,7 +1,6 @@
#pragma once
#include <cstring>
#include <optional>
#include "dxbc_enums.h"
#include "dxbc_names.h"
@ -508,10 +507,12 @@ namespace dxvk {
* If an extended operand token with the given
* operand extension exists, return that token.
* \param [in] ext The operand extension
* \returns The extended operand token
* \param [out] token The extended token
* \returns \c true if the token was defined
*/
std::optional<DxbcOperandTokenExt> queryOperandExt(
DxbcOperandExt ext) const;
bool queryOperandExt(
DxbcOperandExt ext,
DxbcOperandTokenExt& token) const;
/**
* \brief Reads 32-bit immediate integer
@ -579,11 +580,13 @@ namespace dxvk {
*
* If an extended opcode token with the given
* opcode exists, the token will be returned.
* \param extOpcode Extended opcode
* \returns Extended opcode token
* \param [in] extOpcode Extended opcode
* \param [out] token The extended token
* \returns \c true if the token was defined
*/
std::optional<DxbcOpcodeTokenExt> queryOpcodeExt(
DxbcExtOpcode extOpcode) const;
bool queryOpcodeExt(
DxbcExtOpcode extOpcode,
DxbcOpcodeTokenExt& token) const;
/**
* \brief Retrieves argument word