Add CompilerMSL::get_is_rasterization_disabled() to manage rasterization status.
This commit is contained in:
parent
5be1d911cc
commit
0d6202e770
@ -276,6 +276,8 @@ string CompilerMSL::compile()
|
||||
backend.boolean_mix_support = false;
|
||||
backend.allow_truncated_access_chain = true;
|
||||
|
||||
is_rasterization_disabled = msl_options.disable_rasterization;
|
||||
|
||||
replace_illegal_names();
|
||||
|
||||
struct_member_padding.clear();
|
||||
@ -300,9 +302,8 @@ string CompilerMSL::compile()
|
||||
stage_uniforms_var_id = add_interface_block(StorageClassUniformConstant);
|
||||
|
||||
// Metal vertex functions that define no output must disable rasterization and return void.
|
||||
// Provide feedback to calling API to allow runtime to disable pipeline rasterization.
|
||||
if (!stage_out_var_id && (get_entry_point().model == ExecutionModelVertex))
|
||||
msl_options.disable_rasterization = true;
|
||||
if (!stage_out_var_id)
|
||||
is_rasterization_disabled = true;
|
||||
|
||||
// Convert the use of global variables to recursively-passed function parameters
|
||||
localize_global_variables();
|
||||
@ -383,9 +384,8 @@ void CompilerMSL::preprocess_op_codes()
|
||||
}
|
||||
|
||||
// Metal vertex functions that write to textures must disable rasterization and return void.
|
||||
// Provide feedback to calling API to allow runtime to disable pipeline rasterization.
|
||||
if (preproc.uses_image_write && get_entry_point().model == ExecutionModelVertex)
|
||||
msl_options.disable_rasterization = true;
|
||||
if (preproc.uses_image_write)
|
||||
is_rasterization_disabled = true;
|
||||
}
|
||||
|
||||
// Move the Private and Workgroup global variables to the entry function.
|
||||
@ -703,8 +703,7 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage)
|
||||
// If the entry point should return the output struct, set the entry function
|
||||
// to return the output interface struct, otherwise to return nothing.
|
||||
// Indicate the output var requires early initialization.
|
||||
bool ep_should_return_output =
|
||||
!((get_entry_point().model == ExecutionModelVertex) && msl_options.disable_rasterization);
|
||||
bool ep_should_return_output = !get_is_rasterization_disabled();
|
||||
uint32_t rtn_id = ep_should_return_output ? ib_var_id : 0;
|
||||
auto &entry_func = get<SPIRFunction>(entry_point);
|
||||
entry_func.add_local_variable(ib_var_id);
|
||||
@ -3098,8 +3097,7 @@ string CompilerMSL::func_type_decl(SPIRType &type)
|
||||
return return_type;
|
||||
|
||||
// If an outgoing interface block has been defined, and it should be returned, override the entry point return type
|
||||
bool ep_should_return_output =
|
||||
!((get_entry_point().model == ExecutionModelVertex) && msl_options.disable_rasterization);
|
||||
bool ep_should_return_output = !get_is_rasterization_disabled();
|
||||
if (stage_out_var_id && ep_should_return_output)
|
||||
{
|
||||
auto &so_var = get<SPIRVariable>(stage_out_var_id);
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
uint32_t msl_version = make_msl_version(1, 2);
|
||||
uint32_t texel_buffer_texture_width = 4096; // Width of 2D Metal textures used as 1D texel buffers
|
||||
bool enable_point_size_builtin = true;
|
||||
bool disable_rasterization = false; // Used as both input and output
|
||||
bool disable_rasterization = false;
|
||||
bool resolve_specialized_array_lengths = true;
|
||||
|
||||
bool is_ios()
|
||||
@ -204,6 +204,13 @@ public:
|
||||
msl_options = opts;
|
||||
}
|
||||
|
||||
// Provide feedback to calling API to allow runtime to disable pipeline
|
||||
// rasterization if vertex shader requires rasterization to be disabled.
|
||||
bool get_is_rasterization_disabled() const
|
||||
{
|
||||
return is_rasterization_disabled && (get_entry_point().model == spv::ExecutionModelVertex);
|
||||
}
|
||||
|
||||
// An enum of SPIR-V functions that are implemented in additional
|
||||
// source code that is added to the shader if necessary.
|
||||
enum SPVFuncImpl
|
||||
@ -376,6 +383,7 @@ protected:
|
||||
uint32_t stage_uniforms_var_id = 0;
|
||||
bool needs_vertex_idx_arg = false;
|
||||
bool needs_instance_idx_arg = false;
|
||||
bool is_rasterization_disabled = false;
|
||||
std::string qual_pos_var_name;
|
||||
std::string stage_in_var_name = "in";
|
||||
std::string stage_out_var_name = "out";
|
||||
|
Loading…
Reference in New Issue
Block a user