[D3D12] Update some comments about numeric formats

This commit is contained in:
Triang3l 2018-12-28 14:12:09 +03:00
parent f3e3bbc4fa
commit 43866092a5
3 changed files with 9 additions and 9 deletions

View File

@ -447,8 +447,6 @@ void DxbcShaderTranslator::ExportToMemory() {
uint32_t format_param_temp = PushSystemTemp(); uint32_t format_param_temp = PushSystemTemp();
// Denormalize, clamp and convert to integer. // Denormalize, clamp and convert to integer.
// TODO(Triang3l): Really clamp? It's GPUSURFACENUMBER_UREPEAT, not clamp,
// but need to verify since not clamping doesn't look very safe.
// A lot of the code is similar for both signed and unsigned. Start by // A lot of the code is similar for both signed and unsigned. Start by
// checking the signedness. // checking the signedness.
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_IF) | shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_IF) |

View File

@ -729,10 +729,10 @@ void DxbcShaderTranslator::CompletePixelShader_DepthTo24Bit(
++stat_.instruction_count; ++stat_.instruction_count;
++stat_.float_instruction_count; ++stat_.float_instruction_count;
// Round to the nearest integer. This is the correct way of rounding, rounding // Round to the nearest even integer. This seems to be the correct way:
// towards zero gives 0xFF instead of 0x100 in clear shaders in, for instance, // rounding towards zero gives 0xFF instead of 0x100 in clear shaders in, for
// Halo 3. // instance, Halo 3, but other clear shaders in it are also broken if 0.5 is
// https://docs.microsoft.com/en-us/windows/desktop/direct3d10/d3d10-graphics-programming-guide-resources-data-conversion // added before ftou instead of round_ne.
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_ROUND_NE) | shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_ROUND_NE) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(5)); ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(5));
shader_code_.push_back( shader_code_.push_back(
@ -3646,8 +3646,9 @@ void DxbcShaderTranslator::CompletePixelShader_WriteToROV_PackColor(
++stat_.instruction_count; ++stat_.instruction_count;
++stat_.float_instruction_count; ++stat_.float_instruction_count;
// Convert to fixed-point, rounding to the nearest integer. // Convert to fixed-point, rounding towards the nearest even integer.
// https://docs.microsoft.com/en-us/windows/desktop/direct3d10/d3d10-graphics-programming-guide-resources-data-conversion // Rounding towards the nearest (adding +-0.5 before truncating) is giving
// incorrect results for depth, so better to use round_ne here too.
uint32_t fixed_temp = PushSystemTemp(); uint32_t fixed_temp = PushSystemTemp();
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_ROUND_NE) | shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_ROUND_NE) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(5)); ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(5));

View File

@ -156,7 +156,8 @@ enum class IndexFormat : uint32_t {
kInt32, kInt32,
}; };
// GPUSURFACENUMBER from a game .pdb. // GPUSURFACENUMBER from a game .pdb. "Repeat" means repeating fraction, it's
// what ATI calls normalized.
enum class SurfaceNumFormat : uint32_t { enum class SurfaceNumFormat : uint32_t {
kUnsignedRepeat = 0, kUnsignedRepeat = 0,
kSignedRepeat = 1, kSignedRepeat = 1,