ac: allow control flow statements in NIR callbacks

This fixes a crash when compiling geometry shaders on radeonsi.
This commit is contained in:
Marek Olšák
2019-07-24 17:19:38 -04:00
parent bfea7e4d29
commit f6eca14f1b
2 changed files with 29 additions and 20 deletions

View File

@@ -51,6 +51,12 @@ struct ac_llvm_flow;
struct ac_llvm_compiler;
enum ac_float_mode;
struct ac_llvm_flow_state {
struct ac_llvm_flow *stack;
unsigned depth_max;
unsigned depth;
};
struct ac_llvm_context {
LLVMContextRef context;
LLVMModuleRef module;
@@ -93,9 +99,11 @@ struct ac_llvm_context {
LLVMValueRef i1true;
LLVMValueRef i1false;
struct ac_llvm_flow *flow;
unsigned flow_depth;
unsigned flow_depth_max;
/* Since ac_nir_translate makes a local copy of ac_llvm_context, there
* are two ac_llvm_contexts. Declare a pointer here, so that the control
* flow stack is shared by both ac_llvm_contexts.
*/
struct ac_llvm_flow_state *flow;
unsigned range_md_kind;
unsigned invariant_load_md_kind;