Allow flip_vert_y in all relevant stages.
This commit is contained in:
parent
ea3cd74426
commit
5ea576ece2
@ -2062,6 +2062,13 @@ bool Compiler::is_tessellation_shader(ExecutionModel model)
|
||||
return model == ExecutionModelTessellationControl || model == ExecutionModelTessellationEvaluation;
|
||||
}
|
||||
|
||||
bool Compiler::is_vertex_like_shader() const
|
||||
{
|
||||
auto model = get_execution_model();
|
||||
return model == ExecutionModelVertex || model == ExecutionModelGeometry ||
|
||||
model == ExecutionModelTessellationControl || model == ExecutionModelTessellationEvaluation;
|
||||
}
|
||||
|
||||
bool Compiler::is_tessellation_shader() const
|
||||
{
|
||||
return is_tessellation_shader(get_execution_model());
|
||||
|
@ -1063,6 +1063,8 @@ protected:
|
||||
uint32_t evaluate_spec_constant_u32(const SPIRConstantOp &spec) const;
|
||||
uint32_t evaluate_constant_u32(uint32_t id) const;
|
||||
|
||||
bool is_vertex_like_shader() const;
|
||||
|
||||
private:
|
||||
// Used only to implement the old deprecated get_entry_point() interface.
|
||||
const SPIREntryPoint &get_first_entry_point(const std::string &name) const;
|
||||
|
@ -12530,8 +12530,7 @@ void CompilerGLSL::emit_function(SPIRFunction &func, const Bitset &return_flags)
|
||||
|
||||
void CompilerGLSL::emit_fixup()
|
||||
{
|
||||
auto &execution = get_entry_point();
|
||||
if (execution.model == ExecutionModelVertex)
|
||||
if (is_vertex_like_shader())
|
||||
{
|
||||
if (options.vertex.fixup_clipspace)
|
||||
{
|
||||
|
@ -135,12 +135,14 @@ public:
|
||||
|
||||
struct VertexOptions
|
||||
{
|
||||
// GLSL: In vertex shaders, rewrite [0, w] depth (Vulkan/D3D style) to [-w, w] depth (GL style).
|
||||
// MSL: In vertex shaders, rewrite [-w, w] depth (GL style) to [0, w] depth.
|
||||
// HLSL: In vertex shaders, rewrite [-w, w] depth (GL style) to [0, w] depth.
|
||||
// "Vertex-like shader" here is any shader stage that can write BuiltInPosition.
|
||||
|
||||
// GLSL: In vertex-like shaders, rewrite [0, w] depth (Vulkan/D3D style) to [-w, w] depth (GL style).
|
||||
// MSL: In vertex-like shaders, rewrite [-w, w] depth (GL style) to [0, w] depth.
|
||||
// HLSL: In vertex-like shaders, rewrite [-w, w] depth (GL style) to [0, w] depth.
|
||||
bool fixup_clipspace = false;
|
||||
|
||||
// Inverts gl_Position.y or equivalent.
|
||||
// In vertex-like shaders, inverts gl_Position.y or equivalent.
|
||||
bool flip_vert_y = false;
|
||||
|
||||
// GLSL only, for HLSL version of this option, see CompilerHLSL.
|
||||
|
@ -2649,7 +2649,7 @@ void CompilerHLSL::emit_hlsl_entry_point()
|
||||
|
||||
void CompilerHLSL::emit_fixup()
|
||||
{
|
||||
if (get_entry_point().model == ExecutionModelVertex)
|
||||
if (is_vertex_like_shader())
|
||||
{
|
||||
// Do various mangling on the gl_Position.
|
||||
if (hlsl_options.shader_model <= 30)
|
||||
|
@ -9028,9 +9028,7 @@ string CompilerMSL::convert_row_major_matrix(string exp_str, const SPIRType &exp
|
||||
// Called automatically at the end of the entry point function
|
||||
void CompilerMSL::emit_fixup()
|
||||
{
|
||||
if ((get_execution_model() == ExecutionModelVertex ||
|
||||
get_execution_model() == ExecutionModelTessellationEvaluation) &&
|
||||
stage_out_var_id && !qual_pos_var_name.empty() && !capture_output_to_buffer)
|
||||
if (is_vertex_like_shader() && stage_out_var_id && !qual_pos_var_name.empty() && !capture_output_to_buffer)
|
||||
{
|
||||
if (options.vertex.fixup_clipspace)
|
||||
statement(qual_pos_var_name, ".z = (", qual_pos_var_name, ".z + ", qual_pos_var_name,
|
||||
|
Loading…
Reference in New Issue
Block a user