diff options
Diffstat (limited to 'src/gallium/state_trackers/d3d1x/d3d1xshader')
3 files changed, 33 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h index 5c7c87e5e8e..0343a67f863 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h @@ -41,6 +41,7 @@ #define FOURCC_SHDR FOURCC('S', 'H', 'D', 'R') #define FOURCC_SHEX FOURCC('S', 'H', 'E', 'X') #define FOURCC_STAT FOURCC('S', 'T', 'A', 'T') +#define FOURCC_PCSG FOURCC('P', 'C', 'S', 'G') /* this is always little-endian! */ struct dxbc_chunk_header @@ -98,9 +99,21 @@ static inline dxbc_chunk_header* dxbc_find_shader_bytecode(const void* data, int return chunk; } -static inline dxbc_chunk_signature* dxbc_find_signature(const void* data, int size, bool output) +#define DXBC_FIND_INPUT_SIGNATURE 0 +#define DXBC_FIND_OUTPUT_SIGNATURE 1 +#define DXBC_FIND_PATCH_SIGNATURE 2 + +static inline dxbc_chunk_signature* dxbc_find_signature(const void* data, int size, unsigned kind) { - return (dxbc_chunk_signature*)dxbc_find_chunk(data, size, output ? FOURCC_OSGN : FOURCC_ISGN); + unsigned fourcc; + switch(kind) { + case DXBC_FIND_INPUT_SIGNATURE: fourcc = FOURCC_ISGN; break; + case DXBC_FIND_OUTPUT_SIGNATURE: fourcc = FOURCC_OSGN; break; + case DXBC_FIND_PATCH_SIGNATURE: fourcc = FOURCC_PCSG; break; + default: + return NULL; + } + return (dxbc_chunk_signature*)dxbc_find_chunk(data, size, fourcc); } struct _D3D11_SIGNATURE_PARAMETER_DESC; diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h index 1db6bab3a39..43627f7c0ba 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h @@ -351,12 +351,21 @@ private: {} }; +struct _D3D11_SIGNATURE_PARAMETER_DESC; + struct sm4_program { sm4_token_version version; std::vector<sm4_dcl*> dcls; std::vector<sm4_insn*> insns; + _D3D11_SIGNATURE_PARAMETER_DESC* params_in; + _D3D11_SIGNATURE_PARAMETER_DESC* params_out; + _D3D11_SIGNATURE_PARAMETER_DESC* params_patch; + unsigned num_params_in; + unsigned num_params_out; + unsigned num_params_patch; + /* for ifs, the insn number of the else or endif if there is no else * for elses, the insn number of the endif * for endifs, the insn number of the if @@ -373,6 +382,7 @@ struct sm4_program { memset(&version, 0, sizeof(version)); labels_found = false; + num_params_in = num_params_out = num_params_patch = 0; } ~sm4_program() @@ -381,6 +391,13 @@ struct sm4_program delete *i; for(std::vector<sm4_insn*>::iterator i = insns.begin(), e = insns.end(); i != e; ++i) delete *i; + + if(num_params_in) + free(params_in); + if(num_params_out) + free(params_out); + if(num_params_patch) + free(params_patch); } void dump(); diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp index 4903e2c3b94..05d10c19543 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp @@ -78,6 +78,7 @@ int dxbc_parse_signature(dxbc_chunk_signature* sig, D3D11_SIGNATURE_PARAMETER_DE param.SemanticIndex = bswap_le32(sig->elements[i].semantic_index); param.SystemValueType = (D3D_NAME)bswap_le32(sig->elements[i].system_value_type); param.ComponentType = (D3D_REGISTER_COMPONENT_TYPE)bswap_le32(sig->elements[i].component_type); + param.Register = bswap_le32(sig->elements[i].register_num); param.Mask = sig->elements[i].mask; param.ReadWriteMask = sig->elements[i].read_write_mask; param.Stream = sig->elements[i].stream; |