Sergey Lipskiy
e011ee56b5
Fix internal texture formats for GLES 2.0
2017-02-10 16:58:17 +07:00
Sergey Lipskiy
403c60cfea
Convert texture format returned by GLideNHQ for GLES2.
2017-02-05 20:26:40 +07:00
Sergey Lipskiy
e232ae9e09
Rename InternalColorFormatParam RGBA to InternalColorFormatParam RGBA8.
2017-02-05 20:07:13 +07:00
Francisco Zurita
669e925029
Fix typo in ImageFormat() ctor in Textures.cpp
2017-01-29 22:09:56 +07:00
Sergey Lipskiy
df4a81bfea
Add special Parameter classes to make parametrs usage more safe.
2017-01-28 16:52:09 +07:00
Sergey Lipskiy
5ddfd78f50
Rewrite TextureLoadParameters.
...
This static structure uses static values from Parameters.cpp.
It can be initialized before initialization of parameters it uses.
I had to put it inside aux struct with delayed initialization.
MSVS 2013 can't do initialization of non-static objects with initialization list,
so I had to add ugly workaround for it.
2017-01-28 10:11:45 +07:00
Sergey Lipskiy
ea4d174e5c
Correct texture initialization.
2017-01-26 21:36:54 +07:00
Sergey Lipskiy
80ed169e24
Remove use of OpenGL.h
2017-01-22 20:43:05 +07:00
Sergey Lipskiy
4a97083d77
Raplace GL types in TextureLoadParameters
2017-01-22 18:44:42 +07:00
Sergey Lipskiy
663f696d8f
Remove direct calls of glBindTexture and GL_UNPACK_ALIGNMENT related functions.
2017-01-22 18:10:52 +07:00
Sergey Lipskiy
4e459c7645
Change type of CachedTexture name to graphics::ObjectHandle
2017-01-21 19:48:02 +07:00
Sergey Lipskiy
e34ebdc543
Remove obsolete constants for texture indices.
...
Use values from Parameters.h
2017-01-18 22:44:35 +07:00
Sergey Lipskiy
e83c3489a3
Replace OGLVideo by DisplayWindow
...
Replace OGLRender by GraphicsDrawer
2017-01-16 20:56:11 +07:00
Sergey Lipskiy
dd57479838
Add Drawer class to replace OGLRender WIP
2017-01-10 22:22:32 +07:00
Sergey Lipskiy
43e8aef6ea
Remove old-style code.
2017-01-09 11:21:06 +07:00
Sergey Lipskiy
c39b639d7c
Remove unused shaders related files.
2017-01-08 20:31:38 +07:00
Sergey Lipskiy
dcf1065957
Add textureIndices parameters
2017-01-08 17:49:47 +07:00
Sergey Lipskiy
cf5e9d8ed2
BufferManipulationObjects WIP
2017-01-02 21:00:49 +07:00
Sergey Lipskiy
3eb11aac82
setTextureParameters WIP
2017-01-01 21:59:54 +07:00
Sergey Lipskiy
eb7b640aa0
Use InitTextureParams struct instead of separate parameters.
2016-12-31 19:30:22 +07:00
Sergey Lipskiy
2a1a2d5c00
Implement Init2DTexture objects
2016-12-31 19:30:13 +07:00
Sergey Lipskiy
365b116c57
Start Graphics content implementation. First step: init , destroy , createTexture, deleteTexture
2016-12-31 19:30:05 +07:00
Sergey Lipskiy
91f015846c
Fix bug in TextureCache::update
...
Fixed textures in Supercross 2000.
2016-11-29 22:39:59 +07:00
Logan McNaughton
ad77e3db52
Remove some GLES3_1 ifdefs
2016-11-22 12:59:15 +07:00
Sergey Lipskiy
3b9f3a4263
Correct asserts in Textures.cpp
...
Previus conditions not met when texture pack is used.
2016-11-20 11:09:18 +07:00
Sergey Lipskiy
be6179cbcc
Revert 263ddf4
because it does not work properly on old PC cards.
2016-11-14 20:45:32 +07:00
Sergey Lipskiy
263ddf4baa
Use glTexStorage2DMultisample instead of glTexImage2DMultisample for OpenGL.
...
The same code with GLES3X.
2016-11-13 11:42:14 +07:00
Francisco Zurita
a48e1e37ca
Add support for LOD with GLES2
2016-11-07 16:22:58 +07:00
Sergey Lipskiy
354327b3f9
Correct checksum calculation for CI textures.
...
Fixed Mischief Makers incorrect textures #1175
2016-10-15 12:52:34 +07:00
Sergey Lipskiy
fc8c65f81b
Code cleanup: remove unused CachedTexture::lastDList
2016-10-05 15:28:36 +07:00
orbea
f7576185cc
Fix Texture Cache slow down and crashes
2016-09-15 15:44:55 -07:00
Sergey Lipskiy
feb446c3f8
Fix checksum calculation for mip-mapped textures.
2016-07-13 17:14:29 +06:00
Sergey Lipskiy
0ffaf66de0
Minor _calculateCRC optimization.
2016-07-12 15:46:07 +06:00
Sergey Lipskiy
d1749518ca
Add tile format and size to texture checksum calculation.
2016-07-11 21:50:37 +06:00
Sergey Lipskiy
803eb1d381
Clear cache if its size is too large.
2016-07-03 00:10:01 +06:00
Sergey Lipskiy
006218c708
Optimize TextureCache::_clear()
2016-07-03 00:09:58 +06:00
Sergey Lipskiy
5efd89ccd2
Fix input texture checksum calculation.
2016-07-03 00:09:26 +06:00
Sergey Lipskiy
2fbee3661f
Move TextureFilterHandler class to separate files.
2016-06-10 17:58:47 +06:00
Sergey Lipskiy
86fbea9edc
Code refactor: replace NULL by nullptr.
2016-06-10 12:40:18 +06:00
Logan McNaughton
8c632ca0ad
Fix Texture Cache on Raspberry Pi
...
The Raspberry Pi only supports 32768 GPU memory allocations
see https://github.com/raspberrypi/firmware/issues/611
Each texture takes 2 allocs, so the max is around 16000, I've set it to 15000 to be safe
2016-06-08 20:10:14 +06:00
Sergey Lipskiy
27a7540130
Add bHDTexture flag to CachedTexture structure.
2016-06-03 10:44:23 +06:00
Sergey Lipskiy
d337f0a316
Correct texture select when texture LOD is enabled but combiner does not use LOD.
...
Fixed tunel lamps in Top Gear Rally, #981
2016-05-10 21:44:03 +06:00
Sergey Lipskiy
ccff245f85
Implement render to depth buffer.
...
Fixed shadows in Pilot Wings.
Removed special texrect for NFL Quaterback 98 monitor: it is now supported by general code
2016-05-08 17:25:22 +06:00
Sergey Lipskiy
8f5a6b74b4
Fix mip-mapping for texture level 0.
...
Fixed World Cup 98: wrong ground (mip mapping or lod?) (regression) #858
2016-05-04 20:51:05 +06:00
Sergey Lipskiy
2649af3be3
Revert commit ebfd9b3... Enable texture mirror if real_size / size == 2
...
Fixed Pokemon Snap textures are upside down #859
2016-05-03 18:00:08 +06:00
Sergey Lipskiy
6e0d0432a7
Implement depth texture load for nfl quaterback 98
...
Fixed nfl quaterback 98: missing fb effect (whatever option used) #316
2016-04-09 21:07:55 +06:00
Sergey Lipskiy
bbf8ad91e6
Don't skip texture filter when texture dump is on.
2016-04-08 12:03:22 +06:00
Sergey Lipskiy
cc5dc009d8
Use current TLUT mode in texture CRC.
...
Hopefully fixed quake 2: wrong colors on corpses #328
2016-03-23 21:14:21 +06:00
Sergey Lipskiy
d8f8f587cf
Fix texture clamp size calculation during texture load.
...
Fixed Knife Edge: wrong texts #846
Warning: texture load changed, regressions possible.
2016-03-22 20:51:00 +06:00
matto
7fb2ad2d5b
Fixing what is almost certainly a memory leak
2016-03-07 12:58:49 +06:00
Sergey Lipskiy
67cab52909
Fix tile width calculation in LOADTYPE_TILE mode.
...
Fixed background textures size in Dark Rift.
2016-03-05 20:09:11 +06:00
Sergey Lipskiy
29b0b8c1ae
Fix mipmaped texture load when gSP.texture.tile is not 0.
...
Example: Tetrisphere.
2016-03-05 17:51:17 +06:00
Sergey Lipskiy
8f952921a0
Use 32bit texture formats for G_TT_IA16 mode.
2016-03-01 16:49:43 +06:00
Sergey Lipskiy
e58ce1e758
Code cleanup: make struct TextureLoadParameters more readable.
2016-03-01 16:48:35 +06:00
Sergey Lipskiy
232800a823
Fix TMEM address mask for tlut_en case. Thanks angrylion for the hint.
...
Fixed texture mapping for 3D objects in Mischief Makers.
2016-02-09 22:00:45 +06:00
purplemarshmallow
c661ace24e
Replace RSP.DList by OGLVideo::getBuffersSwapCount()
...
RSP.DList does not count the dlists, it counts the buffer swaps.
Thus it is replaced by counter in OGLVideo.
2015-10-17 21:20:50 +06:00
matto
0dfbd34b09
Fixing Andriod build (possibly, cannot test)
...
http://www.cplusplus.com/reference/list/list/erase/
cplusplus.com says that std::list::erase takes arguments
of const_iterator, but from build errors the Andriod
runtime says it takes non const iterators. gcc doesn't mind
removing the constness and it's not so important that they're
const, so I'm removing them.
2015-10-08 21:17:03 +06:00
matto
4e415802fa
Changing the texture cache to be a proper LRU cache
...
I change the currently used 'map' of textures to a queue (implemented as a
list), and then remove from the end of the queue when textures need removing
from the cache, and adding to the beginning of the queue.
The other operation that is needed is moving the texture to the
front of the list whenever it is used, so that frequently used
textures are not deleted.
In order to make that last operation effecient, I created
a map of the locations of these textures, and keep that
properly updated. This makes the accessing of a texture still O(1).
Then, in order to have the iterators remain valid through insertions
and deletions, I needed to implement the queue as a list.
The map and queue implementation is a standard way to implement
an LRU cache, just FYI. Not something I thought of all on my own.
Fixes issue #744
2015-10-08 21:15:09 +06:00
matto
18172a6c0b
Fixing multisampling
...
We were calling glTexStorage2DMultisample with a 'samples' parameter of 0.
Reading the GL 4.4 spec, this is specifically forbidden, but the
documentation pages from Chronos were incorrectly stating that it was
allowed, so many implementations probably accept it. Mesa, the graphics
driver for many Linux cards has recently been corrected so that it emits
a warning and fails when glTexStorage2DMultisample is called with
samples=0. The current release works, but the next one will fail when
multisampling is turned off in this plugin (with multisampling turned
on, it will work the same as before).
The documentation pages from Kronos have since been updated to reflect
the GL spec (I put in a bug to them). You can see the proper
changes at this address
(https://www.opengl.org/wiki/GLAPI/glTexStorage2DMultisample ).
2015-09-08 10:58:52 +06:00
matto
3e8ab78258
Code cleanup: Adding newlines to code lines that were too long.
...
I think this adds to the readability of the code, as my brain
starts reeling when the line has to break off the page.
2015-09-03 21:27:55 +06:00
matto
6c22746619
Code cleanup: removing random semicolon.
2015-09-03 21:25:40 +06:00
matto
4eb27a8795
Adding assert on malloc
...
We do this in other places and I think it's good behaviour for the
exceptional occasion that we cannot allocate memory.
2015-09-03 21:24:35 +06:00
matto
6156c35617
Code cleanup: moving logic from large loop in TextureCache::_load to
...
worker function.
This makes this loop tighter and easier to read. The loop was really
difficult to read before, and now it's a tad easier.
2015-09-03 21:22:08 +06:00
matto
fa7e1c8137
Splitting up asserts
...
If these asserts are to be useful for debugging, they should really
be split up so that we can tell which one is failing.
2015-08-29 11:55:34 -04:00
Sergey Lipskiy
74afd9f114
Fix getTextureShiftScale for case of one-level mip-map.
...
Fixed guard rail in Banjo Kazooie, #158
2015-06-17 22:58:03 +06:00
Sergey Lipskiy
27149064e0
Correct load to TMEM functions: wrap tmem address in case of overflow.
...
Necessary for issue #571
2015-06-17 16:02:06 +06:00
Sergey Lipskiy
e3dcba03f6
Minor correction in GetCI16RGBA functions.
...
Make calculations a bit more optimal and clear.
2015-06-05 00:07:51 +06:00
Sergey Lipskiy
37b5a38486
Enable texture_filter_anisotropic for GLES.
2015-06-01 14:50:04 +06:00
Sergey Lipskiy
9299dc5549
Disable mip-map texture load for GLES2.
2015-05-26 14:03:53 +06:00
Sergey Lipskiy
ae694f98e0
Always use GL_RGBA as internal texture format for GLES2.
...
Fixed compatibility with Mali400 GPU.
2015-05-26 14:03:47 +06:00
Sergey Lipskiy
0c416070c7
Fix load RGBA16 texture when tlut is enabled.
...
Solution is taken from Angrylion's software lle plugin.
Fixed Mario Kart- thwomp textures #532
2015-05-22 19:05:21 +06:00
Sergey Lipskiy
47719e3ce3
Don't set GL_TEXTURE_MAX_LEVEL for GLES2.
2015-05-18 13:51:14 +06:00
Sergey Lipskiy
73fcf8d551
Move TextureCache::m_curUnpackAlignment initialization to TextureCache::_addTexture
...
Mupen64plus set GL_UNPACK_ALIGNMENT to 1 after TextureCache::init().
When TextureCache set GL_UNPACK_ALIGNMENT back to value obtained in init(),
it broke text in mupen64plus messages.
2015-05-13 10:22:34 +06:00
Sergey Lipskiy
2feb8a24dd
Use glTexStorage2DMultisample for GLES3_1
2015-05-13 10:22:33 +06:00
Sergey Lipskiy
7f9a3973eb
Do not use textureLod for fetching normal textures. It kills anisotropic filtering:
...
https://www.opengl.org/wiki/Sampler_(GLSL)
Also need to keep in mind issue #232 and not allow mip-mapping for combiners,
which do not use it.
Fixed anisotropic filtering not working #505
2015-05-13 10:22:29 +06:00
Sergey Lipskiy
eabbd252f8
Change CachedTexture::frameBufferTexture type to enum.
...
Need to separate one-sampled frame buffer textures from multosampled ones.
2015-05-13 10:22:27 +06:00
Sergey Lipskiy
663a0d76f1
Implement multisampled textures fetch in shaders.
...
Thanks mudlord for the idea.
Fixed Perfect Dark frame buffer effects do not work when FSAA is on. #244
2015-05-13 10:22:26 +06:00
Sergey Lipskiy
6afe5fe30c
Disable anisotropy for GL ES
2015-05-13 10:22:08 +06:00
Sergey Lipskiy
ded889350c
Remove use of obsolete texture type GL_LUMINANCE8_ALPHA8.
2015-05-13 10:22:07 +06:00
Sergey Lipskiy
d95103d3d1
Correct condition for mip-mapped textures filtering in 3 point filter mode.
2015-05-13 10:21:54 +06:00
Sergey Lipskiy
4b1114a113
Fix texture ShiftScale calculation.
...
Pokemon Stadium missing ground texture #412 reveals the problem:
the game loads the same texture into tile0 and tile1.
The only difference is ShiftScale values.
Since the checksum is the same, the same CachedTexture is used for both tiles.
Shift scale correction ovrwrites ShiftScale for tile0 when tile1 is loaded.
Thus, texture coordinates for both tiles will be same.
Combiner uses (tile0-tile1)*env_a+shade. Since t0==t1, texture component is missing.
Solution: calculate ShiftScale for each tile right before use.
Fixed #412
2015-05-13 10:21:49 +06:00
Sergey Lipskiy
52d68d1389
Move all sources to src folder.
2015-05-13 10:21:32 +06:00