diff --git a/renderdoc/api/replay/control_types.h b/renderdoc/api/replay/control_types.h index cd7af2fd3..2fbebcc99 100644 --- a/renderdoc/api/replay/control_types.h +++ b/renderdoc/api/replay/control_types.h @@ -129,6 +129,63 @@ struct TextureDisplay DebugOverlay overlay; }; +// some dependent structs for TextureSave +struct TextureComponentMapping +{ + float blackPoint; + float whitePoint; +}; + +struct TextureSampleMapping +{ + // if true, texture acts like an array, each slice being + // the corresponding sample, and below sample index is ignored. + // Later options for handling slices/faces then control how + // a texture array is mapped to the file. + bool32 mapToArray; + + // if the above mapToArray is false, this selects the sample + // index to treat as a normal 2D image. If this is ~0U a default + // unweighted average resolve is performed instead. + // resolve only available for uncompressed simple formats. + uint32_t sampleIndex; +}; + +struct TextureSliceMapping +{ + // select the (depth/array) slice to save. + // If this is -1, writes out all slices as detailed below + // this is only supported in formats that don't support + // slices natively, and will be done in RGBA8 space. + int32_t sliceIndex; + + // write out the slices as a 2D grid, with the below + // width. Any empty slices are writted as (0,0,0,0) + bool32 slicesAsGrid; + + int32_t sliceGridWidth; + + // write out 6 slices in the cruciform: + /* + +---+ + |+y | + | | + +---+---+---+---+ + |-x |+z |+x |-z | + | | | | | + +---+---+---+---+ + |-y | + | | + +---+ + */ + // with the gaps filled with (0,0,0,0) + bool32 cubeCruciform; + + // if sliceIndex is -1, cubeCruciform == slicesAsGrid == false + // and file format doesn't support saving all slices, only + // slice 0 is saved +}; + struct TextureSave { ResourceId id; @@ -143,65 +200,15 @@ struct TextureSave // for output formats that are 8bit unorm srgb, values are mapped using // the following black/white points. - struct ComponentMapping - { - float blackPoint; - float whitePoint; - } comp; + TextureComponentMapping comp; // what to do for multisampled textures (ignored otherwise) - struct SampleMapping - { - // if true, texture acts like an array, each slice being - // the corresponding sample, and below sample index is ignored. - // Later options for handling slices/faces then control how - // a texture array is mapped to the file. - bool32 mapToArray; - - // if the above mapToArray is false, this selects the sample - // index to treat as a normal 2D image. If this is ~0U a default - // unweighted average resolve is performed instead. - // resolve only available for uncompressed simple formats. - uint32_t sampleIndex; - } sample; + TextureSampleMapping sample; // how to select/save depth/array slices or cubemap faces // if invalid options are specified, slice index 0 is written // alone - struct SliceMapping - { - // select the (depth/array) slice to save. - // If this is -1, writes out all slices as detailed below - // this is only supported in formats that don't support - // slices natively, and will be done in RGBA8 space. - int32_t sliceIndex; - - // write out the slices as a 2D grid, with the below - // width. Any empty slices are writted as (0,0,0,0) - bool32 slicesAsGrid; - - int32_t sliceGridWidth; - - // write out 6 slices in the cruciform: - /* - +---+ - |+y | - | | - +---+---+---+---+ - |-x |+z |+x |-z | - | | | | | - +---+---+---+---+ - |-y | - | | - +---+ - */ - // with the gaps filled with (0,0,0,0) - bool32 cubeCruciform; - - // if sliceIndex is -1, cubeCruciform == slicesAsGrid == false - // and file format doesn't support saving all slices, only - // slice 0 is saved - } slice; + TextureSliceMapping slice; int channelExtract; @@ -215,33 +222,39 @@ struct TextureSave int jpegQuality; }; +// dependent structs for TargetControlMessage +struct NewCaptureData +{ + uint32_t ID; + uint64_t timestamp; + rdctype::array thumbnail; + rdctype::str path; + bool32 local; +}; + +struct RegisterAPIData +{ + rdctype::str APIName; +}; + +struct BusyData +{ + rdctype::str ClientName; +}; + +struct NewChildData +{ + uint32_t PID; + uint32_t ident; +}; + struct TargetControlMessage { TargetControlMessage() {} TargetControlMessageType Type; - struct NewCaptureData - { - uint32_t ID; - uint64_t timestamp; - rdctype::array thumbnail; - rdctype::str path; - bool32 local; - } NewCapture; - - struct RegisterAPIData - { - rdctype::str APIName; - } RegisterAPI; - - struct BusyData - { - rdctype::str ClientName; - } Busy; - - struct NewChildData - { - uint32_t PID; - uint32_t ident; - } NewChild; + NewCaptureData NewCapture; + RegisterAPIData RegisterAPI; + BusyData Busy; + NewChildData NewChild; }; diff --git a/renderdoc/api/replay/data_types.h b/renderdoc/api/replay/data_types.h index 496f2e2b0..9ac94bc1d 100644 --- a/renderdoc/api/replay/data_types.h +++ b/renderdoc/api/replay/data_types.h @@ -424,6 +424,14 @@ struct CounterDescription CounterUnit unit; }; +union CounterValue +{ + float f; + double d; + uint32_t u32; + uint64_t u64; +}; + struct CounterResult { CounterResult() : eventID(0), counterID(GPUCounter::EventGPUDuration) { value.u64 = 0; } @@ -463,24 +471,15 @@ struct CounterResult uint32_t eventID; GPUCounter counterID; - union - { - float f; - double d; - uint32_t u32; - uint64_t u64; - } value; + CounterValue value; }; -struct PixelValue +union PixelValue { - union - { - float value_f[4]; - uint32_t value_u[4]; - int32_t value_i[4]; - uint16_t value_u16[4]; - }; + float value_f[4]; + uint32_t value_u[4]; + int32_t value_i[4]; + uint16_t value_u16[4]; }; struct ModificationValue diff --git a/renderdoc/api/replay/shader_types.h b/renderdoc/api/replay/shader_types.h index 98df2c303..c542ec18a 100644 --- a/renderdoc/api/replay/shader_types.h +++ b/renderdoc/api/replay/shader_types.h @@ -32,6 +32,41 @@ typedef uint8_t byte; typedef uint32_t bool32; +struct FloatVecVal +{ + float x, y, z, w; +}; + +struct DoubleVecVal +{ + double x, y, z, w; +}; + +struct IntVecVal +{ + int32_t x, y, z, w; +}; + +struct UIntVecVal +{ + uint32_t x, y, z, w; +}; + +union ShaderValue +{ + FloatVecVal f; + float fv[16]; + + IntVecVal i; + int32_t iv[16]; + + UIntVecVal u; + uint32_t uv[16]; + + DoubleVecVal d; + double dv[16]; +}; + struct ShaderVariable { ShaderVariable() @@ -93,32 +128,7 @@ struct ShaderVariable bool32 displayAsHex; - union - { - struct - { - float x, y, z, w; - } f; - float fv[16]; - - struct - { - int32_t x, y, z, w; - } i; - int32_t iv[16]; - - struct - { - uint32_t x, y, z, w; - } u; - uint32_t uv[16]; - - struct - { - double x, y, z, w; - } d; - double dv[16]; - } value; + ShaderValue value; bool32 isStruct; @@ -182,30 +192,34 @@ struct SigParameter struct ShaderConstant; +struct ShaderVariableDescriptor +{ + VarType type; + uint32_t rows; + uint32_t cols; + uint32_t elements; + bool32 rowMajorStorage; + uint32_t arrayStride; + rdctype::str name; +}; + struct ShaderVariableType { - struct - { - VarType type; - uint32_t rows; - uint32_t cols; - uint32_t elements; - bool32 rowMajorStorage; - uint32_t arrayStride; - rdctype::str name; - } descriptor; + ShaderVariableDescriptor descriptor; rdctype::array members; }; +struct ShaderRegister +{ + uint32_t vec; + uint32_t comp; +}; + struct ShaderConstant { rdctype::str name; - struct - { - uint32_t vec; - uint32_t comp; - } reg; + ShaderRegister reg; uint64_t defaultValue; ShaderVariableType type; };