Disable GL cull on rectangle lists

This commit is contained in:
Dr. Chat 2016-01-18 21:00:58 -06:00
parent 3859b0a091
commit a34e82c77f
2 changed files with 19 additions and 6 deletions

View File

@ -578,7 +578,7 @@ bool GL4CommandProcessor::IssueDraw(PrimitiveType prim_type,
return true;
}
status = UpdateState();
status = UpdateState(draw_batcher_.prim_type());
CHECK_ISSUE_UPDATE_STATUS(status, mismatch, "Unable to setup render state");
status = PopulateSamplers();
CHECK_ISSUE_UPDATE_STATUS(status, mismatch,
@ -665,6 +665,7 @@ GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateShaders(
// Normal vertex shaders only, for now.
// TODO(benvanik): transform feedback/memexport.
// https://github.com/freedreno/freedreno/blob/master/includes/a2xx.xml.h
// 0 = normal
// 2 = point size
assert_true(program_cntl.vs_export_mode == 0 ||
@ -871,7 +872,8 @@ GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateRenderTargets() {
return UpdateStatus::kMismatch;
}
GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateState() {
GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateState(
PrimitiveType prim_type) {
bool mismatch = false;
#define CHECK_UPDATE_STATUS(status, mismatch, error_message) \
@ -887,7 +889,7 @@ GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateState() {
UpdateStatus status;
status = UpdateViewportState();
CHECK_UPDATE_STATUS(status, mismatch, "Unable to update viewport state");
status = UpdateRasterizerState();
status = UpdateRasterizerState(prim_type);
CHECK_UPDATE_STATUS(status, mismatch, "Unable to update rasterizer state");
status = UpdateBlendState();
CHECK_UPDATE_STATUS(status, mismatch, "Unable to update blend state");
@ -1055,7 +1057,8 @@ GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateViewportState() {
return UpdateStatus::kMismatch;
}
GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateRasterizerState() {
GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateRasterizerState(
PrimitiveType prim_type) {
auto& regs = update_rasterizer_state_regs_;
bool dirty = false;
@ -1067,10 +1070,13 @@ GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateRasterizerState() {
XE_GPU_REG_PA_SC_SCREEN_SCISSOR_BR);
dirty |= SetShadowRegister(&regs.multi_prim_ib_reset_index,
XE_GPU_REG_VGT_MULTI_PRIM_IB_RESET_INDX);
dirty |= regs.prim_type != prim_type;
if (!dirty) {
return UpdateStatus::kCompatible;
}
regs.prim_type = prim_type;
SCOPE_profile_cpu_f("gpu");
draw_batcher_.Flush(DrawBatcher::FlushMode::kStateChange);
@ -1113,6 +1119,11 @@ GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateRasterizerState() {
glFrontFace(GL_CCW);
}
if (prim_type == PrimitiveType::kRectangleList) {
// Rectangle lists aren't culled. There may be other things they skip too.
glDisable(GL_CULL_FACE);
}
static const GLenum kFillModes[3] = {
GL_POINT, GL_LINE, GL_FILL,
};

View File

@ -49,6 +49,7 @@ class GL4CommandProcessor : public CommandProcessor {
// HACK: for debugging; would be good to have this in a base type.
TextureCache* texture_cache() { return &texture_cache_; }
DrawBatcher* draw_batcher() { return &draw_batcher_; }
GLuint GetColorRenderTarget(uint32_t pitch, MsaaSamples samples,
uint32_t base, ColorRenderTargetFormat format);
@ -115,9 +116,9 @@ class GL4CommandProcessor : public CommandProcessor {
IndexBufferInfo* index_buffer_info) override;
UpdateStatus UpdateShaders(PrimitiveType prim_type);
UpdateStatus UpdateRenderTargets();
UpdateStatus UpdateState();
UpdateStatus UpdateState(PrimitiveType prim_type);
UpdateStatus UpdateViewportState();
UpdateStatus UpdateRasterizerState();
UpdateStatus UpdateRasterizerState(PrimitiveType prim_type);
UpdateStatus UpdateBlendState();
UpdateStatus UpdateDepthStencilState();
UpdateStatus PopulateIndexBuffer(IndexBufferInfo* index_buffer_info);
@ -191,6 +192,7 @@ class GL4CommandProcessor : public CommandProcessor {
uint32_t pa_sc_screen_scissor_tl;
uint32_t pa_sc_screen_scissor_br;
uint32_t multi_prim_ib_reset_index;
PrimitiveType prim_type;
UpdateRasterizerStateRegisters() { Reset(); }
void Reset() { std::memset(this, 0, sizeof(*this)); }