Files @ r13257:4c5b8120be59
Branch filter:

Location: cpp/openttd-patchpack/source/Makefile.lang.in - annotation

rubidium
(svn r17776) -Codechange: [SDL] make "update the video card"-process asynchronious. Profiling with gprof etc. hasn't shown us that DrawSurfaceToScreen takes a significant amount of CPU; only using TIC/TOC it became apparant that it was a heavy CPU-cycle user or that it was waiting for something.
The benefit of making this function asynchronious ranges from 2%-25% (real time) during fast forward on dual core/hyperthreading-enabled CPUs; 8bpp improvements are, in my test cases, significantly smaller than 32bpp improvements.
On single core non-hyperthreading-enabled CPUs the extra locking/scheduling costs up to 1% extra realtime in fast forward. You can use -v sdl:no_threads to disable threading and undo this loss.
During normal non-fast-forwarded games the benefit/costs are negligable except when the gameloop takes more than about 90% of the time of a tick.
Note that allegro's performance does not improve with this system, likely due to their way of getting data to the video card. It is not implemented for the OS X/Windows video backends, unless (ofcourse) SDL is used there.
Funny is that the performance of the 32bpp(-anim) blitter is, at least in some test cases, significantly faster (more than 10%) than the 8bpp(-optimized) blitter when looking at real time in fast forward on a dual core CPU; it was slower.
The idea comes from a paper/report by Idar Borlaug and Knut Imar Hagen.
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r12951:0cd9683b75be
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r12371:b824f0eb22c3
r5587:034e5e185dc2
r5587:034e5e185dc2
r5475:3f5cd13d1b63
r5587:034e5e185dc2
r5587:034e5e185dc2
r5587:034e5e185dc2
r5475:3f5cd13d1b63
r8539:d068336d15ec
r8539:d068336d15ec
r8539:d068336d15ec
r8539:d068336d15ec
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5594:17b847761731
r5475:3f5cd13d1b63
r8539:d068336d15ec
r5475:3f5cd13d1b63
r12769:b62f6f744e61
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5499:2532bb0e26c1
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5587:034e5e185dc2
r5475:3f5cd13d1b63
r5587:034e5e185dc2
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r6918:be5c21fe75f7
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
# $Id$

# This file is part of OpenTTD.
# OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.

STRGEN        = !!STRGEN!!
ENDIAN_CHECK  = !!ENDIAN_CHECK!!
SRC_DIR       = !!SRC_DIR!!
LANG_DIR      = !!LANG_DIR!!
BIN_DIR       = !!BIN_DIR!!
LANGS_SRC     = $(shell ls $(LANG_DIR)/*.txt)
LANGS         = $(LANGS_SRC:$(LANG_DIR)/%.txt=%.lng)
CXX_BUILD     = !!CXX_BUILD!!
CFLAGS_BUILD  = !!CFLAGS_BUILD!!
LDFLAGS_BUILD = !!LDFLAGS_BUILD!!
STRGEN_FLAGS  = !!STRGEN_FLAGS!!
STAGE         = !!STAGE!!
LANG_SUPPRESS = !!LANG_SUPPRESS!!
LANG_OBJS_DIR = !!LANG_OBJS_DIR!!

ifeq ($(LANG_SUPPRESS), yes)
LANG_ERRORS = >/dev/null 2>&1
endif

# Make sure endian_host.h is reasable as if it was in the src/ dir
CFLAGS_BUILD += -I $(LANG_OBJS_DIR)

ENDIAN_TARGETS := endian_host.h endian_target.h $(ENDIAN_CHECK)

# Check if we want to show what we are doing
ifdef VERBOSE
	Q =
	E = @true
else
	Q = @
	E = @echo
endif

RES := $(shell mkdir -p $(BIN_DIR)/lang )

all: table/strings.h $(LANGS)

strgen.o: $(SRC_DIR)/strgen/strgen.cpp endian_host.h $(SRC_DIR)/table/control_codes.h $(SRC_DIR)/table/strgen_tables.h
	$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
	$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<

string.o: $(SRC_DIR)/string.cpp endian_host.h
	$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
	$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<

alloc_func.o: $(SRC_DIR)/core/alloc_func.cpp endian_host.h
	$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
	$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<

lang/english.txt: $(LANG_DIR)/english.txt
	$(Q)mkdir -p lang
	$(Q)cp $(LANG_DIR)/english.txt lang/english.txt

$(STRGEN): alloc_func.o string.o strgen.o
	$(E) '$(STAGE) Compiling and Linking $@'
	$(Q)$(CXX_BUILD) $(LDFLAGS_BUILD) $^ -o $@

table/strings.h: lang/english.txt $(STRGEN)
	$(E) '$(STAGE) Generating $@'
	@mkdir -p table
	$(Q)./$(STRGEN) -s $(LANG_DIR) -d table

$(LANGS): %.lng: $(LANG_DIR)/%.txt $(STRGEN) lang/english.txt
	$(E) '$(STAGE) Compiling language $(*F)'
	$(Q)./$(STRGEN) $(STRGEN_FLAGS) -s $(LANG_DIR) -d $(LANG_OBJS_DIR) $< $(LANG_ERRORS) && cp $@ $(BIN_DIR)/lang || true # Do not fail all languages when one fails

# The targets to compile the endian-code

endian_host.h: $(ENDIAN_CHECK)
	$(E) '$(STAGE) Testing endianness for host'
	$(Q)./$(ENDIAN_CHECK) > $@

$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
	$(E) '$(STAGE) Compiling and Linking $@'
	$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $< -o $@

depend:

clean:
	$(E) '$(STAGE) Cleaning up language files'
	$(Q)rm -f strgen.o string.o table/strings.h $(STRGEN) $(LANGS) $(LANGS:%=$(BIN_DIR)/lang/%) lang/english.* $(ENDIAN_TARGETS)

mrproper: clean

%.lng:
	@echo '$(STAGE) No such language: $(@:%.lng=%)'

.PHONY: all mrproper depend clean