[D3D12] Pipeline cache and command processor formatting
This commit is contained in:
parent
b567b9e9cc
commit
2d59231993
|
@ -151,8 +151,8 @@ bool D3D12CommandProcessor::IssueDraw(PrimitiveType primitive_type,
|
||||||
ID3D12RootSignature* root_signature;
|
ID3D12RootSignature* root_signature;
|
||||||
auto pipeline_status = pipeline_cache_->ConfigurePipeline(
|
auto pipeline_status = pipeline_cache_->ConfigurePipeline(
|
||||||
vertex_shader, pixel_shader, primitive_type,
|
vertex_shader, pixel_shader, primitive_type,
|
||||||
index_buffer_info != nullptr ? index_buffer_info->format :
|
index_buffer_info != nullptr ? index_buffer_info->format
|
||||||
IndexFormat::kInt16,
|
: IndexFormat::kInt16,
|
||||||
&pipeline, &root_signature);
|
&pipeline, &root_signature);
|
||||||
if (pipeline_status == PipelineCache::UpdateStatus::kError) {
|
if (pipeline_status == PipelineCache::UpdateStatus::kError) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -67,8 +67,8 @@ PipelineCache::UpdateStatus PipelineCache::ConfigurePipeline(
|
||||||
assert_not_null(root_signature_out);
|
assert_not_null(root_signature_out);
|
||||||
|
|
||||||
Pipeline* pipeline = nullptr;
|
Pipeline* pipeline = nullptr;
|
||||||
auto update_status = UpdateState(vertex_shader, pixel_shader, primitive_type,
|
auto update_status =
|
||||||
index_format);
|
UpdateState(vertex_shader, pixel_shader, primitive_type, index_format);
|
||||||
switch (update_status) {
|
switch (update_status) {
|
||||||
case UpdateStatus::kCompatible:
|
case UpdateStatus::kCompatible:
|
||||||
// Requested pipeline is compatible with our previous one, so use that.
|
// Requested pipeline is compatible with our previous one, so use that.
|
||||||
|
@ -280,8 +280,8 @@ PipelineCache::UpdateStatus PipelineCache::UpdateShaderStages(
|
||||||
return UpdateStatus::kError;
|
return UpdateStatus::kError;
|
||||||
}
|
}
|
||||||
update_desc_.PrimitiveTopologyType =
|
update_desc_.PrimitiveTopologyType =
|
||||||
primitive_topology_is_line ? D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE :
|
primitive_topology_is_line ? D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE
|
||||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
: D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||||
|
|
||||||
return UpdateStatus::kMismatch;
|
return UpdateStatus::kMismatch;
|
||||||
}
|
}
|
||||||
|
@ -314,8 +314,7 @@ PipelineCache::UpdateStatus PipelineCache::UpdateBlendState(
|
||||||
regs.colorcontrol_blend_enable = blend_enable;
|
regs.colorcontrol_blend_enable = blend_enable;
|
||||||
static const Register kBlendControlRegs[] = {
|
static const Register kBlendControlRegs[] = {
|
||||||
XE_GPU_REG_RB_BLENDCONTROL_0, XE_GPU_REG_RB_BLENDCONTROL_1,
|
XE_GPU_REG_RB_BLENDCONTROL_0, XE_GPU_REG_RB_BLENDCONTROL_1,
|
||||||
XE_GPU_REG_RB_BLENDCONTROL_2, XE_GPU_REG_RB_BLENDCONTROL_3
|
XE_GPU_REG_RB_BLENDCONTROL_2, XE_GPU_REG_RB_BLENDCONTROL_3};
|
||||||
};
|
|
||||||
for (uint32_t i = 0; i < 4; ++i) {
|
for (uint32_t i = 0; i < 4; ++i) {
|
||||||
if (blend_enable && (color_mask & (0xF << (i * 4)))) {
|
if (blend_enable && (color_mask & (0xF << (i * 4)))) {
|
||||||
dirty |= SetShadowRegister(®s.blendcontrol[i], kBlendControlRegs[i]);
|
dirty |= SetShadowRegister(®s.blendcontrol[i], kBlendControlRegs[i]);
|
||||||
|
@ -541,8 +540,8 @@ PipelineCache::UpdateStatus PipelineCache::UpdateDepthStencilState() {
|
||||||
update_desc_.DepthStencilState.DepthEnable =
|
update_desc_.DepthStencilState.DepthEnable =
|
||||||
(regs.rb_depthcontrol & 0x2) ? TRUE : FALSE;
|
(regs.rb_depthcontrol & 0x2) ? TRUE : FALSE;
|
||||||
update_desc_.DepthStencilState.DepthWriteMask =
|
update_desc_.DepthStencilState.DepthWriteMask =
|
||||||
(regs.rb_depthcontrol & 0x4) ? D3D12_DEPTH_WRITE_MASK_ALL :
|
(regs.rb_depthcontrol & 0x4) ? D3D12_DEPTH_WRITE_MASK_ALL
|
||||||
D3D12_DEPTH_WRITE_MASK_ZERO;
|
: D3D12_DEPTH_WRITE_MASK_ZERO;
|
||||||
// Comparison functions are the same in Direct3D 12 but plus one (minus one,
|
// Comparison functions are the same in Direct3D 12 but plus one (minus one,
|
||||||
// bit 0 for less, bit 1 for equal, bit 2 for greater).
|
// bit 0 for less, bit 1 for equal, bit 2 for greater).
|
||||||
update_desc_.DepthStencilState.DepthFunc =
|
update_desc_.DepthStencilState.DepthFunc =
|
||||||
|
@ -592,9 +591,9 @@ PipelineCache::UpdateStatus PipelineCache::UpdateIBStripCutValue(
|
||||||
D3D12_INDEX_BUFFER_STRIP_CUT_VALUE ib_strip_cut_value =
|
D3D12_INDEX_BUFFER_STRIP_CUT_VALUE ib_strip_cut_value =
|
||||||
D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED;
|
D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED;
|
||||||
if (register_file_->values[XE_GPU_REG_PA_SU_SC_MODE_CNTL].u32 & (1 << 21)) {
|
if (register_file_->values[XE_GPU_REG_PA_SU_SC_MODE_CNTL].u32 & (1 << 21)) {
|
||||||
ib_strip_cut_value = index_format == IndexFormat::kInt32 ?
|
ib_strip_cut_value = index_format == IndexFormat::kInt32
|
||||||
D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFFFFFF :
|
? D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFFFFFF
|
||||||
D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFF;
|
: D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFF;
|
||||||
}
|
}
|
||||||
dirty |= regs.ib_strip_cut_value != ib_strip_cut_value;
|
dirty |= regs.ib_strip_cut_value != ib_strip_cut_value;
|
||||||
regs.ib_strip_cut_value = ib_strip_cut_value;
|
regs.ib_strip_cut_value = ib_strip_cut_value;
|
||||||
|
@ -841,7 +840,8 @@ ID3D12RootSignature* PipelineCache::GetRootSignature(
|
||||||
ID3DBlob* error_blob = nullptr;
|
ID3DBlob* error_blob = nullptr;
|
||||||
if (FAILED(D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1,
|
if (FAILED(D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1,
|
||||||
&blob, &error_blob))) {
|
&blob, &error_blob))) {
|
||||||
XELOGE("Failed to serialize a root signature with %u pixel textures, %u "
|
XELOGE(
|
||||||
|
"Failed to serialize a root signature with %u pixel textures, %u "
|
||||||
"pixel samplers, %u vertex textures and %u vertex samplers",
|
"pixel samplers, %u vertex textures and %u vertex samplers",
|
||||||
pixel_textures, pixel_samplers, vertex_textures, vertex_samplers);
|
pixel_textures, pixel_samplers, vertex_textures, vertex_samplers);
|
||||||
if (error_blob != nullptr) {
|
if (error_blob != nullptr) {
|
||||||
|
@ -860,7 +860,8 @@ ID3D12RootSignature* PipelineCache::GetRootSignature(
|
||||||
if (FAILED(device->CreateRootSignature(0, blob->GetBufferPointer(),
|
if (FAILED(device->CreateRootSignature(0, blob->GetBufferPointer(),
|
||||||
blob->GetBufferSize(),
|
blob->GetBufferSize(),
|
||||||
IID_PPV_ARGS(&root_signature)))) {
|
IID_PPV_ARGS(&root_signature)))) {
|
||||||
XELOGE("Failed to create a root signature with %u pixel textures, %u pixel "
|
XELOGE(
|
||||||
|
"Failed to create a root signature with %u pixel textures, %u pixel "
|
||||||
"samplers, %u vertex textures and %u vertex samplers",
|
"samplers, %u vertex textures and %u vertex samplers",
|
||||||
pixel_textures, pixel_samplers, vertex_textures, vertex_samplers);
|
pixel_textures, pixel_samplers, vertex_textures, vertex_samplers);
|
||||||
blob->Release();
|
blob->Release();
|
||||||
|
|
Loading…
Reference in New Issue