Skip to content

Commit

Permalink
Backport from gles3-dev: Disable line raster emulation on metal backend
Browse files Browse the repository at this point in the history
  • Loading branch information
kakashidinho committed May 7, 2021
1 parent 9722c45 commit 0708a75
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions include/GLSLANG/ShaderLang.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ const ShCompileOptions SH_ADD_BASE_VERTEX_TO_VERTEX_ID = UINT64_C(1) << 48;
// an emulation in shader is needed.
const ShCompileOptions SH_METAL_EMULATE_LINEAR_DEPTH_RANGE_MAP = UINT64_C(1) << 49;

// This flag indicates whether Bresenham line raster emulation code should be generated. This
// emulation is necessary if the backend uses a differnet algorithm to draw lines. Currently only
// implemented for the Vulkan backend.
const ShCompileOptions SH_ADD_BRESENHAM_LINE_RASTER_EMULATION = UINT64_C(1) << 50;

// Defines alternate strategies for implementing array index clamping.
enum ShArrayIndexClampingStrategy
{
Expand Down
9 changes: 6 additions & 3 deletions src/compiler/translator/TranslatorVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,10 +839,13 @@ bool TranslatorVulkan::translateImpl(TIntermBlock *root,
}
}

if (!AddLineSegmentRasterizationEmulation(this, sink, root, &getSymbolTable(),
driverUniforms, usesFragCoord))
if ((compileOptions & SH_ADD_BRESENHAM_LINE_RASTER_EMULATION) != 0)
{
return false;
if (!AddLineSegmentRasterizationEmulation(this, sink, root, &getSymbolTable(),
driverUniforms, usesFragCoord))
{
return false;
}
}

bool hasGLFragColor = false;
Expand Down
2 changes: 1 addition & 1 deletion src/libANGLE/renderer/vulkan/ShaderVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ std::shared_ptr<WaitableCompileEvent> ShaderVk::compile(const gl::Context *conte
gl::ShCompilerInstance *compilerInstance,
ShCompileOptions options)
{
ShCompileOptions compileOptions = SH_INITIALIZE_UNINITIALIZED_LOCALS;
ShCompileOptions compileOptions = SH_INITIALIZE_UNINITIALIZED_LOCALS | SH_ADD_BRESENHAM_LINE_RASTER_EMULATION;

ContextVk *contextVk = vk::GetImpl(context);

Expand Down

0 comments on commit 0708a75

Please sign in to comment.