Refactor vendor detection (#1049)

* Refactor vendor detection

Only one vendor can be active at any given time, so make it an enum.

* lowercase vendor string
This commit is contained in:
ah-OOG-ah authored and GitHub committed 2025-10-13 15:48:21 -07:00
1 parent 2b53a851ef
commit 270697cd10
7 files changed
+58 -19

No files matched your search

@@ -295,7 +295,7 @@ public class GLSM_Lighting_UnitTest {
GLStateManager.glPushAttrib(GL11.GL_LIGHTING_BIT);
newf4b(0.8F, 0.6F, 0.4F, 0.0F);
GLStateManager.glMaterial(GL11.GL_FRONT, GL11.GL_COLOR_INDEXES, f4b);
if (GLStateManager.isNVIDIA()) {
if (GLStateManager.vendorIsNVIDIA()) {
verifyMaterialState(GL11.GL_FRONT, GL11.GL_COLOR_INDEXES, new float[]{0.8F, 0.4F, 0.6F}, "");
} else {
verifyMaterialState(GL11.GL_FRONT, GL11.GL_COLOR_INDEXES, new float[]{0.8F, 0.6F, 0.4F}, "");
@@ -216,8 +216,8 @@ class GLSM_PushPop_UnitTest {
bits.add(new GLBit(GL11.GL_DITHER, "Dither", true));
bits.add(new GLBit(GL11.GL_FOG, "Fog", false));
// This fails on the RESET test in xvfb
if(!(GLStateManager.MESA || GLStateManager.AMD)) {
for(i = 0 ; i < GL11.glGetInteger(GL11.GL_MAX_LIGHTS) ; i++) {
if (!(GLStateManager.vendorIsMesa() || GLStateManager.vendorIsAMD())) {
for (i = 0; i < GL11.glGetInteger(GL11.GL_MAX_LIGHTS); i++) {
bits.add(new GLBit(GL11.GL_LIGHT0 + i, "Light " + i, false));
}
}
@@ -247,7 +247,7 @@ class GLSM_PushPop_UnitTest {
bits.add(new GLBit(GL11.GL_MAP2_TEXTURE_COORD_3, "Map2 Texture Coord 3", false));
bits.add(new GLBit(GL11.GL_MAP2_TEXTURE_COORD_4, "Map2 Texture Coord 4", false));
// Seems to be broken at least on Nvidia
if(!GLStateManager.NVIDIA) bits.add(new GLBit(GL13.GL_MULTISAMPLE, "Multisample", true));
if (!GLStateManager.vendorIsNVIDIA()) bits.add(new GLBit(GL13.GL_MULTISAMPLE, "Multisample", true));
bits.add(new GLBit(GL11.GL_NORMALIZE, "Normalize", false));
bits.add(new GLBit(GL11.GL_POINT_SMOOTH, "Point Smooth", false));
bits.add(new GLBit(GL11.GL_POLYGON_OFFSET_LINE, "Polygon Offset Line", false));
@@ -297,7 +297,7 @@ class GLSM_PushPop_UnitTest {
GLStateManager.glFogf(GL11.GL_FOG_END, 0.5f);
GLStateManager.glFogf(GL11.GL_FOG_START, 0.5f);
GLStateManager.glFogf(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
if(!GLStateManager.NVIDIA) GLStateManager.glFogf(GL11.GL_FOG_INDEX, 1f);
if (!GLStateManager.vendorIsNVIDIA()) GLStateManager.glFogf(GL11.GL_FOG_INDEX, 1f);
verifyIsEnabled(GL11.GL_FOG, true, "Fog Enable");
verifyState(GL11.GL_FOG_COLOR, FLOAT_ARRAY_4_POINT_5, "Fog Color");
@@ -305,7 +305,7 @@ class GLSM_PushPop_UnitTest {
verifyState(GL11.GL_FOG_END, 0.5f, "Fog End");
verifyState(GL11.GL_FOG_START, 0.5f, "Fog Start");
verifyState(GL11.GL_FOG_MODE, GL11.GL_LINEAR, "Fog Mode");
if(!GLStateManager.NVIDIA) verifyState(GL11.GL_FOG_INDEX, 1f, "Fog Index");
if (!GLStateManager.vendorIsNVIDIA()) verifyState(GL11.GL_FOG_INDEX, 1f, "Fog Index");
GLStateManager.glPopAttrib();
verifyIsEnabled(GL11.GL_FOG, false, "Fog Enable - Reset");
@@ -314,7 +314,7 @@ class GLSM_PushPop_UnitTest {
verifyState(GL11.GL_FOG_END, 1f, "Fog End - Reset");
verifyState(GL11.GL_FOG_START, 0f, "Fog Start - Reset");
verifyState(GL11.GL_FOG_MODE, GL11.GL_EXP, "Fog Mode - Reset");
if(!GLStateManager.NVIDIA) verifyState(GL11.GL_FOG_INDEX, 0f, "Fog Index - Reset");
if (!GLStateManager.vendorIsNVIDIA()) verifyState(GL11.GL_FOG_INDEX, 0f, "Fog Index - Reset");
}
@Test