Skip to content

Commit f77ef4e

Browse files
committed
fixup: Change GL_Alpha_Threshold use to value on state tracker
No need to use the global here. Fixes build without OpenGL.
1 parent 08a199d commit f77ef4e

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

code/graphics/vulkan/VulkanDraw.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,8 +1501,6 @@ void VulkanDrawManager::drawSphere(material* material_def)
15011501
} // namespace vulkan
15021502
} // namespace graphics
15031503

1504-
// GL_alpha_threshold is defined in gropengl.cpp
1505-
extern float GL_alpha_threshold;
15061504

15071505
// PostProcessing_override is defined in globalincs/systemvars.cpp
15081506
extern bool PostProcessing_override;
@@ -1556,7 +1554,7 @@ void vulkan_set_default_material_uniforms(material* material_info)
15561554
}
15571555

15581556
// Alpha threshold
1559-
data->alphaThreshold = GL_alpha_threshold;
1557+
data->alphaThreshold = getStateTracker()->getAlphaThreshold();
15601558

15611559
// Color from material
15621560
vec4 clr = material_info->get_color();

code/graphics/vulkan/VulkanState.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,6 @@ void VulkanStateTracker::applyDynamicState()
290290
} // namespace vulkan
291291
} // namespace graphics
292292

293-
// GL_alpha_threshold is defined in gropengl.cpp
294-
extern float GL_alpha_threshold;
295-
296293
namespace graphics {
297294
namespace vulkan {
298295

@@ -319,9 +316,9 @@ void vulkan_zbias(int bias)
319316
int vulkan_alpha_mask_set(int mode, float alpha)
320317
{
321318
if (mode) {
322-
GL_alpha_threshold = alpha;
319+
getStateTracker()->setAlphaThreshold(alpha);
323320
} else {
324-
GL_alpha_threshold = 0.0f;
321+
getStateTracker()->setAlphaThreshold(0.0f);
325322
}
326323
return mode;
327324
}

code/graphics/vulkan/VulkanState.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ class VulkanStateTracker {
176176
void setCullMode(bool enabled) { m_cullEnabled = enabled; }
177177
bool getCullMode() const { return m_cullEnabled; }
178178

179+
void setAlphaThreshold(float threshold) { m_alphaThreshold = threshold; }
180+
float getAlphaThreshold() const { return m_alphaThreshold; }
181+
179182
/**
180183
* @brief Set color attachment count for current render pass
181184
*/
@@ -237,6 +240,7 @@ class VulkanStateTracker {
237240
gr_zbuffer_type m_zbufferMode = ZBUFFER_TYPE_NONE;
238241
int m_stencilMode = 0;
239242
bool m_cullEnabled = true;
243+
float m_alphaThreshold = 0.0f;
240244
uint32_t m_colorAttachmentCount = 1;
241245
vk::SampleCountFlagBits m_currentSampleCount = vk::SampleCountFlagBits::e1;
242246

0 commit comments

Comments
 (0)