Skip to content

Commit 61636e0

Browse files
committed
fixup: Change GL_Alpha_Threshold use to value on state tracker
No need to use the global here. Breaks build without OpenGL.
1 parent f0efb8b commit 61636e0

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

code/graphics/vulkan/VulkanDraw.cpp

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

1504-
extern float VK_alpha_threshold;
15051504

15061505
// PostProcessing_override is defined in globalincs/systemvars.cpp
15071506
extern bool PostProcessing_override;
@@ -1555,7 +1554,7 @@ void vulkan_set_default_material_uniforms(material* material_info)
15551554
}
15561555

15571556
// Alpha threshold
1558-
data->alphaThreshold = VK_alpha_threshold;
1557+
data->alphaThreshold = getStateTracker()->getAlphaThreshold();
15591558

15601559
// Color from material
15611560
vec4 clr = material_info->get_color();

code/graphics/vulkan/VulkanState.cpp

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

293-
float VK_alpha_threshold = 0.0f;
294-
295293
namespace graphics {
296294
namespace vulkan {
297295

@@ -318,9 +316,9 @@ void vulkan_zbias(int bias)
318316
int vulkan_alpha_mask_set(int mode, float alpha)
319317
{
320318
if (mode) {
321-
VK_alpha_threshold = alpha;
319+
getStateTracker()->setAlphaThreshold(alpha);
322320
} else {
323-
VK_alpha_threshold = 0.0f;
321+
getStateTracker()->setAlphaThreshold(0.0f);
324322
}
325323
return mode;
326324
}

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)