From 5c3d447c95d55c9c7da2dd69569549992e3fd741 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Wed, 11 May 2016 10:02:48 +0200 Subject: wx: Fix driver command queue The command queue could still loose a cmd because the command was reused while still in (recursive) use, thus when deleting it after command was done a newly added command could be mistakenly deleted and not called. Root cause was that wxeFifo::Strip "deleted" to many cmds. Solve by differing deleted and executed, i.e. op= -1 cmd have been executed and op = -2 cmd have been executed and deleted. --- lib/wx/c_src/wxe_helpers.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/wx/c_src/wxe_helpers.cpp b/lib/wx/c_src/wxe_helpers.cpp index 4798e605e8..d1f607d2af 100644 --- a/lib/wx/c_src/wxe_helpers.cpp +++ b/lib/wx/c_src/wxe_helpers.cpp @@ -48,7 +48,7 @@ void wxeCommand::Delete() driver_free(buffer); buffer = NULL; } - op = -1; + op = -2; } /* **************************************************************************** @@ -84,7 +84,7 @@ wxeCommand * wxeFifo::Get() pos = m_first++; m_n--; m_first %= m_max; - } while(m_q[pos].op == -1); + } while(m_q[pos].op < 0); return &m_q[pos]; } @@ -96,7 +96,7 @@ wxeCommand * wxeFifo::Peek(unsigned int *i) return NULL; pos = (m_first+*i) % m_max; (*i)++; - } while(m_q[pos].op == -1); + } while(m_q[pos].op < 0); return &m_q[pos]; } @@ -213,7 +213,7 @@ void wxeFifo::Realloc() // Strip end of queue if ops are already taken care of, avoids reallocs void wxeFifo::Strip() { - while((m_n > 0) && (m_q[(m_first + m_n - 1)%m_max].op == -1)) { + while((m_n > 0) && (m_q[(m_first + m_n - 1)%m_max].op < -1)) { m_n--; } } -- cgit v1.2.3 From f8e2668ef2ea42fbbf695d63cb840913c32f1d72 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 12 May 2016 09:31:53 +0200 Subject: wx: Fix generated defines in gl.hrl --- lib/wx/api_gen/gl_gen.erl | 14 ++++++++++++-- lib/wx/include/gl.hrl | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/wx/api_gen/gl_gen.erl b/lib/wx/api_gen/gl_gen.erl index 0473b7d771..54635bdd2e 100644 --- a/lib/wx/api_gen/gl_gen.erl +++ b/lib/wx/api_gen/gl_gen.erl @@ -191,8 +191,9 @@ parse_define([#xmlElement{name=initializer,content=Contents}|_R],Def,_Os) -> try case Val0 of "0x" ++ Val1 -> - _ = list_to_integer(Val1, 16), - Def#def{val=Val1, type=hex}; + Val2 = strip_type_cast(Val1), + _ = list_to_integer(Val2, 16), + Def#def{val=Val2, type=hex}; _ -> Val = list_to_integer(Val0), Def#def{val=Val, type=int} @@ -214,6 +215,15 @@ extract_def2([#xmlElement{content=Cs}|R]) -> extract_def2(Cs) ++ extract_def2(R); extract_def2([]) -> []. +strip_type_cast(Int) -> + lists:reverse(strip_type_cast2(lists:reverse(Int))). + +strip_type_cast2("u"++Rest) -> Rest; %% unsigned +strip_type_cast2("lu"++Rest) -> Rest; %% unsigned long +strip_type_cast2("llu"++Rest) -> Rest; %% unsigned long long +strip_type_cast2(Rest) -> Rest. + + strip_comment("/*" ++ Rest) -> strip_comment_until_end(Rest); strip_comment("//" ++ _) -> []; diff --git a/lib/wx/include/gl.hrl b/lib/wx/include/gl.hrl index 39cd474fcb..d708515e1b 100644 --- a/lib/wx/include/gl.hrl +++ b/lib/wx/include/gl.hrl @@ -1723,7 +1723,7 @@ -define(GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, 16#8A44). -define(GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER, 16#8A45). -define(GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER, 16#8A46). --define(GL_INVALID_INDEX, 16#FFFFFFFFu). +-define(GL_INVALID_INDEX, 16#FFFFFFFF). -define(GL_COPY_READ_BUFFER, 16#8F36). -define(GL_COPY_WRITE_BUFFER, 16#8F37). -define(GL_DEPTH_CLAMP, 16#864F). @@ -1746,7 +1746,7 @@ -define(GL_CONDITION_SATISFIED, 16#911C). -define(GL_WAIT_FAILED, 16#911D). -define(GL_SYNC_FLUSH_COMMANDS_BIT, 16#00000001). --define(GL_TIMEOUT_IGNORED, 16#FFFFFFFFFFFFFFFFull). +-define(GL_TIMEOUT_IGNORED, 16#FFFFFFFFFFFFFFFF). -define(GL_SAMPLE_POSITION, 16#8E50). -define(GL_SAMPLE_MASK, 16#8E51). -define(GL_SAMPLE_MASK_VALUE, 16#8E52). -- cgit v1.2.3 From 415a912b969c24a60c47ff7e74e560047b2d747f Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Mon, 16 May 2016 10:30:48 +0200 Subject: Fix compilation warning --- lib/wx/test/wx_class_SUITE.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/wx/test/wx_class_SUITE.erl b/lib/wx/test/wx_class_SUITE.erl index 6944a78360..0a3c4659bf 100644 --- a/lib/wx/test/wx_class_SUITE.erl +++ b/lib/wx/test/wx_class_SUITE.erl @@ -646,8 +646,8 @@ modal(Config) -> %% need to sleep so we know that the window is stuck in %% the ShowModal event loop and not in an earlier event loop %% wx2.8 invokes the event loop from more calls than wx-3 - receive {dialog, M1, 1} -> timer:sleep(1200), ets:insert(test_state, {M1, ready}) end, - receive {dialog, M2, 2} -> timer:sleep(1200), ets:insert(test_state, {M2, ready}) end, + M1 = receive {dialog, W1, 1} -> timer:sleep(1200), ets:insert(test_state, {W1, ready}), W1 end, + M2 = receive {dialog, W2, 2} -> timer:sleep(1200), ets:insert(test_state, {W2, ready}), W2 end, receive done -> ok end, receive {dialog_done, M2, 2} -> M2 end, -- cgit v1.2.3