Remove getRaw() from DepthTest

State::getKey removed because it breaks and is not referenced from anywhere.
This commit is contained in:
Dale Glass 2020-01-14 23:00:08 +01:00
parent ea36e7a239
commit 8f65a90453
4 changed files with 16 additions and 28 deletions

View file

@ -204,10 +204,7 @@ void GLBackend::do_setStateDepthTest(State::DepthTest test) {
glDepthFunc(COMPARISON_TO_GL[test.getFunction()]);
}
if (CHECK_GL_ERROR()) {
qCDebug(gpulogging) << "DepthTest" << (test.isEnabled() ? "Enabled" : "Disabled")
<< "Mask=" << (test.getWriteMask() ? "Write" : "no Write")
<< "Func=" << (uint16_t)test.getFunction()
<< "Raw=" << test.getRaw();
qCDebug(gpulogging) << "DepthTest = " << test;
}
_pipeline._stateCache.depthTest = test;
}

View file

@ -119,7 +119,7 @@ void generateDepthBias(GLState::Commands& commands, const State& state) {
}
void generateDepthTest(GLState::Commands& commands, const State::DepthTest& test) {
commands.push_back(std::make_shared<CommandDepthTest>(&GLBackend::do_setStateDepthTest, int32(test.getRaw())));
commands.push_back(std::make_shared<CommandDepthTest>(&GLBackend::do_setStateDepthTest, test));
}
void generateStencil(GLState::Commands& commands, const State& state) {

View file

@ -94,20 +94,3 @@ static std::string hex(T t) {
stream << std::hex << t;
return stream.str();
}
std::string State::getKey() const {
std::string key;
key = hex(*(int*)&_values.depthBias);
key += ":" + hex(*(int*)&_values.depthBiasSlopeScale);
key += ":" + hex(_values.depthTest.getRaw());
key += ":" + hex(_values.stencilActivation.getRaw());
key += ":" + hex(_values.stencilTestFront.getRaw());
key += ":" + hex(_values.stencilTestBack.getRaw());
key += ":" + hex(_values.blendFunction.getRaw());
key += ":" + hex(_values.sampleMask);
// fillMode, cullMode, colorMaskWrite and the flags consume 32 bits alltogether
static_assert(0 == offsetof(State::Data, fillMode) % 4, "Validate fillMode offset");
key += ":" + hex(*(int*)&_values.fillMode);
return key;
}

View file

@ -18,6 +18,7 @@
#include <vector>
#include <unordered_map>
#include <bitset>
#include <QString>
// Why a macro and not a fancy template you will ask me ?
// Because some of the fields are bool packed tightly in the State::Cache class
@ -134,10 +135,19 @@ public:
ComparisonFunction getFunction() const { return function; }
uint8 getWriteMask() const { return writeMask; }
int32 getRaw() const { return *(reinterpret_cast<const int32*>(this)); }
DepthTest(int32 raw) { *(reinterpret_cast<int32*>(this)) = raw; }
bool operator==(const DepthTest& right) const { return getRaw() == right.getRaw(); }
bool operator!=(const DepthTest& right) const { return getRaw() != right.getRaw(); }
bool operator==(const DepthTest& right) const {
return writeMask == right.writeMask && enabled == right.enabled && function == right.function;
}
bool operator!=(const DepthTest& right) const {
return writeMask != right.writeMask || enabled != right.enabled || function != right.function;
}
operator QString() const {
return QString("{ writeMask = %1, enabled = %2, function = %3 }").arg(writeMask).arg(enabled).arg(function);
}
};
struct StencilTest {
@ -280,8 +290,6 @@ public:
Flags flags;
};
std::string getKey() const;
// The unique default values for all the fields
static const Data DEFAULT;
void setFillMode(FillMode fill) { SET_FIELD(FILL_MODE, fillMode, fill); }