Skip to content

Commit

Permalink
Fix glmsaa on Desktop GL drivers
Browse files Browse the repository at this point in the history
Only enable the GL_EXT_clip_cull_distance on GL ES.

Also tweak the gms more, sorting the slow tests first for better times.

Diffs=
04f481d40 Fix glmsaa on Desktop GL drivers (#8026)

Co-authored-by: Chris Dalton <[email protected]>
  • Loading branch information
csmartdalton and csmartdalton committed Sep 5, 2024
1 parent f791357 commit f0f097b
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2719dc7858417238922e0affc61a1a96fded3008
04f481d40e1f80fc22e08344b51d496066f16740
16 changes: 8 additions & 8 deletions renderer/path_fiddle/fiddle_context_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ static void GLAPIENTRY err_msg_callback(GLenum source,
{
return;
}
if (strstr(message, "is being recompiled based on GL state."))
if (strstr(message, "is being recompiled based on GL state"))
{
return;
}
if (strcmp(message,
"Pixel-path performance warning: Pixel transfer is synchronized with 3D "
"rendering.") == 0)
{
return;
}
Expand All @@ -76,13 +82,7 @@ class FiddleContextGL : public FiddleContext
}
#endif

printf("GL_VENDOR: %s\n", glGetString(GL_VENDOR));
printf("GL_RENDERER: %s\n", glGetString(GL_RENDERER));
printf("GL_VERSION: %s\n", glGetString(GL_VERSION));
#ifdef RIVE_DESKTOP_GL
printf("GL_ANGLE_shader_pixel_local_storage_coherent: %i\n",
GLAD_GL_ANGLE_shader_pixel_local_storage_coherent);
#endif
printf("==== GL GPU: %s ====\n", glGetString(GL_RENDERER));
#if 0
int n;
glGetIntegerv(GL_NUM_EXTENSIONS, &n);
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/shaders/glsl.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#extension GL_KHR_blend_equation_advanced : require
#endif

#if defined(@USING_DEPTH_STENCIL) && defined(@ENABLE_CLIP_RECT)
#if defined(@USING_DEPTH_STENCIL) && defined(@ENABLE_CLIP_RECT) && defined(GL_ES)
#ifdef GL_EXT_clip_cull_distance
#extension GL_EXT_clip_cull_distance : require
#elif defined(GL_ANGLE_clip_cull_distance)
Expand Down
6 changes: 5 additions & 1 deletion tests/check_golds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ while :; do
ARGS="$ARGS --verbose"
shift
;;
-n)
ARGS="$ARGS --no-rebuild"
shift
;;
*)
break
;;
Expand Down Expand Up @@ -77,7 +81,7 @@ do

NUMBER_OF_PROCESSORS="${NUMBER_OF_PROCESSORS:-$(nproc 2>/dev/null || sysctl -n hw.physicalcpu)}"
if [[ $NUMBER_OF_PROCESSORS > 20 ]]; then
GOLDEN_JOBS=8
GOLDEN_JOBS=6
else
GOLDEN_JOBS=4
fi
Expand Down
31 changes: 24 additions & 7 deletions tests/gm/gm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,37 @@ class GM
template <typename T> class Registry
{
static Registry* s_Head;
static Registry* s_Tail;

T m_Value;
Registry* m_Next;
Registry* m_Next = nullptr;

public:
Registry(T value) : m_Value(value)
Registry(T value, bool isSlow) : m_Value(value)
{
m_Next = s_Head;
s_Head = this;
if (s_Head == nullptr)
{
s_Tail = s_Head = this;
}
else if (isSlow)
{
m_Next = s_Head;
s_Head = this;
}
else
{
s_Tail->m_Next = this;
s_Tail = this;
}
}

static const Registry* head() { return s_Head; }
const T& get() const { return m_Value; }
const Registry* next() const { return m_Next; }
};

template <typename T> Registry<T>* Registry<T>::s_Head;
template <typename T> Registry<T>* Registry<T>::s_Head = nullptr;
template <typename T> Registry<T>* Registry<T>::s_Tail = nullptr;

using GMFactory = std::unique_ptr<GM> (*)();
using GMRegistry = Registry<GMFactory>;
Expand All @@ -88,8 +102,11 @@ using GMRegistry = Registry<GMFactory>;
// Usage: GMREGISTER( return new mygmclass(...) )
//
#define GMREGISTER(code) \
static GMRegistry RIVE_MACRO_APPEND_COUNTER(rivegm_registry)( \
[]() { return std::unique_ptr<rivegm::GM>([]() { code; }()); });
static GMRegistry RIVE_MACRO_APPEND_COUNTER( \
rivegm_registry)([]() { return std::unique_ptr<rivegm::GM>([]() { code; }()); }, false);
#define GMREGISTER_SLOW(code) \
static GMRegistry RIVE_MACRO_APPEND_COUNTER( \
rivegm_registry)([]() { return std::unique_ptr<rivegm::GM>([]() { code; }()); }, true);

// Usage:
//
Expand Down
4 changes: 2 additions & 2 deletions tests/gm/hittestgm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,5 @@ class HitTestGM : public GM
}
};

GMREGISTER(return new HitTestGM(rive::FillRule::evenOdd))
GMREGISTER(return new HitTestGM(rive::FillRule::nonZero))
GMREGISTER_SLOW(return new HitTestGM(rive::FillRule::evenOdd))
GMREGISTER_SLOW(return new HitTestGM(rive::FillRule::nonZero))
2 changes: 1 addition & 1 deletion tests/gm/mandoline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,4 @@ class MandolineGM : public GM
}
};

GMREGISTER(return new MandolineGM;)
GMREGISTER_SLOW(return new MandolineGM;)

0 comments on commit f0f097b

Please sign in to comment.