[D3D12] Cleanup: pipeline state -> pipeline, other things
This commit is contained in:
@@ -65,17 +65,17 @@ enum class InstructionStorageTarget {
|
||||
// disassembly (because oPts.x000 will be assembled, but oPts.x00_ has both
|
||||
// skipped components and zeros, which cannot be encoded, and therefore it will
|
||||
// not).
|
||||
constexpr uint32_t GetInstructionStorageTargetUsedComponents(
|
||||
constexpr uint32_t GetInstructionStorageTargetUsedComponentCount(
|
||||
InstructionStorageTarget target) {
|
||||
switch (target) {
|
||||
case InstructionStorageTarget::kNone:
|
||||
return 0b0000;
|
||||
return 0;
|
||||
case InstructionStorageTarget::kPointSizeEdgeFlagKillVertex:
|
||||
return 0b0111;
|
||||
return 3;
|
||||
case InstructionStorageTarget::kDepth:
|
||||
return 0b0001;
|
||||
return 1;
|
||||
default:
|
||||
return 0b1111;
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,8 +136,9 @@ struct InstructionResult {
|
||||
// Returns the write mask containing only components actually present in the
|
||||
// target.
|
||||
uint32_t GetUsedWriteMask() const {
|
||||
return original_write_mask &
|
||||
GetInstructionStorageTargetUsedComponents(storage_target);
|
||||
uint32_t target_component_count =
|
||||
GetInstructionStorageTargetUsedComponentCount(storage_target);
|
||||
return original_write_mask & ((1 << target_component_count) - 1);
|
||||
}
|
||||
// True if the components are in their 'standard' swizzle arrangement (xyzw).
|
||||
bool IsStandardSwizzle() const {
|
||||
@@ -161,6 +162,28 @@ struct InstructionResult {
|
||||
}
|
||||
return used_components;
|
||||
}
|
||||
// Returns which components of the used write mask are constant, and what
|
||||
// values they have.
|
||||
uint32_t GetUsedConstantComponents(uint32_t& constant_values_out) const {
|
||||
uint32_t constant_components = 0;
|
||||
uint32_t constant_values = 0;
|
||||
uint32_t used_write_mask = GetUsedWriteMask();
|
||||
for (uint32_t i = 0; i < 4; ++i) {
|
||||
if (!(used_write_mask & (1 << i))) {
|
||||
continue;
|
||||
}
|
||||
SwizzleSource component = components[i];
|
||||
if (component >= SwizzleSource::kX && component <= SwizzleSource::kW) {
|
||||
continue;
|
||||
}
|
||||
constant_components |= 1 << i;
|
||||
if (component == SwizzleSource::k1) {
|
||||
constant_values |= 1 << i;
|
||||
}
|
||||
}
|
||||
constant_values_out = constant_values;
|
||||
return constant_components;
|
||||
}
|
||||
};
|
||||
|
||||
enum class InstructionStorageSource {
|
||||
|
||||
Reference in New Issue
Block a user