1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582
|
/*
** Copyright (c) 2021 LunarG, Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and associated documentation files (the "Software"),
** to deal in the Software without restriction, including without limitation
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
** and/or sell copies of the Software, and to permit persons to whom the
** Software is furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
** FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
*/
#include "decode/dx12_decoder_base.h"
#include "decode/custom_dx12_struct_decoders.h"
#include "generated/generated_dx12_struct_decoders.h"
GFXRECON_BEGIN_NAMESPACE(gfxrecon)
GFXRECON_BEGIN_NAMESPACE(decode)
void Dx12DecoderBase::DispatchStateBeginMarker(uint64_t frame_number)
{
for (auto consumer : consumers_)
{
consumer->ProcessStateBeginMarker(frame_number);
}
}
void Dx12DecoderBase::DispatchStateEndMarker(uint64_t frame_number)
{
for (auto consumer : consumers_)
{
consumer->ProcessStateEndMarker(frame_number);
}
}
void Dx12DecoderBase::DispatchDisplayMessageCommand(format::ThreadId thread_id, const std::string& message)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessDisplayMessageCommand(message);
}
}
void Dx12DecoderBase::DispatchFillMemoryCommand(
format::ThreadId thread_id, uint64_t memory_id, uint64_t offset, uint64_t size, const uint8_t* data)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessFillMemoryCommand(memory_id, offset, size, data);
}
}
void Dx12DecoderBase::DispatchFillMemoryResourceValueCommand(
const format::FillMemoryResourceValueCommandHeader& command_header, const uint8_t* data)
{
for (auto consumer : consumers_)
{
consumer->ProcessFillMemoryResourceValueCommand(command_header, data);
}
}
void Dx12DecoderBase::DispatchResizeWindowCommand(format::ThreadId thread_id,
format::HandleId surface_id,
uint32_t width,
uint32_t height)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessResizeWindowCommand(surface_id, width, height);
}
}
void Dx12DecoderBase::DispatchResizeWindowCommand2(
format::ThreadId thread_id, format::HandleId surface_id, uint32_t width, uint32_t height, uint32_t pre_transform)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessResizeWindowCommand2(surface_id, width, height, pre_transform);
}
}
void Dx12DecoderBase::DispatchCreateHardwareBufferCommand(
format::ThreadId thread_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
uint32_t width,
uint32_t height,
uint32_t stride,
uint64_t usage,
uint32_t layers,
const std::vector<format::HardwareBufferPlaneInfo>& plane_info)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessCreateHardwareBufferCommand(
memory_id, buffer_id, format, width, height, stride, usage, layers, plane_info);
}
}
void Dx12DecoderBase::DispatchDestroyHardwareBufferCommand(format::ThreadId thread_id, uint64_t buffer_id)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessDestroyHardwareBufferCommand(buffer_id);
}
}
void Dx12DecoderBase::DispatchCreateHeapAllocationCommand(format::ThreadId thread_id,
uint64_t allocation_id,
uint64_t allocation_size)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessCreateHeapAllocationCommand(allocation_id, allocation_size);
}
}
void Dx12DecoderBase::DispatchSetDevicePropertiesCommand(format::ThreadId thread_id,
format::HandleId physical_device_id,
uint32_t api_version,
uint32_t driver_version,
uint32_t vendor_id,
uint32_t device_id,
uint32_t device_type,
const uint8_t pipeline_cache_uuid[format::kUuidSize],
const std::string& device_name)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessSetDevicePropertiesCommand(physical_device_id,
api_version,
driver_version,
vendor_id,
device_id,
device_type,
pipeline_cache_uuid,
device_name);
}
}
void Dx12DecoderBase::DispatchSetDeviceMemoryPropertiesCommand(
format::ThreadId thread_id,
format::HandleId physical_device_id,
const std::vector<format::DeviceMemoryType>& memory_types,
const std::vector<format::DeviceMemoryHeap>& memory_heaps)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessSetDeviceMemoryPropertiesCommand(physical_device_id, memory_types, memory_heaps);
}
}
void Dx12DecoderBase::DispatchSetOpaqueAddressCommand(format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId object_id,
uint64_t address)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessSetOpaqueAddressCommand(device_id, object_id, address);
}
}
void Dx12DecoderBase::DispatchSetRayTracingShaderGroupHandlesCommand(format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId pipeline_id,
size_t data_size,
const uint8_t* data)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessSetRayTracingShaderGroupHandlesCommand(device_id, pipeline_id, data_size, data);
}
}
void Dx12DecoderBase::DispatchSetSwapchainImageStateCommand(
format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId swapchain_id,
uint32_t current_buffer_index,
const std::vector<format::SwapchainImageStateInfo>& image_state)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessSetSwapchainImageStateCommand(device_id, swapchain_id, current_buffer_index, image_state);
}
}
void Dx12DecoderBase::DispatchBeginResourceInitCommand(format::ThreadId thread_id,
format::HandleId device_id,
uint64_t max_resource_size,
uint64_t max_copy_size)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessBeginResourceInitCommand(device_id, max_resource_size, max_copy_size);
}
}
void Dx12DecoderBase::DispatchEndResourceInitCommand(format::ThreadId thread_id, format::HandleId device_id)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessEndResourceInitCommand(device_id);
}
}
void Dx12DecoderBase::DispatchInitBufferCommand(format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId buffer_id,
uint64_t data_size,
const uint8_t* data)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessInitBufferCommand(device_id, buffer_id, data_size, data);
}
}
void Dx12DecoderBase::DispatchInitImageCommand(format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId image_id,
uint64_t data_size,
uint32_t aspect,
uint32_t layout,
const std::vector<uint64_t>& level_sizes,
const uint8_t* data)
{
GFXRECON_UNREFERENCED_PARAMETER(thread_id);
for (auto consumer : consumers_)
{
consumer->ProcessInitImageCommand(device_id, image_id, data_size, aspect, layout, level_sizes, data);
}
}
void Dx12DecoderBase::DispatchInitSubresourceCommand(const format::InitSubresourceCommandHeader& command_header,
const uint8_t* data)
{
for (auto consumer : consumers_)
{
consumer->ProcessInitSubresourceCommand(command_header, data);
}
}
void Dx12DecoderBase::DispatchInitDx12AccelerationStructureCommand(
const format::InitDx12AccelerationStructureCommandHeader& command_header,
std::vector<format::InitDx12AccelerationStructureGeometryDesc>& geometry_descs,
const uint8_t* build_inputs_data)
{
for (auto consumer : consumers_)
{
consumer->ProcessInitDx12AccelerationStructureCommand(command_header, geometry_descs, build_inputs_data);
}
}
void Dx12DecoderBase::DispatchGetDxgiAdapterInfo(const format::DxgiAdapterInfoCommandHeader& dx12_adapter_info_header)
{
for (auto consumer : consumers_)
{
consumer->ProcessDxgiAdapterInfo(dx12_adapter_info_header);
}
}
void Dx12DecoderBase::DispatchGetDx12RuntimeInfo(const format::Dx12RuntimeInfoCommandHeader& dx12_runtime_info_header)
{
for (auto consumer : consumers_)
{
consumer->ProcessDx12RuntimeInfo(dx12_runtime_info_header);
}
}
void Dx12DecoderBase::SetCurrentBlockIndex(uint64_t block_index)
{
for (auto consumer : consumers_)
{
consumer->SetCurrentBlockIndex(block_index);
}
}
size_t Dx12DecoderBase::Decode_ID3D12Device_CheckFeatureSupport(format::HandleId object_id,
const uint8_t* parameter_buffer,
size_t buffer_size)
{
size_t bytes_read = 0;
D3D12_FEATURE feature{};
bytes_read += ValueDecoder::DecodeEnumValue((parameter_buffer + bytes_read), (buffer_size - bytes_read), &feature);
switch (feature)
{
case D3D12_FEATURE_D3D12_OPTIONS:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_ARCHITECTURE:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_ARCHITECTURE>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_FEATURE_LEVELS:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_FEATURE_LEVELS>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_FORMAT_SUPPORT:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_FORMAT_SUPPORT>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_FORMAT_INFO:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_FORMAT_INFO>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_SHADER_MODEL:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_SHADER_MODEL>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS1:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS1>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_SUPPORT:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_SUPPORT>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_ROOT_SIGNATURE:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_ROOT_SIGNATURE>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_ARCHITECTURE1:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_ARCHITECTURE1>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS2:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS2>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_SHADER_CACHE:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_SHADER_CACHE>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_COMMAND_QUEUE_PRIORITY:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS3:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS3>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_EXISTING_HEAPS:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_EXISTING_HEAPS>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS4:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS4>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_SERIALIZATION:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_SERIALIZATION>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_CROSS_NODE:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_CROSS_NODE>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS5:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS5>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS6:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS6>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_QUERY_META_COMMAND:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_QUERY_META_COMMAND>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS7:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS7>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS8:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS8>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS9:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS9>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS10:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS10>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS11:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS11>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS12:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS12>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS13:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS13>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS14:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS14>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS15:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS15>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPE_COUNT:
bytes_read +=
DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPES:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
default:
GFXRECON_LOG_FATAL("Failed to decode ID3D12Device::CheckFeatureSupport pFeatureData parameter with "
"unrecognized D3D12_FEATURE type %d",
feature);
break;
}
return bytes_read;
}
size_t Dx12DecoderBase::Decode_IDXGIFactory5_CheckFeatureSupport(format::HandleId object_id,
const uint8_t* parameter_buffer,
size_t buffer_size)
{
size_t bytes_read = 0;
DXGI_FEATURE feature{};
UINT feature_data_size = 0;
HRESULT return_value = E_FAIL;
bytes_read += ValueDecoder::DecodeEnumValue((parameter_buffer + bytes_read), (buffer_size - bytes_read), &feature);
switch (feature)
{
case DXGI_FEATURE_PRESENT_ALLOW_TEARING:
{
BOOL allow_tearing = FALSE;
bytes_read += ValueDecoder::DecodeInt32Value(
(parameter_buffer + bytes_read), (buffer_size - bytes_read), &allow_tearing);
bytes_read += ValueDecoder::DecodeUInt32Value(
(parameter_buffer + bytes_read), (buffer_size - bytes_read), &feature_data_size);
bytes_read += ValueDecoder::DecodeInt32Value(
(parameter_buffer + bytes_read), (buffer_size - bytes_read), &return_value);
for (auto consumer : GetConsumers())
{
consumer->Process_IDXGIFactory5_CheckFeatureSupport(object_id,
return_value,
feature,
static_cast<void*>(&allow_tearing),
static_cast<void*>(&allow_tearing),
feature_data_size);
}
}
break;
default:
GFXRECON_LOG_FATAL("Failed to decode IDXGIFactory5::CheckFeatureSupport pFeatureData parameter with "
"unrecognized DXGI_FEATURE type %d",
feature);
break;
}
return bytes_read;
}
size_t Dx12DecoderBase::Decode_ID3D12Resource_WriteToSubresource(format::HandleId object_id,
const uint8_t* parameter_buffer,
size_t buffer_size)
{
size_t bytes_read = 0;
UINT DstSubresource;
StructPointerDecoder<Decoded_D3D12_BOX> pDstBox;
PointerDecoder<uint8_t> pSrcData;
UINT SrcRowPitch;
UINT SrcDepthPitch;
HRESULT return_value;
bytes_read +=
ValueDecoder::DecodeUInt32Value((parameter_buffer + bytes_read), (buffer_size - bytes_read), &DstSubresource);
bytes_read += pDstBox.Decode((parameter_buffer + bytes_read), (buffer_size - bytes_read));
bytes_read += pSrcData.DecodeVoid((parameter_buffer + bytes_read), (buffer_size - bytes_read));
bytes_read +=
ValueDecoder::DecodeUInt32Value((parameter_buffer + bytes_read), (buffer_size - bytes_read), &SrcRowPitch);
bytes_read +=
ValueDecoder::DecodeUInt32Value((parameter_buffer + bytes_read), (buffer_size - bytes_read), &SrcDepthPitch);
bytes_read +=
ValueDecoder::DecodeInt32Value((parameter_buffer + bytes_read), (buffer_size - bytes_read), &return_value);
for (auto consumer : GetConsumers())
{
consumer->Process_ID3D12Resource_WriteToSubresource(
object_id, return_value, DstSubresource, &pDstBox, pSrcData.GetPointer(), SrcRowPitch, SrcDepthPitch);
}
return bytes_read;
}
void Dx12DecoderBase::DecodeMethodCall(format::ApiCallId call_id,
format::HandleId object_id,
const ApiCallInfo& call_options,
const uint8_t* parameter_buffer,
size_t buffer_size)
{
GFXRECON_UNREFERENCED_PARAMETER(call_options);
switch (call_id)
{
case format::ApiCallId::ApiCall_ID3D12Device_CheckFeatureSupport:
Decode_ID3D12Device_CheckFeatureSupport(object_id, parameter_buffer, buffer_size);
break;
case format::ApiCallId::ApiCall_IDXGIFactory5_CheckFeatureSupport:
Decode_IDXGIFactory5_CheckFeatureSupport(object_id, parameter_buffer, buffer_size);
break;
case format::ApiCallId::ApiCall_ID3D12Resource_WriteToSubresource:
Decode_ID3D12Resource_WriteToSubresource(object_id, parameter_buffer, buffer_size);
break;
default:
break;
}
}
GFXRECON_END_NAMESPACE(decode)
GFXRECON_END_NAMESPACE(gfxrecon)
|