Logic to specify face culling during pipeline creation.
This commit is contained in:
parent
3127807db9
commit
44a5f950ad
|
|
@ -2162,6 +2162,7 @@ static shader_t *FinishShader( void ) {
|
|||
|
||||
// VULKAN
|
||||
Vk_Pipeline_Desc desc;
|
||||
desc.face_culling = shader.cullType;
|
||||
desc.polygon_offset = (shader.polygonOffset == qtrue);
|
||||
|
||||
for (int i = 0; i < stage; i++) {
|
||||
|
|
|
|||
|
|
@ -527,8 +527,18 @@ static VkPipeline create_pipeline(const Vk_Pipeline_Desc& desc) {
|
|||
rasterization_state.depthClampEnable = VK_FALSE;
|
||||
rasterization_state.rasterizerDiscardEnable = VK_FALSE;
|
||||
rasterization_state.polygonMode = (desc.state_bits & GLS_POLYMODE_LINE) ? VK_POLYGON_MODE_LINE : VK_POLYGON_MODE_FILL;
|
||||
rasterization_state.cullMode = VK_CULL_MODE_NONE/*VK_CULL_MODE_BACK_BIT*/;
|
||||
rasterization_state.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||
|
||||
if (desc.face_culling == CT_TWO_SIDED)
|
||||
rasterization_state.cullMode = VK_CULL_MODE_NONE;
|
||||
else if (desc.face_culling == CT_FRONT_SIDED)
|
||||
rasterization_state.cullMode = VK_CULL_MODE_BACK_BIT;
|
||||
else if (desc.face_culling == CT_BACK_SIDED)
|
||||
rasterization_state.cullMode = VK_CULL_MODE_FRONT_BIT;
|
||||
else
|
||||
ri.Error(ERR_DROP, "create_pipeline: invalid face culling mode\n");
|
||||
|
||||
rasterization_state.frontFace = VK_FRONT_FACE_CLOCKWISE; // Q3 defaults to clockwise vertex order
|
||||
|
||||
rasterization_state.depthBiasEnable = desc.polygon_offset ? VK_TRUE : VK_FALSE;
|
||||
rasterization_state.depthBiasConstantFactor = 0.0f; // dynamic depth bias state
|
||||
rasterization_state.depthBiasClamp = 0.0f; // dynamic depth bias state
|
||||
|
|
|
|||
|
|
@ -41,14 +41,16 @@ enum class Vk_Shader_Type {
|
|||
};
|
||||
|
||||
struct Vk_Pipeline_Desc {
|
||||
Vk_Shader_Type shader_type;
|
||||
unsigned int state_bits; // GLS_XXX flags
|
||||
bool polygon_offset;
|
||||
Vk_Shader_Type shader_type = Vk_Shader_Type::single_texture;
|
||||
unsigned int state_bits = 0; // GLS_XXX flags
|
||||
int face_culling = 0;// cullType_t
|
||||
bool polygon_offset = false;
|
||||
|
||||
bool operator==(const Vk_Pipeline_Desc& other) const {
|
||||
return
|
||||
shader_type == other.shader_type &&
|
||||
state_bits == other.state_bits &&
|
||||
face_culling == other.face_culling &&
|
||||
polygon_offset == other.polygon_offset;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user