Commit graph

1807 commits

Author SHA1 Message Date
bunnei 95144cc39c gl_shader_decompiler: Implement IPA instruction. 2018-04-17 16:36:39 -04:00
bunnei 8b4443c966 gl_shader_decompiler: Add support for TEXS instruction. 2018-04-17 16:36:38 -04:00
bunnei 5ba71369ac gl_shader_decompiler: Use fragment output color for GPR 0-3. 2018-04-17 15:25:54 -04:00
bunnei 5d529698c9 gl_shader_decompiler: Partially implement MUFU. 2018-04-17 15:25:54 -04:00
bunnei 2b082e2710
Merge pull request #343 from Subv/tex_wrap_4
GPU: Implement some wrap modes
2018-04-17 12:25:24 -04:00
Subv 636ad34707 MaxwellToGL: Implemented tex wrap mode 1 (Wrap, GL_REPEAT). 2018-04-17 10:17:18 -05:00
Subv 7fc516cc1a MaxwellToGL: Added a TODO and partial implementation of maxwell wrap mode 4 (Clamp, GL_CLAMP).
This clamp mode was removed from OpenGL as of 3.1, we can emulate it by using GL_CLAMP_TO_BORDER to get the border color of the texture, and then manually sampling the edge to mix them in the fragment shader.
2018-04-17 10:16:50 -05:00
bunnei 77bdc49343 gl_rendering: Use NGLOG* for changed code. 2018-04-16 21:23:28 -04:00
bunnei 1a1af3fda3 gl_rasterizer: Implement indexed vertex mode. 2018-04-16 21:10:15 -04:00
Subv 477aab5960 GPU: Use the same buffer names in the generated GLSL and the buffer uploading code. 2018-04-15 15:02:50 -05:00
Subv 14ac40436e GPU: Don't use explicit binding points when uploading the constbuffers to opengl.
The bindpoints will now be dynamically calculated based on the number of buffers used by the previous shader stage.
2018-04-15 14:14:57 -05:00
Subv e128e90350 GPU: Don't use GetPointer when uploading the constbuffer data to the GPU. 2018-04-15 11:18:09 -05:00
Subv 7da47da66e GPU: Use the buffer hints from the shader decompiler to upload only the necessary const buffers for each shader stage. 2018-04-15 11:15:54 -05:00
bunnei 73d9c494ea shaders: Expose hints about used const buffers. 2018-04-15 11:50:10 -04:00
Subv c9b511da08 GPU: Upload the entirety of each constbuffer for each shader stage as SSBOs.
We're going to need the shader generator to give us a mapping of the actual used const buffers to properly bind them to the shader.
2018-04-14 23:02:05 -05:00
Subv 1957640ea2 GPU: Allow configuring ssbos in the opengl state manager. 2018-04-14 22:54:23 -05:00
Subv ae58e46036 GPU: Added a function to determine whether a shader stage is enabled or not. 2018-04-14 22:54:23 -05:00
bunnei 1b41b875dc shaders: Add NumTextureSamplers const, remove unused #pragma. 2018-04-14 18:50:06 -04:00
bunnei e6224fec27 shaders: Address PR review feedback. 2018-04-14 16:01:41 -04:00
bunnei eabeedf6af gl_shader_decompiler: Cleanup log statements. 2018-04-14 16:01:41 -04:00
bunnei 0d408b965b shaders: Fix GCC and clang build issues. 2018-04-14 16:01:40 -04:00
bunnei 86135864da gl_shader_decompiler: Implement negate, abs, etc. and lots of cleanup. 2018-04-14 16:01:40 -04:00
bunnei 7639667562 shader_bytecode: Add FSETP and KIL to GetInfo. 2018-04-14 16:01:40 -04:00
bunnei 5a47832221 shader_bytecode: Add SubOp decoding. 2018-04-14 16:01:40 -04:00
bunnei 50023bdae7 gl_shader_decompiler: Add shader stage hint. 2018-04-14 16:01:39 -04:00
bunnei a992aac5eb renderer_opengl: Fix Morton copy byteswap, etc. 2018-04-14 16:01:39 -04:00
bunnei 0ca8fce9d0 gl_shader_manager: Implement SetShaderSamplerBindings. 2018-04-13 23:48:30 -04:00
bunnei beddc8afd2 gl_rasterizer: Generate shaders and upload uniforms. 2018-04-13 23:48:29 -04:00
bunnei 85d77a3d24 gl_shader_decompiler: Basic impl. for very simple vertex shaders.
- Tested with Puyo Puyo Tetris and Cave Story+
2018-04-13 23:48:28 -04:00
bunnei 51f37f5061 gl_shader_manager: Cleanup and consolidate uniform handling. 2018-04-13 23:48:28 -04:00
bunnei 35aca0bf1f maxwell_3d: Make memory_manager public. 2018-04-13 23:48:27 -04:00
bunnei 33bb53571b maxwell_3d: Fix shader_config decodings. 2018-04-13 23:48:26 -04:00
bunnei 5617831d5f gl_rasterizer: Use shader program manager, remove test shader. 2018-04-13 23:48:26 -04:00
bunnei 459826a705 renderer_opengl: Add gl_shader_manager class. 2018-04-13 23:48:25 -04:00
bunnei 8aa21a03b3 maxwell_to_gl: Add a few types, etc. 2018-04-13 23:48:24 -04:00
bunnei 10953495c1 gl_shader_gen: Add hashable setup/config structs. 2018-04-13 23:48:23 -04:00
bunnei 2fcbb35ad2 gl_shader_util: Add missing includes. 2018-04-13 23:48:23 -04:00
bunnei da1114ca59 renderer_opengl: Use OGLProgram instead of OGLShader. 2018-04-13 23:48:21 -04:00
bunnei 4f2b2d0bc5 gl_shader_util: Grab latest upstream. 2018-04-13 23:48:21 -04:00
bunnei dbfd106ba0 gl_resource_manager: Grab latest upstream. 2018-04-13 23:48:20 -04:00
bunnei ed7e597b44 gl_shader_decompiler: Add skeleton code from Citra for shader analysis. 2018-04-13 23:48:20 -04:00
bunnei 4e7e0f8112 shader_bytecode: Add initial module for shader decoding. 2018-04-13 23:48:19 -04:00
James Rowe 0b855f1c21 Fix clang format issues 2018-04-06 22:00:48 -06:00
Subv dcc27d6dc1 GPU: Assert when finding a texture with a format type other than UNORM. 2018-04-06 20:44:46 -06:00
Subv b0ca330e14 GL: Set up the textures used for each draw call.
Each Maxwell shader stage can have an arbitrary number of textures, but we're limited to a certain number in OpenGL. We try to only use the minimum amount of host textures by not keeping a 1:1 relation between guest texture ids and host texture ids, ie, guest texture id 8 can be host texture id 0 if it's the only texture used in the guest shader program.
This mapping will have to be passed to the shader decompiler so it can rewrite the texture accesses.
2018-04-06 20:44:46 -06:00
Subv cb3183212d GL: Bind the textures to the shaders used for drawing. 2018-04-06 20:44:46 -06:00
Subv 65faeb9b2a GLCache: Specialize the MortonCopy function for the DXT1 texture format.
It will now use the UnswizzleTexture function instead of the MortonCopyPixels128, which doesn't seem to work for textures.
2018-04-06 20:44:46 -06:00
Subv b258403f0d GLCache: Implemented GetTextureSurface. 2018-04-06 20:44:45 -06:00
Subv 65ea52394b GLCache: Support uploading compressed textures to the GPU.
Compressed texture formats like DXT1, DXT2, DXT3, etc will use this to ease the load on the CPU.
2018-04-06 20:44:45 -06:00
Subv 73eaef9c05 GL: Remove remaining references to 3DS-specific pixel formats 2018-04-06 20:44:42 -06:00
Subv b305646c44 RasterizerCache: Remove 3DS-specific pixel formats.
We're only left with RGB8 and DXT1 for now. More will be added as they are needed.
2018-04-06 20:40:24 -06:00
Subv c28ed85875 GL: Create the sampler objects when starting up the GL rasterizer. 2018-04-06 20:40:24 -06:00
Subv ca96b04a0c GL: Ported the SamplerInfo struct from citra. 2018-04-06 20:40:24 -06:00
Subv 0171ec606b GL: Rename PicaTexture to MaxwellTexture. 2018-04-06 20:40:24 -06:00
Subv f73a280eeb GL: Added functions to convert Maxwell tex filters and wrap modes to OpenGL. 2018-04-06 20:40:23 -06:00
Subv ad1810e895 Textures: Added a helper function to know if a texture is blocklinear or pitch. 2018-04-06 20:40:23 -06:00
N00byKing d1d7582a5b
rasterizer_interface.h: Update from citra to yuzu 2018-04-04 23:07:58 +02:00
N00byKing 27dbbd8227
gl_rasterizer_cache.cpp: Update from citra to yuzu 2018-04-04 23:05:10 +02:00
N00byKing cfc28e0c1a
gl_rasterizer_cache.h: Update from citra to yuzu 2018-04-04 23:04:24 +02:00
N00byKing ca17f581f5
renderer_opengl.h: Update from citra to yuzu 2018-04-04 23:03:02 +02:00
Subv 11b4ab9685 GPU: Use the MacroInterpreter class to execute the GPU macros instead of HLEing them. 2018-04-01 12:07:26 -05:00
Subv 1ec8d2123d GPU: Implemented a gpu macro interpreter.
The Ryujinx macro interpreter and envydis were used as reference.

Macros are programs that are uploaded by the games during boot and can later be called by writing to their method id in a GPU command buffer.
2018-04-01 12:07:26 -05:00
bunnei 5e343edc9e renderer_opengl: Use better naming for DrawScreens and DrawSingleScreen. 2018-03-26 21:17:07 -04:00
bunnei c33abac275 gl_rasterizer: Move code to bind framebuffer surfaces before draw to its own function. 2018-03-26 21:17:05 -04:00
bunnei d30110348b gl_rasterizer: Add a SyncViewport method. 2018-03-26 21:17:04 -04:00
bunnei 67bc2f5ecd gl_rasterizer: Move PrimitiveTopology check to MaxwellToGL. 2018-03-26 21:17:03 -04:00
bunnei 666d53299c graphics_surface: Fix merge conflicts. 2018-03-26 21:17:03 -04:00
bunnei ac19e3d061 gl_rasterizer: Use ReadBlock instead of GetPointer for SetupVertexArray. 2018-03-26 21:17:02 -04:00
bunnei a6cab532f8 gl_rasterizer: Normalize vertex array data as appropriate. 2018-03-26 21:17:02 -04:00
bunnei 527ce12ce4 maxwel_to_gl: Fix string formatting in log statements. 2018-03-26 21:17:01 -04:00
bunnei d89bfec5f5 rasterizer: Rename DrawTriangles to DrawArrays. 2018-03-26 21:17:00 -04:00
bunnei 1bfc0dc2db gl_rasterizer: Use passthrough shader for SetupVertexShader. 2018-03-26 21:17:00 -04:00
bunnei 0a5832798a renderer_opengl: Logging, etc. cleanup. 2018-03-26 21:16:59 -04:00
bunnei 7504df52fc renderer_opengl: Remove framebuffer RasterizerFlushVirtualRegion hack. 2018-03-26 21:16:58 -04:00
bunnei c1ccbf332f gl_rasterizer_cache: Implement UpdatePagesCachedCount. 2018-03-26 21:16:58 -04:00
bunnei c2dbdefedf gl_rasterizer: Implement SetupVertexArray. 2018-03-26 21:16:56 -04:00
bunnei cd8bb6ea9b gl_rasterizer_cache: Fix an ASSERT_MSG. 2018-03-26 21:16:56 -04:00
bunnei 4369af6b7e maxwell_to_gl: Add module and function for decoding VertexType. 2018-03-26 21:16:55 -04:00
bunnei 3754e0fdfd maxwell_3d: Use names that match envytools for VertexType. 2018-03-26 21:16:55 -04:00
bunnei 15925b8293 maxwell_3d: Add VertexAttribute struct and cleanup. 2018-03-26 21:16:54 -04:00
bunnei 0ee38e1363 gl_rasterizer: Use 32 texture units instead of 3. 2018-03-26 21:16:53 -04:00
bunnei 0162a2d5cb gl_rasterizer: Implement DrawTriangles. 2018-03-26 21:16:53 -04:00
bunnei 33c0bf9dc5 Maxwell3D: Call AccelerateDrawBatch on DrawArrays. 2018-03-26 21:16:52 -04:00
bunnei ed2134784e gl_rasterizer: Implement AnalyzeVertexArray. 2018-03-26 21:16:52 -04:00
bunnei 8041d72a1f gl_rasterizer_cache: MortonCopy Switch-style. 2018-03-26 21:16:51 -04:00
bunnei 170ac3f9ee gl_rasterizer_cache: Implement GetFramebufferSurfaces. 2018-03-26 21:16:51 -04:00
bunnei 94c70693f9 maxwell: Add RenderTargetFormat enum. 2018-03-26 21:16:49 -04:00
bunnei 1a9df83535 renderer_opengl: Only draw the screen if a framebuffer is specified. 2018-03-26 21:16:49 -04:00
Subv 4697025b73 GPU: Load the sampler info (TSC) when retrieving active textures. 2018-03-26 15:46:49 -05:00
Subv 56e2013c1f GPU: Added the TSC structure. It contains information about the sampler. 2018-03-26 15:45:05 -05:00
Subv 6afe9e0105 GPU: Added more fields to the TIC structure. 2018-03-26 15:44:20 -05:00
Subv 0ce52b1da2 GPU: Make the debug_context variable a member of the frontend instead of a global. 2018-03-24 23:35:06 -05:00
Subv 2c785bd06c GPU: Added a function to retrieve the active textures for a shader stage.
TODO: A shader may not use all of these textures at the same time, shader analysis should be performed to determine which textures are actually sampled.
2018-03-24 11:31:53 -05:00
Subv 39e60cfeb1 Frontend: Updated the surface view debug widget to work with Maxwell surfaces. 2018-03-24 11:31:53 -05:00
Subv 1c31e2b3d2 GPU: Implement the Incoming/FinishedPrimitiveBatch debug breakpoints. 2018-03-24 11:31:50 -05:00
Subv 1ad97c75a0 GPU: Implement the MaxwellCommandLoaded/Processed debug breakpoints. 2018-03-24 11:31:50 -05:00
Subv 77fd0d47e7 Frontend: Ported the GPU breakpoints and surface viewer widgets from citra. 2018-03-24 11:31:49 -05:00
Subv 1b8d798835 GPU: Added a method to unswizzle a texture without decoding it.
Allow unswizzling of DXT1 textures.
2018-03-24 11:30:56 -05:00
Subv 71ebc3e90d GPU: Preliminary work for texture decoding. 2018-03-24 11:30:56 -05:00
Subv 9b9de30086 GPU: Added viewport registers to Maxwell3D's reg structure. 2018-03-24 01:22:19 -05:00
bunnei d561e4acc8 gl_rasterizer: Fake render in green, because it's cooler. 2018-03-23 22:27:53 -04:00
bunnei 4ed54738fc gl_rasterizer: Log warning instead of sync'ing unimplemented funcs. 2018-03-23 22:24:16 -04:00
bunnei b7da9d5a54 gl_rasterizer_cache: Add missing include for vm_manager. 2018-03-23 16:54:20 -04:00
bunnei 0f8401906b renderer_opengl: Only invalidate the framebuffer region, not flush. 2018-03-23 15:52:14 -04:00
bunnei 054393917e renderer_opengl: Fixes for properly flushing & rendering the framebuffer. 2018-03-23 15:49:04 -04:00
bunnei b36b627d4d RasterizerCacheOpenGL: FlushAll should flush full memory region. 2018-03-23 15:25:16 -04:00
bunnei 11047d7fd5 rasterizer: Flush and invalidate regions should be 64-bit. 2018-03-23 15:01:45 -04:00
bunnei cdf541fb5b renderer_opengl: Add framebuffer_transform_flags member variable. 2018-03-23 14:59:14 -04:00
bunnei ec4e1a3685 renderer_opengl: Better handling of framebuffer transform flags. 2018-03-23 14:58:27 -04:00
bunnei c2c55e0811 renderer_opengl: Use accelerated framebuffer load with LoadFBToScreenInfo. 2018-03-22 23:28:37 -04:00
bunnei a0b1235f82 gl_rasterizer: Implement AccelerateDisplay method from Citra. 2018-03-22 23:06:54 -04:00
bunnei f61b9f7338 LoadGLBuffer: Use bytes_per_pixel, not bits. 2018-03-22 23:01:57 -04:00
bunnei 6ced80bb47 gl_rasterizer_cache: LoadGLBuffer should do a morton copy. 2018-03-22 22:54:04 -04:00
bunnei 740310113b video_core: Move MortonCopyPixels128 to utils header. 2018-03-22 22:52:40 -04:00
bunnei 8a250de987 video_core: Remove usage of PAddr and replace with VAddr. 2018-03-22 21:13:46 -04:00
bunnei bfe45774f1 video_core: Move FramebufferInfo to FramebufferConfig in GPU. 2018-03-22 21:04:30 -04:00
bunnei c6362543d4 gl_rasterizer: Replace a bunch of UNIMPLEMENTED with ASSERT. 2018-03-22 20:19:34 -04:00
bunnei f707c2dac4 gl_rasterizer: Add a simple passthrough shader in lieu of shader generation. 2018-03-22 20:00:41 -04:00
bunnei 7c3a263839 gpu: Expose Maxwell3D engine. 2018-03-22 19:48:20 -04:00
bunnei 3a6604e8fa maxwell_3d: Add some format decodings and string helper functions. 2018-03-22 19:47:28 -04:00
bunnei 656de23d93 renderer: Create rasterizer and cleanup. 2018-03-22 19:46:37 -04:00
Subv c450d264eb GPU: Added vertex attribute format registers. 2018-03-21 09:26:47 -05:00
Subv ae28a52277 GPU: Added registers for the number of vertices to render. 2018-03-20 23:28:06 -05:00
bunnei 0b3ab30762
Merge pull request #254 from bunnei/port-citra-renderer
Port Citra OpenGL rasterizer code
2018-03-20 21:37:43 -04:00
bunnei 6e3222363c renderer_gl: Port boilerplate rasterizer code over from Citra. 2018-03-20 00:07:32 -04:00
bunnei 9c468e0c55 gl_shader_util: Sync latest version with Citra. 2018-03-20 00:07:31 -04:00
bunnei d7b1ebe4a8 renderer_gl: Port over gl_shader_gen module from Citra. 2018-03-20 00:07:30 -04:00
Mat M f4700ccabf
Merge pull request #253 from Subv/rt_depth
GPU: Added registers for color and Z buffers.
2018-03-19 23:37:47 -04:00
bunnei 4bdb46e4c2 renderer_gl: Port over gl_shader_decompiler module from Citra. 2018-03-19 23:14:03 -04:00
bunnei a3e10b1a72 renderer_gl: Port over gl_rasterizer_cache module from Citra. 2018-03-19 23:14:03 -04:00
bunnei db0cfb8e8b gl_resource_manager: Sync latest version with Citra. 2018-03-19 23:14:02 -04:00
bunnei 0e4b9cdde4 renderer_gl: Port over gl_stream_buffer module from Citra. 2018-03-19 23:14:02 -04:00
bunnei 6a0902e56d gl_state: Sync latest version with Citra. 2018-03-19 23:13:49 -04:00
Subv 7a27a11770 GPU: Added Z buffer registers to Maxwell3D's reg structure. 2018-03-19 16:55:33 -05:00
Subv 21d9519032 GPU: Added the render target (RT) registers to Maxwell3D's reg structure. 2018-03-19 16:46:29 -05:00
N00byKing 1d8b6ad13b Clang Fixes 2018-03-19 17:53:35 +01:00
N00byKing ef875d6a35 Clean Warnings (?) 2018-03-19 17:07:08 +01:00
Subv dcae0c9a4f GPU: Added the TSC registers to the Maxwell3D register structure. 2018-03-19 00:36:25 -05:00
Subv cff7b29bba GPU: Added the TIC registers to the Maxwell3D register structure. 2018-03-19 00:32:57 -05:00
Subv 03156d0c9a GPU: Implement macro 0xE1A BindTextureInfoBuffer in HLE.
This macro simply sets the current CB_ADDRESS to the texture buffer address for the input shader stage.
2018-03-18 19:03:40 -05:00
Subv 7b6868e908 GPU: Implement the BindStorageBuffer macro method in HLE.
This macro binds the SSBO Info Buffer as the current ConstBuffer.
This buffer is usually bound to c0 during shader execution.
Games seem to use this macro instead of directly writing the address for some reason.
2018-03-18 16:50:42 -05:00
Subv 85d820b1b4 GPU: Handle writes to the CB_DATA method.
Writing to this method will cause the written value to be stored in the currently-set ConstBuffer plus CB_POS.

This method is usually used to upload uniforms or other shader-visible data.
2018-03-18 15:23:24 -05:00
Subv a64b936cbe GPU: Move the GPU's class constructor and destructors to a cpp file.
This should reduce recompile times when editing the Maxwell3D register structure.
2018-03-18 15:23:24 -05:00
Subv aa586fa268 GPU: Store uploaded GPU macros and keep track of the number of method parameters. 2018-03-18 11:51:46 -05:00
Subv 7ac8657432 GPU: Macros are specific to the Maxwell3D engine, so handle them internally. 2018-03-18 11:51:45 -05:00
Subv ccb8da1512 GPU: Renamed ShaderType to ShaderStage as that is less confusing. 2018-03-17 18:32:57 -05:00
Subv 88698c156f GPU: Store shader constbuffer bindings in the GPU state. 2018-03-17 18:32:57 -05:00
Subv 66dae22790 GPU: Corrected some register offsets and removed superfluous macro registers. 2018-03-17 18:32:56 -05:00
Subv 1d9d9c16e8 GPU: Make the SetShader macro call do the same as the real macro's code.
It'll now set the CB_SIZE, CB_ADDRESS and CB_BIND registers when it's called.

Presumably this SetShader function is binding the constant shader uniforms to buffer 1 (c1[]).
2018-03-17 18:32:55 -05:00
Subv 579000e747 GPU: Corrected the parameter documentation for the SetShader macro call.
Register 0xE24 is actually a macro that sets some shader parameters in the register structure.

Macros are uploaded to the GPU at startup and have their own ISA, we'll probably write an interpreter for this in the future.
2018-03-17 13:55:42 -05:00
bunnei 516ef4f19f
Merge pull request #242 from Subv/set_shader
GPU: Handle the SetShader method call (0xE24) and store the shader config.
2018-03-17 00:34:17 -04:00
Subv f93d769a1c GPU: Handle the SetShader method call (0xE24) and store the shader config. 2018-03-16 22:51:06 -05:00
Subv d2888f7e90 GPU: Added the vertex array registers. 2018-03-16 22:47:45 -05:00
bunnei cd4e8a989c
Merge pull request #241 from Subv/gpu_method_call
GPU: Process command mode 5 (IncreaseOnce) differently from other commands
2018-03-16 22:28:22 -04:00
Subv 29feece4b8 GPU: Process command mode 5 (IncreaseOnce) differently from other commands.
Accumulate all arguments before calling the desired method.

Note: Maybe we should do the same for the NonIncreasing mode?
2018-03-16 20:32:44 -05:00
Subv bf310a41b8 GPU: Assert that we get a 0 CODE_ADDRESS register in the 3D engine.
Shader address calculation depends on this value to some extent, we do not currently know what it being 0 entails.
2018-03-16 19:24:41 -05:00
Subv cbec739e7b GPU: Added Maxwell registers for Shader Program control. 2018-03-16 19:23:11 -05:00
Subv 5fb4c718cc GPU: Intercept writes to the VERTEX_END_GL register.
This is the register that gets written after a game calls DrawArrays().

We should collect all GPU state and draw using our graphics API here.
2018-03-04 19:14:04 -05:00
Lioncash 490d0e36a0
maxwell_3d: Make constructor explicit 2018-02-13 23:47:51 -05:00
bunnei af8ae770ef
Merge pull request #187 from Subv/maxwell3d_query
GPU: Partially implemented the QUERY_* registers in the Maxwell3D engine.
2018-02-13 23:25:07 -05:00
bunnei be5ba4d952
Merge pull request #178 from Subv/command_buffers
GPU: Added a command processor to decode the GPU pushbuffers and forward the commands to their respective engines
2018-02-12 13:51:52 -05:00
Subv ac61a7d1e6 GPU: Partially implemented the QUERY_* registers in the Maxwell3D engine.
Only QueryMode::Write is supported at the moment.
2018-02-12 12:34:41 -05:00
Subv 6cddf9d88e Make a GPU class in VideoCore to contain the GPU state.
Also moved the GPU MemoryManager class to video_core since it makes more sense for it to be there.
2018-02-11 23:44:12 -05:00
Subv e01a8f2187 GPU: Added a command processor to decode the GPU pushbuffers and forward the commands to their respective engines. 2018-02-11 22:42:48 -05:00
bunnei deadcb39c2 renderer_opengl: Support framebuffer flip vertical. 2018-02-11 21:03:55 -05:00
MerryMage 738f91a57d memory: Replace all memory hooking with Special regions 2018-01-27 15:16:39 +00:00
James Rowe 096be16636 Format: Run the new clang format on everything 2018-01-20 16:45:11 -07:00
Lioncash e710a1b989 CMakeLists: Derive the source directory grouping from targets themselves
Removes the need to store to separate SRC and HEADER variables, and then
construct the target in most cases.
2018-01-17 21:51:43 -05:00
MerryMage e35644c005 clang-format 2018-01-16 18:05:21 +00:00
bunnei 92801b1c34 renderer_gl: Clear screen to black before rendering framebuffer. 2018-01-15 00:20:19 -05:00
bunnei ebd613c2cc renderer: Render previous frame when no new one is available. 2018-01-14 23:54:56 -05:00
MerryMage e86bdb1601 Fix build on macOS and linux 2018-01-13 22:38:52 +00:00
James Rowe 389979018c Remove gpu debugger and get yuzu qt to compile 2018-01-12 19:11:04 -07:00
James Rowe 1d28b2e142 Remove references to PICA and rasterizers in video_core 2018-01-12 19:11:03 -07:00
bunnei 11adef4843 renderer_opengl: Fix LOG_TRACE in LoadFBToScreenInfo. 2018-01-11 22:32:44 -05:00
bunnei ee4691297f renderer_opengl: Support rendering Switch framebuffer. 2018-01-10 23:28:59 -05:00
bunnei 236d463c52 render_base: Add a struct describing framebuffer metadata. 2018-01-10 23:28:56 -05:00
bunnei 866e66dc31 renderer_opengl: Add MortonCopyPixels function for Switch framebuffer. 2018-01-10 23:28:53 -05:00
bunnei 9e2ad45c98 renderer_opengl: Update DrawScreens for Switch. 2018-01-10 23:28:49 -05:00
bunnei 93480b10ef core/video_core: Fix a bunch of u64 -> u32 warnings. 2018-01-01 15:40:35 -05:00
bunnei 960a1416de hle: Initial implementation of NX service framework and IPC. 2017-10-14 22:18:42 -04:00
Huw Pascoe b3b34a1e76 Extracted the attribute setup and draw commands into their own functions 2017-10-04 01:08:29 +01:00
Huw Pascoe a13ab958cb Fixed type conversion ambiguity 2017-09-30 09:34:35 +01:00
Subv a321bce378 Disable unary operator- on Math::Vec2/Vec3/Vec4 for unsigned types.
It is unlikely we will ever use this without first doing a Cast to a signed type.
Fixes 9 "unary minus operator applied to unsigned type, result still unsigned" warnings on MSVC2017.3
2017-09-27 09:06:41 -05:00
B3n30 dc6a365337 Merge pull request #2951 from huwpascoe/perf-4
Optimized Morton
2017-09-25 08:28:55 +02:00
Huw Pascoe 903906da3b Optimized Float<M,E> multiplication
Before:

ucomiss xmm1, xmm1
jp      .L9
pxor    xmm2, xmm2
mov     edx, 1
ucomiss xmm0, xmm2
setp    al
cmovne  eax, edx
test    al, al
jne     .L9
.L3:
movaps  xmm0, xmm2
ret
.L9:
ucomiss xmm0, xmm0
jp      .L10
pxor    xmm2, xmm2
mov     edx, 1
ucomiss xmm1, xmm2
setp    al
cmovne  eax, edx
test    al, al
je      .L3

After:

movaps  xmm2, xmm1
mulss   xmm2, xmm0
ucomiss xmm2, xmm2
jnp     .L3
ucomiss xmm1, xmm0
jnp     .L11
.L3:
movaps  xmm0, xmm2
ret
.L11:
pxor    xmm2, xmm2
jmp     .L3
2017-09-25 00:54:02 +01:00
Huw Pascoe 876aa82c29 Optimized Morton 2017-09-24 22:27:14 +01:00
James Rowe 93930a966f Merge pull request #2921 from jroweboy/batch-fix-2
GPU: Add draw for immediate and batch modes
2017-09-24 07:57:16 -06:00
James Rowe 19d41dcc6e Remove pipeline.gpu_mode and fix minor issues 2017-09-23 09:28:20 -06:00
Yuri Kunde Schlesner a7758b0b36 Merge pull request #2928 from huwpascoe/master
Fixed framebuffer warning
2017-09-22 04:06:38 +02:00
Huw Pascoe a234e4c200 Improved performance of FromAttributeBuffer
Ternary operator is optimized by the compiler
whereas std::min() is meant to return a value.

I've noticed a 5%-10% emulation speed increase.
2017-09-17 15:56:36 +01:00
Huw Pascoe 6a110ac5f5 Fixed framebuffer warning 2017-09-17 11:57:06 +01:00
Yuri Kunde Schlesner 699c920991 Merge pull request #2900 from wwylele/clip-2
PICA: implement custom clip plane
2017-09-16 10:23:00 +02:00
James Rowe ad0b57f407 GPU: Add draw for immediate and batch modes
PR #1461 introduced a regression where some games would change configuration
even while in the poorly named "drawing" mode, which broke the heuristic
citra was using to determine when to draw the batch. This change adds
back in a draw call for batching, and also adds in a draw call in
immediate mode each time it adds a triangle.
2017-09-11 09:21:43 -06:00
bunnei 11baa40d75 Merge pull request #2865 from wwylele/gs++
PICA: implemented geometry shader
2017-09-07 23:02:59 -04:00
bunnei ff4941fb3a Merge pull request #2914 from wwylele/fresnel-fix
pica/lighting: only apply Fresnel factor for the last light
2017-09-05 10:00:49 -04:00
wwylele 12fbc8c8df pica/lighting: only apply Fresnel factor for the last light 2017-09-03 08:22:03 +03:00
wwylele e2c41a5891 video_core: report telemetry for gas mode 2017-08-31 12:54:17 +03:00
bunnei f0e461bf6f Merge pull request #2891 from wwylele/sw-bump
SwRasterizer/Lighting: implement bump mapping
2017-08-30 21:07:30 -04:00
Weiyi Wang 647f017c6d Merge pull request #2892 from Subv/warnings2
Warnings: Fixed a few missing-return warnings in video_core.
2017-08-28 03:21:51 -05:00
Subv da88f3b8f0 Warnings: Fixed a few missing-return warnings in video_core. 2017-08-26 11:58:22 -05:00
wwylele 417cb45e3f SwRasterizer/Clipper: flip the sign convention to match PICA and OpenGL 2017-08-25 07:26:45 +03:00
wwylele addbcd5784 gl_rasterizer: implement custom clip plane 2017-08-25 07:26:45 +03:00
wwylele ea51a3af26 SwRasterizer: implement custom clip plane 2017-08-24 15:34:27 +03:00
wwylele 17c6104d2a gl_rasterizer/lighting: more accurate CP formula 2017-08-22 09:34:44 +03:00
wwylele b5aa570354 SwRasterizer/Lighting: implement LUT input CP 2017-08-22 09:34:44 +03:00
wwylele 3e478ca131 SwRasterizer/Lighting: implement bump mapping 2017-08-22 09:34:44 +03:00
wwylele 63b6e802cd swrasterizer: remove invalid TODO
This function is called in clipping, before the pespective divide, and is not used in later rasterization. Thus it doesn't need perspective correction.
2017-08-21 08:03:07 +03:00
wwylele 72b26ac32f swrasterizer/clipper: remove tested TODO
hwtested. Current implementation is the correct behavior
2017-08-21 08:03:07 +03:00
wwylele 5a4af616c6 gl_shader_gen: simplify and clarify the depth transformation between vertex shader and fragment shader 2017-08-21 08:03:07 +03:00
wwylele 1eca380886 gl_rasterizer: add clipping plane z<=0 defined in PICA 2017-08-21 08:03:07 +03:00
Yuri Kunde Schlesner 46d1ca768d Merge pull request #2872 from wwylele/sw-geo-factor
SwRasterizer/Lighting: implement geometric factor
2017-08-20 17:49:42 -07:00
James Rowe 8afa81ac1b Merge pull request #2871 from wwylele/sw-spotlight
SwRasterizer/Lighting: implement spot light
2017-08-19 20:10:24 -06:00
wwylele 0f35755572 pica/command_processor: build geometry pipeline and run geometry shader
The geometry pipeline manages data transfer between VS, GS and primitive assembler. It has known four modes:
 - no GS mode: sends VS output directly to the primitive assembler (what citra currently does)
 - GS mode 0: sends VS output to GS input registers, and sends GS output to primitive assembler
 - GS mode 1: sends VS output to GS uniform registers, and sends GS output to primitive assembler. It also takes an index from the index buffer at the beginning of each primitive for determine the primitive size.
 - GS mode 2: similar to mode 1, but doesn't take the index and uses a fixed primitive size.
hwtest shows that immediate mode also supports GS (at least for mode 0), so the geometry pipeline gets refactored into its own class for supporting both drawing mode.
In the immediate mode, some games don't set the pipeline registers to a valid value until the first attribute input, so a geometry pipeline reset flag is set in `pipeline.vs_default_attributes_setup.index` trigger, and the actual pipeline reconfigure is triggered in the first attribute input.
In the normal drawing mode with index buffer, the vertex cache is a little bit modified to support the geometry pipeline. Instead of OutputVertex, it now holds AttributeBuffer, which is the input to the geometry pipeline. The AttributeBuffer->OutputVertex conversion is done inside the pipeline vertex handler. The actual hardware vertex cache is believed to be implemented in a similar way (because this is the only way that makes sense).
Both geometry pipeline and GS unit rely on states preservation across drawing call, so they are put into the global state. In the future, the other three vertex shader units should be also placed in the global state, and a scheduler should be implemented on top of the four units. Note that the current gs_unit already allows running VS on it in the future.
2017-08-19 10:13:20 +03:00
wwylele 8285ca4ad8 pica/shader/jit: implement SETEMIT and EMIT 2017-08-19 10:13:20 +03:00
wwylele 36981a5aa6 pica/primitive_assembly: Handle winding for GS primitive
hwtest shows that, although GS always emit a group of three vertices as one primitive, it still respects to the topology type, as if the three vertices are input into the primitive assembler independently and sequentially. It is also shown that the winding flag in SETEMIT only takes effect for Shader topology type, which is believed to be the actual difference between List and Shader (hence removed the TODO). However, only Shader topology type is observed in official games when GS is in use, so the other mode seems to be just unintended usage.
2017-08-19 10:13:20 +03:00
wwylele bb63ae3052 correct constness 2017-08-19 10:13:20 +03:00
wwylele 28128348f2 pica/shader/interpreter: implement SETEMIT and EMIT 2017-08-19 10:13:20 +03:00
wwylele 46c6973d2b pica/shader: extend UnitState for GS
Among four shader units in pica, a special unit can be configured to run both VS and GS program. GSUnitState represents this unit, which extends UnitState (which represents the other three normal units) with extra state for primitive emitting. It uses lots of raw pointers to represent internal structure in order to keep it standard layout type for JIT to access.
This unit doesn't handle triangle winding (inverting) itself; instead, it calls a WindingSetter handler. This will be explained in the following commits
2017-08-19 10:13:20 +03:00
wwylele 686fb3e78c gl_shader_gen: don't call SampleTexture when bump map is not used 2017-08-11 18:35:00 +03:00
wwylele 945f9a1b04 SwRasterizer/Lighting: implement spot light 2017-08-11 01:19:10 +03:00
wwylele 14ee32c46a SwRasterizer/Lighting: implement geometric factor 2017-08-11 01:18:43 +03:00
wwylele 5d9d42f0d0 SwRasterizer/Lighting: use make_tuple instead of constructor
implicit tuple constructor is a c++17 thing, which is not supported by some not-so-old libraries. Play safe for now
2017-08-10 12:19:58 +03:00
wwylele db309b2423 pica/regs: layout geometry shader configuration regs
All the register meanings are derived from ctrulib (3dbrew is outdated for most of them)
2017-08-10 01:53:08 +03:00
Weiyi Wang 792dee47a7 Merge pull request #2822 from wwylele/sw_lighting-2
Implement fragment lighting in the sw renderer (take 2)
2017-08-09 18:54:29 +03:00
wwylele baa24f4ea9 pica: upload shared shader code to both unit 2017-08-07 10:30:05 +03:00
wwylele 2252a63f80 SwRasterizer/Lighting: shorten file name 2017-08-03 13:51:22 +03:00
wwylele eda28266fb SwRasterizer/Lighting: move to its own file 2017-08-02 22:20:40 +03:00
wwylele 48b4105871 SwRasterizer/Lighting: reduce confusion 2017-08-02 22:07:15 +03:00
wwylele c59ed47608 SwRasterizer/Lighting: move quaternion normalization to the caller 2017-08-02 22:05:53 +03:00
wwylele c89f804a01 pica/shader_interpreter: fix off-by-one in LOOP 2017-07-27 13:48:27 +03:00
Sebastian Valle c6a2e519ef Merge pull request #2816 from wwylele/proctex-lutlutlut
gl_rasterizer: use texture buffer for proctex LUT
2017-07-22 23:03:48 -05:00
Sebastian Valle e646bd902d Merge pull request #2834 from wwylele/depth-enable-fix
gl_rasterizer_cache: fix using_depth_fb
2017-07-22 23:02:59 -05:00
bunnei df8b9863f9 telemetry: Log performance, configuration, and system data. 2017-07-17 21:32:28 -04:00
wwylele 4feff63ffa SwRasterizer/Lighting: dist atten lut input need to be clamp 2017-07-11 22:19:00 +03:00
wwylele 56e5425e59 SwRasterizer/Lighting: unify float suffix 2017-07-11 22:15:35 +03:00
wwylele e415558a4f SwRasterizer/Lighting: get rid of nested return 2017-07-11 22:15:35 +03:00
wwylele c6d1472513 SwRasterizer/Lighting: refactor GetLutValue into a function.
merging similar pattern. Also makes the code more similar to the gl one
2017-07-11 22:15:35 +03:00
wwylele f13cf506e0 SwRasterizer: only interpolate quat and view when lighting is enabled 2017-07-11 21:35:57 +03:00
wwylele efc655aec0 SwRasterizer/Lighting: pass lighting state as parameter 2017-07-11 20:06:26 +03:00
Subv 9906feefbd SwRasterizer/Lighting: Move the clamp highlight calculation to the end of the per-light loop body. 2017-07-11 19:39:15 +03:00
Subv 7526af5e52 SwRasterizer/Lighting: Move the lighting enable check outside the ComputeFragmentsColors function. 2017-07-11 19:39:15 +03:00
Subv b8229a7684 SwRasterizer/Lighting: Do not use global registers state in ComputeFragmentsColors. 2017-07-11 19:39:15 +03:00
Subv 7bc467e872 SwRasterizer/Lighting: Do not use global state in LookupLightingLut. 2017-07-11 19:39:15 +03:00
Subv 37ac2b6657 SwRasterizer/Lighting: Fixed a bug where the distance attenuation bias was being set to the dist atten scale. 2017-07-11 19:39:15 +03:00
Subv 6250f52e93 SwRasterizer: Fixed a few conversion warnings and moved per-light values into the per-light loop. 2017-07-11 19:39:15 +03:00
Subv 2d69a9b8bf SwRasterizer: Run clang-format 2017-07-11 19:39:15 +03:00
Subv 73566ff7a9 SwRasterizer: Flip the vertex quaternions before clipping (if necessary). 2017-07-11 19:39:15 +03:00
Subv 2a75837bc3 SwRasterizer: Corrected the light LUT lookups. 2017-07-11 19:39:15 +03:00
Subv f2d4d5c219 SwRasterizer: Corrected the light LUT lookups. 2017-07-11 19:39:15 +03:00
Subv 80b6fc592e SwRasterizer: Fixed the lighting lut lookup function. 2017-07-11 19:39:15 +03:00
Subv 10b0bea060 SwRasterizer: Calculate fresnel for fragment lighting. 2017-07-11 19:39:15 +03:00
Subv 46b8c8e1da SwRasterizer: Calculate specular_1 for fragment lighting. 2017-07-11 19:39:15 +03:00
Subv be25e78b07 SwRasterizer: Calculate specular_0 for fragment lighting. 2017-07-11 19:39:15 +03:00
Subv b2f472a2b1 SwRasterizer: Implement primary fragment color. 2017-07-11 19:39:15 +03:00
wwylele 8482933db8 gl_rasterizer: use texture buffer for proctex LUT 2017-07-01 11:02:48 +03:00
wwylele 8978ecb09c gl_rasterizer: use texture buffer for fog LUT 2017-06-22 20:41:00 +03:00
wwylele f1e377f57e gl_rasterizer: create the texture before applying the state
this is a rebasing error from #2792. It doesn't affect much though, because the later more Apply() call fixes/hides it
2017-06-22 17:47:46 +03:00
wwylele 457659fe01 gl_state: reset 1d textures 2017-06-21 23:13:06 +03:00
wwylele 42f7ca7412 gl_rasterizer: fix glGetUniformLocation type 2017-06-21 23:13:06 +03:00
wwylele be9e952bdc gl_rasterizer: manage texture ids in one place 2017-06-21 23:13:06 +03:00
wwylele ab60414122 gl_rasterizer/lighting: fix LUT interpolation 2017-06-21 23:13:06 +03:00
Yuri Kunde Schlesner d0888f8548 Merge pull request #2776 from wwylele/geo-factor
Fragment lighting: implement geometric factor
2017-06-18 14:18:48 -07:00
wwylele 5a454173a8 gl_rasterizer/lighting: use the formula from the paper for germetic factor 2017-06-18 10:29:02 +03:00
Yuri Kunde Schlesner f6715f98f5 Stop using reserved operator names (and/or/xor) with Xbyak
Also has the Dynarmic upgrade with the same change
2017-06-17 12:20:22 -07:00
wwylele 7052d43a67 gl_rasterizer/lighting: implement geometric factor 2017-06-15 14:59:01 +03:00
Yuri Kunde Schlesner da1bec121a Merge pull request #2762 from wwylele/light-cp-tangent
Fragment lighting: implement lut input 5 (CP) and tangent mapping
2017-06-14 20:08:26 -07:00
Yuri Kunde Schlesner 5fe5ccac42 Merge pull request #2743 from wwylele/wrap-fix
pica/rasterizer: implement/stub texture wrap mode 4-7
2017-06-13 21:28:12 -07:00
Yuri Kunde Schlesner 791cd14c8d Merge pull request #2767 from yuriks/quaternion-flip-comment
OpenGL: Update comment on AreQuaternionsOpposite with new information
2017-06-12 16:31:55 -07:00
wwylele 972548e3ee gl_rasterizer/lighting: Implement tangent mapping 2017-06-11 21:30:53 +03:00
wwylele 40b7d0bf3f gl_rasterizer/lighting: implement lut input 5 (CP) 2017-06-11 21:30:53 +03:00
Sebastian Valle 39c7c1f580 Merge pull request #2727 from wwylele/spot-light
Fragment lighting: implement spot light
2017-06-11 18:23:47 +00:00
wwylele b3b9468573 gl_rasterizer_cache: depth write is disabled if allow_depth_stencil_write is false 2017-06-10 15:10:34 +03:00
Yuri Kunde Schlesner ba01a8302a OpenGL: Update comment on AreQuaternionsOpposite with new information
While debugging the software renderer implementation, it was noticed
that this is actually exactly what the hardware does, upgrading the
status of this "hack" to being a proper implementation. And there was
much rejoicing.
2017-06-10 01:55:17 -07:00
wwylele 28d1e73d2f pica/rasterizer: implement/stub texture wrap mode 4-7 2017-06-04 09:47:25 +03:00
bunnei 54ea95cca7 Merge pull request #2721 from wwylele/texture-cube
swrasterizer: implemented TextureCube
2017-05-30 10:21:05 -04:00
wwylele 10906dceec gl_rasterizer: implement spot light 2017-05-30 10:54:58 +03:00
wwylele 686cbf3ac6 gl_rasterizer: sync spot light status 2017-05-30 10:54:58 +03:00
wwylele b5addf8fb8 pica: prepare registers for spotlight 2017-05-30 10:54:58 +03:00
Yuri Kunde Schlesner a4f88c7d7c Merge pull request #2734 from yuriks/cmake-imported-libs
CMake: Use CMake target properties for all libraries
2017-05-29 15:12:21 -07:00
wwylele 0b9bb082c3 swrasterizer: implement TextureCube 2017-05-29 22:28:48 +03:00
wwylele 077cc683e5 pica: add registers for texture cube 2017-05-29 22:03:08 +03:00
Yuri Kunde Schlesner 3df85a103a Merge pull request #2729 from yuriks/quaternion-fix
OpenGL: Improve accuracy of quaternion interpolation
2017-05-28 01:24:06 -07:00
Yuri Kunde Schlesner d736cca848 CMake: Create INTERFACE targets for microprofile and nihstro 2017-05-27 22:34:52 -07:00
Yuri Kunde Schlesner 4660bc1c78 CMake: Use IMPORTED target for libpng 2017-05-27 20:44:51 -07:00
Yuri Kunde Schlesner 7b81903756 CMake: Correct inter-module dependencies and library visibility
Modules didn't correctly define their dependencies before, which relied
on the frontends implicitly including every module for linking to
succeed.

Also changed every target_link_libraries call to specify visibility of
dependencies to avoid leaking definitions to dependents when not
necessary.
2017-05-27 18:41:24 -07:00
Yuri Kunde Schlesner eb10f25025 Move screen size constants from video_core to core
video_core didn't even properly use them, and they were the source of
many otherwise-unnecessary dependencies from core to video_core.
2017-05-27 18:41:24 -07:00
Yuri Kunde Schlesner 6665557ff7 OpenGL: Remove unused RendererOpenGL fields 2017-05-27 18:02:46 -07:00
Yuri Kunde Schlesner 669ef82aee OpenGL: Improve accuracy of quaternion interpolation
Current order of operations (rotate then normalize) seems to produce a
lot more distortion than normalizing and then rotating. This makes Citra
results match pretty closesly with hardware, and indicates that hardware
may also be using lerp instead of slerp to interpolate the quaternions.
2017-05-27 00:13:41 -07:00
wwylele 90c8d09098 gl_shader: refactor texture sampler into its own function 2017-05-27 01:56:22 +03:00
Yuri Kunde Schlesner bae3799bd5 Merge pull request #2697 from wwylele/proctex
Implemented Procedural Texture (Texture Unit 3)
2017-05-24 21:37:42 -07:00
wwylele 36526c63ef swrasterizer: add missing tc0_w and fragment lighting attribute processing 2017-05-21 09:09:15 +03:00
wwylele 4d62e75fb2 gl_rasterizer: implement procedural texture 2017-05-20 13:50:50 +03:00
wwylele ade45b5b99 pica/swrasterizer: implement procedural texture 2017-05-20 13:50:50 +03:00
wwylele 393fee10a2 pica: use correct register value for shader bool_uniforms
variable value is not masked. the masked and combined register value should be used instead
2017-05-17 22:14:09 +03:00
Yuri Kunde Schlesner 8d558777a6 Merge pull request #2703 from wwylele/pica-reg-revise
pica: correct bit field length for some registers
2017-05-16 10:00:37 -07:00
wwylele 86ee1f6101 pica: correct bit field length for some registers 2017-05-16 19:24:06 +03:00
Jannik Vogel ba722be2ac Pica: Write GS registers
This adds the handlers for the geometry shader register writes which will call the functions from the previous commit to update registers for the GS.
2017-05-12 16:22:37 +02:00
Jannik Vogel 3fd3775d35 Pica: Write shader registers in functions
The commit after this one adds GS register writes, so this moves the VS handlers into functions so they can be re-used and extended more easily.
2017-05-12 16:22:37 +02:00
Jannik Vogel 925724c990 Pica: Set program code / swizzle data limit to 4096
One of the later commits will enable writing to GS regs.
It turns out that on startup, most games will write 4096 GS program words.

The current limit of 1024 would hence result in 3072 (4096 - 1024) error messages:
```
HW.GPU <Error> video_core/shader/shader.cpp:WriteProgramCode:229: Invalid GS program offset 1024
```

New constants have been introduced to represent these limits.
The swizzle data size has also been raised. This matches the given field sizes of [GPUREG_SH_OPDESCS_INDEX](https://3dbrew.org/wiki/GPU/Internal_Registers#GPUREG_SH_OPDESCS_INDEX) and [GPUREG_SH_CODETRANSFER_INDEX](https://www.3dbrew.org/wiki/GPU/Internal_Registers#GPUREG_SH_CODETRANSFER_INDEX) (12 bit = [0; 4095]).
2017-05-11 15:01:27 +02:00
wwylele 039b293092 pica: shader_dirty if texture2 coord changed 2017-05-05 15:35:17 +03:00
wwylele 0f664ef89d pica: use correct coordinates for texture 2 2017-05-03 22:12:46 +03:00
bunnei ea53d6085a Merge pull request #2671 from wwylele/dot3-rgba
rasterizer: implement combiner operation 7 (Dot3_RGBA)
2017-04-21 17:03:22 -04:00
wwylele 2c2e872b31 gl_shader_gen: remove TODO about Lerp behaviour verification. The implementation is verified against hardware 2017-04-20 22:56:07 +03:00
wwylele b624a95205 rasterizer: implement combiner operation 7 (Dot3_RGBA) 2017-04-19 23:48:10 +03:00
Yuri Kunde Schlesner 52a4489d65 OpenGL: Pass Pica regs via parameter 2017-04-17 10:34:45 -07:00
Yuri Kunde Schlesner a6fd4533f6 OpenGL: Move PicaShaderConfig to gl_shader_gen.h
Also move the implementation of CurrentConfig to the cpp file.
2017-04-16 21:49:32 -07:00
Yuri Kunde Schlesner 40e28f6217 OpenGL: Move Attributes enum to a more appropriate file 2017-04-16 20:47:04 -07:00
Jannik Vogel 1b397c77fa Pica/Regs: Correct bit width for blend-equations 2017-04-08 18:33:17 +02:00
wwylele e02c4b7195 Input: remove unused stuff & clean up
1. removed zl, zr and c-stick from HID::PadState. They are handled by IR, not HID
2. removed button handling in EmuWindow
3. removed key_map
4. cleanup #include
2017-03-01 23:30:57 +02:00
Mat M 0cb52ee74a Doxygen: Amend minor issues (#2593)
Corrects a few issues with regards to Doxygen documentation, for example:

- Incorrect parameter referencing.
- Missing @param tags.
- Typos in @param tags.

and a few minor other issues.
2017-02-26 17:58:51 -08:00
Yuri Kunde Schlesner fb1979d7e2 Core: Re-write frame limiter
Now based on std::chrono, and also works in terms of emulated time
instead of frames, so we can in the future frame-limit even when the
display is disabled, etc.

The frame limiter can also be enabled along with v-sync now, which
should be useful for those with displays running at more than 60 Hz.
2017-02-26 17:22:04 -08:00
Yuri Kunde Schlesner b285c2a4ed Core: Make PerfStats internally locked
More ergonomic to use and will be required for upcoming changes.
2017-02-26 17:22:03 -08:00
Yuri Kunde Schlesner 3b4e400333 Remove built-in (non-Microprofile) profiler 2017-02-26 17:22:03 -08:00
Yuri Kunde Schlesner c75ae6c585 Add performance statistics to status bar 2017-02-26 17:22:03 -08:00
Jannik Vogel e594e63bb5 OpenGL: Check if uniform block exists before updating it (#2581) 2017-02-18 11:46:26 -08:00
Weiyi Wang e085e6a768 video_core: remove #pragma once in cpp file (#2570) 2017-02-15 00:16:50 -08:00
Yuri Kunde Schlesner 426fda1d52 SWRasterizer: Move more framebuffer functions to file 2017-02-12 18:13:04 -08:00
Yuri Kunde Schlesner 1683cb0ec9 SWRasterizer: Move texturing functions to their own file 2017-02-12 18:12:37 -08:00
Yuri Kunde Schlesner f9026e8a7a SWRasterizer: Convert large no-capture lambdas to standalone functions 2017-02-12 18:11:05 -08:00
Yuri Kunde Schlesner e1ad7d69b9 SWRasterizer: Move framebuffer operation functions to their own file 2017-02-12 18:11:03 -08:00
Yuri Kunde Schlesner e24717bca0 VideoCore: Move software rasterizer files to sub-directory 2017-02-12 18:08:11 -08:00
Yuri Kunde Schlesner e10b11a5d0 video_core/shader: Document sanitized MUL operation 2017-02-12 13:29:14 -08:00
Yuri Kunde Schlesner 443bb3d522 Merge pull request #2550 from yuriks/pica-refactor2
Small VideoCore cleanups
2017-02-12 12:33:26 -08:00
Yuri Kunde Schlesner e2fa1ca5e1 video_core: Fix benign out-of-bounds indexing of array (#2553)
The resulting pointer wasn't written to unless the index was verified as
valid, but that's still UB and triggered debug checks in MSVC.

Reported by garrettboast on IRC
2017-02-10 20:51:09 -08:00
Yuri Kunde Schlesner 553e672777 VideoCore: Split u64 Pica reg unions into 2 separate u32 unions
This eliminates UB when aliasing it with the array of u32 regs, and
is compatible with non-LE architectures.
2017-02-09 00:04:25 -08:00
Yuri Kunde Schlesner bfb1531352 VideoCore: Force enum sizes to u32 in LightingRegs
All enums that are used with BitField must have their type forced to u32
to ensure correctness.
2017-02-09 00:04:24 -08:00
Yuri Kunde Schlesner af65e1c0a0 OpenGL: Remove unused duplicate of IsPassThroughTevStage
This copy was left behind when the shader generation code was moved to a
separate file.
2017-02-09 00:04:24 -08:00
Yuri Kunde Schlesner 60fc0b086f VideoCore: Split regs.h inclusions 2017-02-09 00:04:24 -08:00
Yuri Kunde Schlesner f241bb72f5 Pica/Regs: Use binary search to look up reg names
This gets rid of the static unordered_map. Also changes the return type
const char*, avoiding unnecessary allocations (the result was only used
by calling .c_str() on it.)
2017-02-09 00:04:24 -08:00
Yuri Kunde Schlesner 602f57da38 VideoCore: Use union to index into Regs struct
Also remove some unused members.
2017-02-08 22:13:25 -08:00
Yuri Kunde Schlesner 2889372e47 Merge pull request #2482 from yuriks/pica-refactor
Split up monolithic Regs struct
2017-02-08 22:07:34 -08:00
Lectem f146a6d45a Use std::array<u8,2> instead of u8[2] to fix MSVC build 2017-02-05 14:55:51 +01:00
Yuri Kunde Schlesner 5759d94b5c VideoCore: Move Regs to its own file 2017-02-04 13:59:12 -08:00
Yuri Kunde Schlesner f7c7f422c6 VideoCore: Split shader regs from Regs struct 2017-02-04 13:59:11 -08:00
Yuri Kunde Schlesner 8fca90b5d5 VideoCore: Split geometry pipeline regs from Regs struct 2017-02-04 13:59:11 -08:00
Yuri Kunde Schlesner f443c7e5b0 VideoCore: Split lighting regs from Regs struct 2017-02-04 13:59:11 -08:00
Yuri Kunde Schlesner 23713d5dee VideoCore: Split framebuffer regs from Regs struct 2017-02-04 13:59:11 -08:00
Yuri Kunde Schlesner 9017093f58 VideoCore: Split texturing regs from Regs struct 2017-02-04 13:59:09 -08:00
Yuri Kunde Schlesner 000e78144c VideoCore: Split rasterizer regs from Regs struct 2017-02-04 13:08:47 -08:00
Yuri Kunde Schlesner 97e06b0a0d Merge pull request #2476 from yuriks/shader-refactor3
Oh No! More shader changes!
2017-02-04 13:02:48 -08:00
Yuri Kunde Schlesner c74787a11c Pica/Texture: Move part of ETC1 decoding to new file and cleanups 2017-02-04 12:33:28 -08:00
Yuri Kunde Schlesner 09a750e866 Pica/Texture: Simplify/cleanup texture tile addressing 2017-02-04 12:33:25 -08:00
Yuri Kunde Schlesner a1c9ac7845 VideoCore: Move LookupTexture out of debug_utils.h 2017-02-04 12:31:40 -08:00
wwylele 6dc1d6e568 ShaderJIT: add 16 dummy bytes at the bottom of the stack 2017-02-03 14:53:38 +02:00
Weiyi Wang 0b9c59ff22 Common/x64: remove legacy emitter and abi (#2504)
These are not used any more since we moved shader JIT to xbyak.
2017-01-31 01:06:42 -08:00
Merry f7e96dc068 shader_jit_x64_compiler: esi and edi should be persistent (#2500) 2017-01-31 00:38:31 -08:00
Yuri Kunde Schlesner 37a4ea046d VideoCore: Make PrimitiveAssembler const-correct 2017-01-29 21:31:38 -08:00
Yuri Kunde Schlesner dcdffabfe6 VideoCore: Extract swrast-specific data from OutputVertex 2017-01-29 21:31:38 -08:00
Yuri Kunde Schlesner 8ed9f9d49f VideoCore/Shader: Clean up OutputVertex::FromAttributeBuffer
This also fixes a long-standing but neverthless harmless memory
corruption bug, whech the padding of the OutputVertex struct would get
corrupted by unused attributes.
2017-01-29 21:31:38 -08:00
Yuri Kunde Schlesner 92bf5c88e6 VideoCore: Split shader output writing from semantic loading 2017-01-29 21:31:37 -08:00
Yuri Kunde Schlesner 335df895b9 VideoCore: Consistently use shader configuration to load attributes 2017-01-29 21:31:37 -08:00
Yuri Kunde Schlesner fccb28d2e9 VideoCore: Use correct register for immediate mode attribute count 2017-01-29 21:31:36 -08:00
Yuri Kunde Schlesner ab6954e942 VideoCore: Rename some types to more accurate names 2017-01-29 21:31:36 -08:00
Yuri Kunde Schlesner bbc7844021 VideoCore: Change misleading register names
A few registers had names such as "count" or "number" when they actually
contained the maximum (that is, count - 1). This can easily lead to hard
to notice off by one errors.
2017-01-29 21:31:36 -08:00
Kloen eee37b857b video_core: gl_rasterizer_cache.cpp removed unused type alias 2017-01-30 05:18:28 +01:00
Kloen 6a3a3964b0 video_core: gl_rasterizer.cpp removed unused type alias 2017-01-30 05:16:48 +01:00
Kloen 4652d70572 video_core: silence unused-local-typedef boost related warning on GCC 2017-01-29 21:24:24 +01:00
Yuri Kunde Schlesner 0e9081b973 VideoCore/Shader: Move entry_point to SetupBatch 2017-01-25 18:53:25 -08:00
Yuri Kunde Schlesner 0f64274145 VideoCore/Shader: Move per-batch ShaderEngine state into ShaderSetup 2017-01-25 18:53:25 -08:00
Yuri Kunde Schlesner 6fa3687afc Shader: Remove OutputRegisters struct 2017-01-25 18:53:25 -08:00
Yuri Kunde Schlesner 9ea5eacf91 Shader: Initialize conditional_code in interpreter
This doesn't belong in LoadInputVertex because it also happens for
non-VS invocations. Since it's not used by the JIT it seems adequate to
initialize it in the interpreter which is the only thing that cares
about them.
2017-01-25 18:53:24 -08:00
Yuri Kunde Schlesner 1a2acc3baa Shader: Don't read ShaderSetup from global state 2017-01-25 18:53:24 -08:00
Yuri Kunde Schlesner fa4ac279a7 shader_jit_x64: Don't read program from global state 2017-01-25 18:53:24 -08:00
Yuri Kunde Schlesner ade7ed7c5f VideoCore/Shader: Move ProduceDebugInfo to InterpreterEngine 2017-01-25 18:53:24 -08:00
Yuri Kunde Schlesner 114d6b2f97 VideoCore/Shader: Split interpreter and JIT into separate ShaderEngines 2017-01-25 18:53:24 -08:00
Yuri Kunde Schlesner 8eefc62833 VideoCore/Shader: Rename shader_jit_x64{ => _compiler}.{cpp,h} 2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner dd4a1672a7 VideoCore/Shader: Split shader uniform state and shader engine
Currently there's only a single dummy implementation, which will be
split in a following commit.
2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner bd82cffd0b VideoCore/Shader: Add constness to methods 2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner 1e1f939817 VideoCore/Shader: Use only entry_point as ShaderSetup param
This removes all implicit dependency of ShaderState on global PICA
state.
2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner e3caf669b0 VideoCore/Shader: Use self instead of g_state.vs in ShaderSetup 2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner 34d581f2dc VideoCore/Shader: Extract input vertex loading code into function 2017-01-25 18:53:20 -08:00
Kloen 5cc94c17f6 video_core: fix shader.cpp signed / unsigned warning 2017-01-23 16:53:31 +01:00
Kloen 753fea5d65 video_core: gl_rasterizer float to int warning 2017-01-23 16:53:30 +01:00
Kloen b6063d9a93 video_core: fix gl_rasterizer warning on MSVC 2017-01-23 16:53:30 +01:00
bunnei 22ad9094e6 config: Add option for specifying screen resolution scale factor. 2017-01-07 03:23:22 -05:00
Jonathan Hao c18cb1b192 Fix some warnings (#2399) 2017-01-04 13:48:29 -03:00
bunnei 2f746e9946 Merge pull request #2367 from JayFoxRox/lighting-lut-quickfix
Lighting LUT Quickfix
2016-12-29 13:41:51 -05:00
Jannik Vogel 6ed4206f87 Minor cleanup in GLSL code 2016-12-25 21:38:10 +01:00
Jannik Vogel 88f409aec9 Offset lighting LUT samples correctly 2016-12-25 21:37:26 +01:00
MerryMage 64f98f4d0f core: Move emu_window and key_map into core
* Removes circular dependences (common should not depend on core)
2016-12-23 13:42:39 +00:00
bunnei 29564d73bd Merge pull request #2319 from yuriks/profile-scopes
VideoCore: Make profiling scope more representative
2016-12-21 13:33:49 -05:00
Albin Bernhardsson ddec9cb369 Use GL_TRUE when setting color_mask 2016-12-19 19:06:35 +01:00
bunnei 3a1eaf2efc Merge pull request #2318 from yuriks/trace-opt
VideoCore: Inline IsPicaTracing
2016-12-18 21:15:24 -05:00
Yuri Kunde Schlesner c135317de1 VideoCore/Shader: Extract DebugData out from UnitState 2016-12-16 00:16:25 -08:00
Yuri Kunde Schlesner 6e7e767645 Remove unnecessary cast 2016-12-16 00:15:55 -08:00
Yuri Kunde Schlesner b5e3599704 VideoCore/Shader: Extract evaluate_condition lambda to function scope 2016-12-16 00:15:51 -08:00
Yuri Kunde Schlesner 960578f4e1 VideoCore/Shader: Extract call lambda up a scope and remove unused param 2016-12-15 23:08:05 -08:00
Yuri Kunde Schlesner e4e962bc7c VideoCore/Shader: Remove dynamic control flow in (Get)UniformOffset 2016-12-15 23:08:05 -08:00
Yuri Kunde Schlesner d27cb1dedc VideoCore/Shader: Move DebugData to a separate file 2016-12-15 23:08:05 -08:00
Yuri Kunde Schlesner fb9e856b91 shader_jit_x64: Use LOOPCOUNT_REG as a 64-bit reg when indexing 2016-12-15 10:02:42 -08:00
Yuri Kunde Schlesner ac9f937477 VideoCore: Make profiling scope more representative 2016-12-14 22:52:09 -08:00
Yuri Kunde Schlesner 945f554b84 VideoCore: Inline IsPicaTracing
Speeds up ALBW main menu slightly (~3%)
2016-12-14 22:06:40 -08:00
Yuri Kunde Schlesner f00ada3363 VideoCore: Eliminate an unnecessary copy in the drawcall loop 2016-12-14 21:00:29 -08:00
Yuri Kunde Schlesner 5ff3206207 shader_jit_x64: Use Reg32 for LOOP* registers, eliminating casts 2016-12-14 20:06:09 -08:00
Yuri Kunde Schlesner f4e98ecf3f VideoCore: Convert x64 shader JIT to use Xbyak for assembly 2016-12-14 20:06:08 -08:00
Lioncash 963aedd8cc Add all services to the Service namespace
Previously there was a split where some of the services were in the
Service namespace and others were not.
2016-12-11 00:07:27 +00:00
Markus Wick d0d49bb951 OpenGL: Drop framebuffer completeness check.
This OpenGL call synchronize the worker thread of the nvidia blob.
It can be verified on linux with the __GL_THREADED_OPTIMIZATIONS=1 environment variable.
Those errors should not happen on tested drivers.
It was used as a workaround for https://bugs.freedesktop.org/show_bug.cgi?id=94148
2016-12-07 22:09:13 +01:00
emmauss c4e4fa53d9 Implement Frame rate limiter (#2223)
* implement frame limiter

* fixes
2016-12-06 14:33:19 -05:00
Jannik Vogel fc4591fa49 ASSERT that shader was linked successfully 2016-12-05 21:11:24 +01:00
Jannik Vogel 4088afe23c Report shader uniform block size in case of mismatch 2016-12-05 21:11:24 +01:00
Jannik Vogel 0edc986861 Print broken shader code to log 2016-12-05 21:11:24 +01:00
Yuri Kunde Schlesner 8a1f96011d OpenGL: Non-zero stride only makes sense for linear buffers 2016-12-04 06:14:27 -08:00
Yuri Kunde Schlesner 2600633b89 OpenGL: Ensure framebuffer binding is restored if completion check fails 2016-12-04 06:14:27 -08:00
Yuri Kunde Schlesner ba7f213655 OpenGL: Fix DisplayTransfer accel when input width != output width
Fixes #2246, #2261
2016-12-04 05:21:57 -08:00
Yuri Kunde Schlesner 4f0f88bc6a Merge pull request #2259 from JayFoxRox/fix-fallback
shader_jit: Fix non-SSE4.1 path where FLR would not truncate
2016-12-03 22:11:39 -08:00
Jannik Vogel 2d8097eecc shader_jit: Fix non-SSE4.1 path where FLR would not truncate 2016-12-04 04:26:33 +01:00
Yuri Kunde Schlesner 4d5e42240c clang-format: Fix coding style 2016-12-03 01:32:46 -08:00
Jannik Vogel e2cb7d7833 shader_jit: Load LOOPCOUNT_REG and LOOPINC 4 bit left-shifted 2016-12-02 04:33:15 +01:00
Subv e3e4f27447 ClangFormat: Fixed the clang-format errors 2016-11-30 09:37:37 -05:00
Subv aea9a91100 Build: Fixed a few warnings. 2016-11-29 16:51:53 -05:00
Yuri Kunde Schlesner e279a6955e Merge pull request #2222 from linkmauve/die-frameskip-die
Remove the broken frame_skip option
2016-11-27 16:01:45 -08:00
Emmanuel Gil Peyrot 0820c99462 GPU: Remove the broken frame_skip option.
Fixes #1960.
2016-11-27 21:19:56 +00:00
Subv 4623415026 RasterizerGL: Use GL_TRUE and 0xFF in the stencil and depth masks instead of simply true and -1 2016-11-27 13:09:11 -05:00
Subv 743b0e71d9 Rasterizer/Memfill: Set the correct stencil write mask when clearing the stencil buffer. 2016-11-27 12:16:10 -05:00
jphalimi 82210ab480 Cache Vertices instead of Output registers (#2165)
This patch brings +3% performance improvement on average. It removes
ToVertex() as an important hotspot of the emulator.
2016-11-23 23:10:34 -05:00
wwylele 75affa13f7 Fix format error from #2195 2016-11-22 20:17:28 +02:00
bunnei 2de470c9b2 Merge pull request #2195 from Subv/factor_check
GPU/CiTrace: Avoid calling GetTextures() when not necessary.
2016-11-19 22:21:11 -05:00
Subv 050e9be15b GPU/CiTrace: Avoid calling GetTextures() when not necessary. 2016-11-19 19:27:00 -05:00
James Rowe f68f37b520 Merge pull request #2194 from jroweboy/extremely-minor-clangformat-change
Minor formatting change
2016-11-19 13:51:14 -07:00
James Rowe 19acec351c Minor formatting change 2016-11-19 13:35:07 -07:00
James Rowe d9305b0a07 Add default hotkey to swap primary screens.
Also minor style changes
2016-11-05 03:46:43 -06:00
James Rowe 2b1654ad9b Support additional screen layouts.
Allows users to choose a single screen layout or a large screen layout.
Adds a configuration option to change the prominent screen.
2016-11-05 02:55:41 -06:00
Ricardo de Almeida Gonzaga 13d46f6820 Fix typos 2016-10-20 12:26:59 -02:00
bunnei d989102c9c Merge pull request #2082 from yuriks/shader-interp-crash
Fix/mask crash in shader debugger in Mii Maker
2016-10-06 19:35:37 -04:00
bunnei 49b10339bf Merge pull request #2103 from wwylele/gpu-reg-cleanup
GPU: DisplayTransfer & MemoryFill cleanup and param check
2016-10-03 20:21:55 -04:00
Yuri Kunde Schlesner d9a904f9cb VideoCore: Shader interpreter cleanups 2016-09-29 21:15:49 -07:00
Yuri Kunde Schlesner 26b68313b9 VideoCore: Fix out-of-bounds read in ShaderSetup::ProduceDebugInfo
As far as I can tell, memset was replaced by a fill without correcting
the parameter type, causing an out-of-bounds array read in the Vec4
constructor.
2016-09-29 21:11:36 -07:00
Yuri Kunde Schlesner 01667d9a35 OpenGL: Take cached viewport sub-rect into account for scissor
Fixes #1938
2016-09-29 20:55:24 -07:00
wwylele d2419570b9 rasterizer: separate TextureCopy from DisplayTransfer 2016-09-29 10:01:34 +08:00
Yuri Kunde Schlesner f120e78b56 Remove special rules for Windows.h and library includes 2016-09-21 00:16:33 -07:00
Yuri Kunde Schlesner 84fbbe2629 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -07:00
Emmanuel Gil Peyrot ebdae19fd2 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
Yuri Kunde Schlesner 396a8d91a4 Manually tweak source formatting and then re-run clang-format 2016-09-18 21:14:25 -07:00
Emmanuel Gil Peyrot dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
Yuri Kunde Schlesner a3afeb4687 VideoCore: Fix dangling lambda context in shader interpreter
The static meant that after the first execution, these lambda context
would be pointing to a random location on the stack. Fixes a random
crash when using the interpreter.
2016-09-15 22:15:11 -07:00
bunnei 09063dc5bb Merge pull request #2032 from bunnei/qt-graphics
Qt graphics configure & V-Sync option
2016-08-31 22:20:54 -04:00
Jannik Vogel 7a79fa7a90 OpenGL: Avoid error on unsupported lighting LUT 2016-08-30 19:30:26 +02:00
bunnei 08ad9b36d4 config: Add a setting for graphics V-Sync. 2016-08-29 21:42:30 -04:00
Yuri Kunde Schlesner ecf6ecf325 OpenGL: Add scaled resolution support to scissor 2016-06-27 22:16:04 -07:00
Yuri Kunde Schlesner f0b9bc14b6 PICA: Scissor fixes and cleanups 2016-06-27 21:14:39 -07:00
Subv f9be06b15f PICA: Implement scissor test 2016-06-27 21:14:13 -07:00
scurest 0f9274fe24 Remove superfluous std::move in return std::move(local_var) 2016-06-25 13:26:21 -05:00
Jannik Vogel a12571c709 OpenGL: Implement fog 2016-06-07 00:06:28 +02:00
Jannik Vogel ebee2513a9 Rasterizer: Implement fog 2016-06-07 00:06:28 +02:00
Jannik Vogel 57855a1701 Pica: Add fog state 2016-06-07 00:06:28 +02:00
Jannik Vogel c900c092e3 OpenGL: Avoid undefined behaviour for UNIFORM_BLOCK_DATA_SIZE 2016-06-07 00:06:28 +02:00
mailwl 07cc781163 gsp::gpu: Reset g_thread_id in UnregisterInterruptRelayQueue 2016-06-01 09:40:15 +03:00
bunnei 552018c50a Merge pull request #1812 from JayFoxRox/refactor-shader
Retrieve shader result from new OutputRegisters-type
2016-05-31 18:12:56 -04:00
bunnei 201a7af92a Merge pull request #1846 from JayFoxRox/missing-dirty-lighting
OpenGL: Set shader_dirty on lighting changes
2016-05-26 17:35:12 -04:00
bunnei a316fbb15a Merge pull request #1733 from lioncash/vert_loader
VertexLoader: Minor changes
2016-05-23 21:13:34 -04:00
Jannik Vogel 6a28f46844 OpenGL: Set shader_dirty on lighting changes 2016-05-23 23:28:13 +02:00
Jannik Vogel 30a01584f2 Pica: Name LightSrc.config register 2016-05-23 23:28:13 +02:00
Jannik Vogel 8e905b3af6 Pica: Name lighting.config0 and .config1 registers 2016-05-23 23:28:13 +02:00
Jannik Vogel 068bd6f728 OpenGL: Use uniforms for dist_atten_bias and dist_atten_scale 2016-05-23 23:28:13 +02:00
Jannik Vogel d77279a415 Refactor Tev stage dumper 2016-05-21 03:11:27 +02:00
Jannik Vogel 324c21c922 Extend Tev stage dumper 2016-05-21 03:08:59 +02:00
bunnei e5599ed300 Merge pull request #1786 from JayFoxRox/blend-equation
OpenGL: Support blend equation
2016-05-16 20:00:21 -04:00
Jannik Vogel ff0fa86b17 Retrieve shader result from new OutputRegisters-type 2016-05-16 18:55:51 +02:00
linkmauve f40fabd688 Merge pull request #1787 from JayFoxRox/refactor-jit
Refactor JIT
2016-05-16 17:54:45 +01:00
Jannik Vogel 5389dedfa1 OpenGL: Only update depth uniforms if the depth changed 2016-05-14 10:31:18 +02:00
Jannik Vogel f8a11a664f OpenGL: value-initialize variables which cause uninitialised access otherwise 2016-05-14 10:16:11 +02:00
Jannik Vogel 1308afe2c2 Use new shader-jit signature for interpreter 2016-05-13 09:41:55 +02:00
Jannik Vogel 4e01e9ffc5 Refactor access to state in shader-jit 2016-05-13 09:20:14 +02:00
Jannik Vogel 5864cb7e00 OpenGL: Support blend equation 2016-05-12 22:57:40 +02:00
Jannik Vogel 7e756faaba Move program_counter and call_stack from UnitState to interpreter 2016-05-12 19:05:42 +02:00
Jannik Vogel 6c6d99ca51 Move default_attributes into Pica state 2016-05-12 19:05:41 +02:00
bunnei f6eb62d062 Merge pull request #1690 from JayFoxRox/tex-type-3
Pica: Implement texture type 3 (Projection2D)
2016-05-11 21:47:08 -04:00
Jannik Vogel ae7a82fa1c Turn ShaderSetup into struct 2016-05-11 23:48:24 +02:00
Jannik Vogel 5a7306d6df OpenGL: Implement texture type 3 2016-05-11 08:07:37 +02:00
Jannik Vogel 4311297eb1 Rasterizer: Implement texture type 3 2016-05-11 08:07:36 +02:00
Jannik Vogel 2f8e8e1455 Pica: Add tc0.w to OutputVertex 2016-05-11 08:07:36 +02:00
Jannik Vogel 9cfebb9334 Pica: Add texture type to state 2016-05-11 08:07:36 +02:00
bunnei 86ecbdfa4d Merge pull request #1621 from JayFoxRox/w-buffer
Implement W-buffer and fix depth-mapping
2016-05-10 23:00:40 -04:00
Lioncash 75e5d0a6a0 gl_rasterizer: Fix compilation for debug builds 2016-05-10 09:22:02 -04:00
Jannik Vogel fc9cc21024 OpenGL: Implement W-Buffers and fix depth-mapping 2016-05-10 08:58:52 +02:00
Jannik Vogel 4c98113b57 Pica: Implement W-Buffer in SW rasterizer 2016-05-10 08:58:52 +02:00
linkmauve 006fe5fc0f Merge pull request #1704 from JayFoxRox/pod-config
Pica: PicaShaderConfig is TC and cleared before use
2016-05-10 01:16:53 +01:00
Lioncash 6d5f2a3cff vertex_loader: Correct forward declaration of InputVertex
It's actually a struct, not a class.
2016-05-08 23:08:18 -04:00
Lioncash 5587383eb7 vertex_loader: Provide an assertion for ensuring the loader has been setup
Also adds an assert to ensure that Setup is not called more than once
during a VertexLoader's lifetime.
2016-05-08 23:08:12 -04:00
Lioncash 1357724cd9 vertex_loader: Add constructors to facilitate immediate and two-step initialization 2016-05-08 23:03:32 -04:00
Lioncash 769f4a7018 vertex_loader: initialize_num_total_attributes.
Keeps the public API sane.
2016-05-08 23:03:32 -04:00
Lioncash 8ea5e7dfb5 vertex_loader: Use std::array instead of raw C arrays 2016-05-08 23:03:32 -04:00
Lioncash a286b61f75 vertex_loader: Correct header ordering 2016-05-08 23:01:26 -04:00
Alexander Laties 0a31e373f1 fixup simple type conversions where possible 2016-05-07 11:41:55 -04:00
Emmanuel Gil Peyrot aa4d4ff23c Frontends, VideoCore: Move glad initialisation to the frontend
On SDL2 this allows it to use SDL_GL_GetProcAddress() instead of the
default function loader, and fixes a crash when using apitrace with an
EGL context.

On Qt we will need to migrate from QGLWidget to QOpenGLWidget and
QOpenGLContext before we can use gladLoadGLLoader() instead of
gladLoadGL(), since the former doesn’t expose a function loader.
2016-05-06 03:10:14 +01:00
Jannik Vogel 7a77b8356c Pica: Rename VertexLoaded breakpoint to VertexShaderInvocation 2016-05-04 10:21:51 +02:00
Jannik Vogel f74652d2fe Pica: Use a union for PicaShaderConfig 2016-05-03 15:06:49 +02:00
Jannik Vogel 5fc8eb227a Pica: Add TevStageConfigRaw to PicaShaderConfig (MSVC workaround) 2016-05-03 15:06:46 +02:00
Jannik Vogel f3f7018c9e Pica: Make PicaShaderConfig trivially_copyable and clear it before use 2016-05-03 14:10:11 +02:00
Jannik Vogel 5ec1140f8b OpenGL: Don't copy const_color (Reverts #1745) 2016-05-03 12:34:52 +02:00
Jannik Vogel 696cb197a5 Pica: Replace logic in shader.cpp with loop 2016-05-03 01:40:47 +02:00
bunnei 15d0e98267 Merge pull request #1741 from linkmauve/iwyu-video_core
Fix video_core includes (and dependencies) using include-what-you-use
2016-05-01 17:44:57 -04:00
Jannik Vogel 7e0d6903ff OpenGL: Copy TevStageConfig using a loop. Fixes bug: const_color not copied 2016-05-01 16:35:54 +02:00
Jannik Vogel aab41604f7 OpenGL: border_color was never set. Fixed. (#1740) 2016-04-30 12:20:23 -07:00
Emmanuel Gil Peyrot 691a42fe98 VideoCore: Run include-what-you-use and fix most includes. 2016-04-30 17:02:41 +01:00
Jannik Vogel 49bfe9bf91 Remove TGA dumper 2016-04-30 09:43:59 +02:00
bunnei 90243c56fb Merge pull request #1730 from hrydgard/vertex-loader
* Remove late accesses to attribute_config

* Refactor: Extract VertexLoader from command_processor.cpp.

Preparation for a similar concept to Dolphin or PPSSPP. These can be JIT-ed and cached.

* Move "&" to their proper place, add missing includes and make some properly relative.

* Don't keep base_address in the loader, it doesn't belong there (with it, the loader can't be cached).

* Optimize the vertex loader, nearly doubling its speed.

* Debugger fix

* Move and rename the MemoryAccesses class to MemoryAccessTracker.
2016-04-29 09:42:47 -04:00
Yuri Kunde Schlesner e3a8292495 Common: Remove section measurement from profiler (#1731)
This has been entirely superseded by MicroProfile. The rest of the code
can go when a simpler frametime/FPS meter is added to the GUI.
2016-04-29 00:07:10 -07:00
Henrik Rydgard a86d7cacc1 Move and rename the MemoryAccesses class to MemoryAccessTracker. 2016-04-29 08:50:21 +02:00
Henrik Rydgard a442ee07f4 Debugger fix 2016-04-28 22:30:01 +02:00
Henrik Rydgard 251f29dd7f Optimize the vertex loader, nearly doubling its speed. 2016-04-28 22:21:39 +02:00
Henrik Rydgard 2403e86cbb Don't keep base_address in the loader, it doesn't belong there (with it, the loader can't be cached). 2016-04-28 20:17:35 +02:00
Henrik Rydgard d00e2340c6 Move "&" to their proper place, add missing includes and make some properly relative. 2016-04-28 19:40:11 +02:00
Henrik Rydgard 47ff008817 Refactor: Extract VertexLoader from command_processor.cpp.
Preparation for a similar concept to Dolphin or PPSSPP. These can be JIT-ed and cached.
2016-04-28 19:05:55 +02:00
Henrik Rydgard 0cf15f64ef Remove late accesses to attribute_config 2016-04-28 18:07:34 +02:00
bunnei 15c907317c Merge pull request #1710 from hrydgard/optimize-event-breakpoints
Replace std::map with std::array for graphics event breakpoints
2016-04-25 21:37:43 -04:00
Sam Spilsbury 656a442433 shader: Shader size is long uint, not uint. 2016-04-25 00:40:03 +08:00
Sam Spilsbury c6709d97bc shader: Handle non-CALL opcodes with a break 2016-04-25 00:39:54 +08:00
Sam Spilsbury bbffa6ad69 shader: Format string must be provided inline and not as a variable 2016-04-24 23:40:52 +08:00
Henrik Rydgard 01a1555b5d Replace std::map with std::array for graphics event breakpoints, and allow the compiler to inline. Saves 1%+ in vertex heavy situations. 2016-04-24 14:19:49 +02:00
Sam Spilsbury 39d4994c15 pica: Handle default lighting case 2016-04-23 11:54:02 +08:00
tfarley 562f36a144 HWRasterizer: reorder declarations to match defs 2016-04-22 10:52:02 -04:00
tfarley 3268cab26b HWRasterizer: sync specular uniform for new shaders 2016-04-22 10:48:00 -04:00
bunnei bab30bcd6e Merge pull request #1436 from tfarley/hw-tex-forwarding
Hardware Renderer Texture Forwarding
2016-04-22 08:15:51 -04:00
tfarley 22f3a7e94c HWRasterizer: Texture forwarding 2016-04-21 17:27:56 -04:00
tfarley e46d086189 Config: Add scaled resolution option 2016-04-21 17:27:48 -04:00
bunnei 14cc1ed911 Merge pull request #1655 from JayFoxRox/hw-dot3
OpenGL: Implement color combiner Operation::Dot3_RGB
2016-04-21 16:39:36 -04:00
bunnei 142a5dc3f5 Merge pull request #1625 from JayFoxRox/sw-blend-func
Rasterizer: Allow all blend factors for alpha blend-func
2016-04-17 20:20:15 -04:00
Jannik Vogel e2b63a2dd7 Rasterizer: Allow all blend factors for alpha blend-func 2016-04-17 22:44:24 +02:00
Lioncash 4501a9eb50 debug_utils: use std::make_unique for initializing PicaTrace 2016-04-14 22:05:28 -04:00
bunnei aff35d3e58 Merge pull request #1665 from lioncash/file
IOFile: Minor API changes
2016-04-14 16:28:15 -04:00
bunnei d7fe2784cc shader_jit_x64: Rename RuntimeAssert to Compile_Assert. 2016-04-13 23:04:53 -04:00
bunnei 3f623b2561 shader_jit_x64.cpp: Rename JitCompiler to JitShader. 2016-04-13 23:04:53 -04:00
bunnei 847fb951e2 shader_jit_x64: Free memory that's no longer needed after compilation. 2016-04-13 23:04:52 -04:00
bunnei 60aa72e117 shader_jit_x64: Use a sorted vector instead of a set for keeping track of return addresses. 2016-04-13 23:04:52 -04:00
bunnei 60749f2cda shader_jit_x64: Use CALL/RET instead of JMP for subroutines. 2016-04-13 23:04:52 -04:00
bunnei 1d45b57939 shader_jit_x64: Separate initialization and code generation for readability. 2016-04-13 23:04:50 -04:00
bunnei 6e0319eec9 shader_jit_x64: Get rid of unnecessary last_program_counter variable. 2016-04-13 23:04:49 -04:00
bunnei f3afe24594 shader_jit_x64: Execute certain asserts at runtime.
- This is because we compile the full shader code space, and therefore its common to compile malformed instructions.
2016-04-13 23:04:49 -04:00
bunnei ffcf7ecee9 shader: Remove unused 'state' argument from 'Setup' function. 2016-04-13 23:04:48 -04:00
bunnei a5a74eb121 shader_jit_x64: Specify shader main offset at runtime. 2016-04-13 23:04:47 -04:00
bunnei c9d10de644 shader_jit_x64: Allocate each program independently and persist for emu session. 2016-04-13 23:04:47 -04:00
bunnei 4632791a40 shader_jit_x64: Rewrite flow control to support arbitrary CALL and JMP instructions. 2016-04-13 23:04:44 -04:00
bunnei 135aec7bea shader_jit_x64: Fix strict memory aliasing issues. 2016-04-13 23:04:43 -04:00
Lioncash a4120ca66c file_util: Don't expose IOFile internals through the API 2016-04-13 20:17:17 -04:00
Jannik Vogel ff7c798d86 Pica: Remove geometry dumper (PICA_DUMP_GEOMETRY) 2016-04-10 22:07:06 +02:00
Jannik Vogel 0ad050f85d OpenGL: Implement color combiner Operation::Dot3_RGB 2016-04-10 15:31:24 +02:00
Jannik Vogel 35a92b4097 OpenGL: Respect buffer-write allow registers 2016-04-08 22:57:11 +02:00
Jannik Vogel c6bbc41984 OpenGL: Split buffer-write mask sync into seperate functions 2016-04-08 22:42:44 +02:00
Jannik Vogel fa24df7340 Rasterizer: Respect buffer-write allow registers 2016-04-08 22:35:22 +02:00
Jannik Vogel d47605b2ed OpenGL: Keep stencil-test and framebuffer.depth_format in sync 2016-04-08 22:35:17 +02:00
bunnei 6e750ae12d Merge pull request #1639 from linkmauve/fix-double-framebuffer-check
OpenGL: Fix a double framebuffer completeness checks.
2016-04-07 19:52:02 -04:00
Mathew Maidment aa6380e5bc Merge pull request #1643 from MerryMage/make_unique
Common: Remove Common::make_unique, use std::make_unique
2016-04-05 20:10:11 -04:00
MerryMage a06dcfeb61 Common: Remove Common::make_unique, use std::make_unique 2016-04-05 13:31:17 +01:00
Emmanuel Gil Peyrot 3219be8ee0 OpenGL: Fix a double framebuffer completeness checks. 2016-04-03 17:00:44 +01:00
Jannik Vogel 693cbc1f8f OpenGL: Check for framebuffer completeness 2016-04-03 17:06:05 +02:00
Jannik Vogel c26b141407 Avoid warnings by casting to size_t for ARRAY_SIZE() comparisons 2016-04-01 02:14:43 +02:00
Yuri Kunde Schlesner 81004211dd Pica: Improve accuracy of immediate-mode support
This partially fixes Etrian Odyssey IV.
2016-03-23 20:18:40 -07:00
Yuri Kunde Schlesner 0c447e0a06 OpenGL: Don't attempt to draw empty triangle batches
Our code did not handle this well, causing random crashes in some
situations.
2016-03-23 20:02:05 -07:00
bunnei ebbba0d381 Merge pull request #1508 from JayFoxRox/vs-output-map
Respect vs output map
2016-03-22 11:59:12 -04:00
bunnei 784c5539ea Merge pull request #1538 from lioncash/dot
shader_interpreter: use std::inner_product for the dot product
2016-03-20 00:35:06 -04:00
bunnei 58852bedbf Merge pull request #1535 from JayFoxRox/fix-align
PICA: Alignment happens locally in vertex
2016-03-17 20:00:00 -04:00
Lioncash 63e956cc7a video_core: Don't cast away const 2016-03-17 02:01:38 -04:00
Lioncash 4d89df8df2 shader_interpreter: use std::inner_product for the dot product
Same thing, less code.
2016-03-17 01:00:30 -04:00
Lioncash c928b04eee core/video_core: Make NumIds functions constexpr 2016-03-17 00:29:47 -04:00
Lioncash 39baad9926 core/video_core: Don't cast away const in subscript operators
Not to say these subscript operators aren't totally ugly as is.
2016-03-17 00:27:15 -04:00
Jannik Vogel 7eef9ebc3b PICA: Alignment happens locally in vertex 2016-03-17 02:24:20 +01:00
bunnei 55f24e1cf4 Merge pull request #1519 from JayFoxRox/vp-offset-fix
PICA: Fix viewport offset
2016-03-16 14:19:53 -04:00
bunnei 96cafbe4cc Merge pull request #1503 from bunnei/clear-jit-cache
Clear JIT cache
2016-03-16 13:18:51 -04:00
Jannik Vogel 9aad2f29bb PICA: Fix MAD/MADI encoding 2016-03-15 20:01:25 +01:00
Jannik Vogel 964cfaea47 PICA: Fix viewport offset 2016-03-14 18:37:33 +01:00
Jannik Vogel f746a00964 Respect vs output map 2016-03-14 13:03:34 +01:00
Jannik Vogel a66c186e81 PICA: Align vertex attributes 2016-03-13 04:54:23 +01:00
bunnei 6efb710b28 shader_jit_x64: Clear cache after code space fills up. 2016-03-12 12:15:49 -05:00
bunnei c103759cdc shader_jit_x64: Make assert outputs more useful & cleanup formatting. 2016-03-12 12:06:28 -05:00
bunnei 46f78b7f19 shader: Update log message to use proper log class. 2016-03-12 12:03:32 -05:00
Yuri Kunde Schlesner 305e63d9ea Merge pull request #1475 from lioncash/align
Common: Get rid of alignment macros
2016-03-09 20:08:38 -08:00
bunnei 4a2d1571bc Merge pull request #1474 from lioncash/renderer
renderer_base: Minor changes
2016-03-09 10:57:38 -05:00
Lioncash 88d604383e Common: Get rid of alignment macros
The gl rasterizer already uses alignas,
so we may as well move everything over.
2016-03-09 01:31:14 -05:00
bunnei 8530a2d7df Merge pull request #1344 from LittleWhite-tb/error-output
Output errors in GUI
2016-03-08 23:12:04 -05:00
Lioncash 4b5b32e721 renderer_base: In-class initialize variables 2016-03-08 21:46:47 -05:00
Lioncash be913040a8 render_base: Clarify/normalize getter functions 2016-03-08 21:45:24 -05:00
Lioncash bf76afc68d renderer_base: Don't directly expose the rasterizer unique_ptr
There's no reason to allow direct access to the unique_ptr instance. Only
its contained pointer.
2016-03-08 21:31:44 -05:00
LittleWhite 4be68dddfb Improve error report from Init() functions
Add error popup when citra initialization failed
2016-03-08 22:05:25 +01:00
Yuri Kunde Schlesner c58bc25d5b Pica: Write depth value even when depth test is disabled
This has been confirmed on hardware. Fixes Etrian Odyssey IV.
2016-03-05 20:16:20 -08:00
Dwayne Slater 6b775034dd Add immediate mode vertex submission 2016-03-02 22:16:38 -05:00
bunnei 2b00bdec1f Merge pull request #1424 from MerryMage/lut_init
renderer_opengl: Initalise fragment shader LUT textures
2016-02-25 19:36:27 -05:00
MerryMage 0801363840 renderer_opengl: Initalise fragment shader LUT textures 2016-02-26 00:12:38 +00:00
bunnei e04e6aabbc Merge pull request #1395 from ds84182/padding-attributes
Add support for padding vertex attributes
2016-02-24 18:15:16 -08:00
Dwayne Slater ed8072b48b Fix out of bounds array access when loading a component >= 12 2016-02-20 19:03:14 -05:00
Dwayne Slater 82fc075ff6 Add support for padding vertex attributes 2016-02-20 19:00:31 -05:00
MerryMage 6c71858c5c BitField: Make trivially copyable and remove assignment operator 2016-02-12 19:51:16 +00:00
bunnei 19557aaab3 pica: Cleanup lighting register definitions and documentation. 2016-02-05 17:20:25 -05:00
bunnei c4d318f691 gl_rasterizer: Use alignas(16) instead of explicit padding. 2016-02-05 17:20:24 -05:00
bunnei aaa7beeda8 renderer_opengl: Use GLvec3/GLvec4 aliases for commonly used types. 2016-02-05 17:20:23 -05:00
bunnei 8e9318f20a gl_rasterizer: Fix issue with interpolation of opposite quaternions. 2016-02-05 17:20:23 -05:00
bunnei b694423d09 pica_types: Fix typo in docstring. 2016-02-05 17:20:22 -05:00
bunnei a949fd5f25 pica_types: Replace float24/20/16 with a template class. 2016-02-05 17:20:22 -05:00
bunnei d171822dce command_processor: Add an assertion to ensure LUTs are not written past their boundaries. 2016-02-05 17:20:20 -05:00
bunnei 310a1c30ca gl_rasterizer: Remove unnecessary casts. 2016-02-05 17:20:19 -05:00
bunnei c229503f4a gl_rasterizer: Fix PicaShaderConfig on GCC. 2016-02-05 17:20:19 -05:00
bunnei 9dfb223d26 gl_rasterizer: Initial implementation of bump mapping. 2016-02-05 17:20:19 -05:00
bunnei 449902b558 gl_shader_gen: Fix bug in LUT range (should within range [0, 255] not [0, 256]). 2016-02-05 17:20:17 -05:00
bunnei 348c9c9ff3 gl_shader_gen: Implement lighting red, green, and blue reflection. 2016-02-05 17:20:16 -05:00
bunnei 01b407638c gl_shader_gen: View should be normalized. 2016-02-05 17:20:15 -05:00
bunnei c37de30cfc gl_shader_gen: Implement fragment lighting fresnel effect. 2016-02-05 17:20:13 -05:00
bunnei 0e67c21c9e gl_shader_gen: Implement fragment lighting specular 1 component. 2016-02-05 17:19:16 -05:00
bunnei 781b046579 gl_shader_gen: Add support for D0 LUT scaling. 2016-02-05 17:18:36 -05:00
bunnei 3d89dacd56 gl_shader_gen: Refactor lighting config to match Pica register naming.
- Also implement D0 LUT enable.
2016-02-05 17:17:35 -05:00
bunnei 6307999116 pica: Cleanup and add some comments to lighting registers. 2016-02-05 17:17:34 -05:00
bunnei 6878ba7608 gl_rasterizer: Minor naming refactor on Pica register naming. 2016-02-05 17:17:33 -05:00
bunnei 76f303538b gl_shader_gen: Reorganize and cleanup lighting code.
- No functional difference.
2016-02-05 17:17:33 -05:00
bunnei 5f3bad8fb1 gl_shader_gen: Fix directional lights. 2016-02-05 17:17:32 -05:00
bunnei bdc72d0904 gl_shader_gen: Fix bug with lighting where clamp highlights was only applied to last light. 2016-02-05 17:17:32 -05:00
bunnei 603b619cbe gl_shader_gen: View vector needs to be normalized when computing half angle vector. 2016-02-05 17:17:31 -05:00
bunnei 021cb0bced renderer_opengl: Use textures for fragment shader LUTs instead of UBOs.
- Gets us LUT interpolation for free.
- Some older Intel GPU drivers did not support the big UBOs needed to store the LUTs.
2016-02-05 17:17:31 -05:00
bunnei bf89870437 renderer_opengl: Initial implementation of basic specular lighting. 2016-02-05 17:17:30 -05:00
bunnei e34fa6365f renderer_opengl: Implement HW fragment lighting distance attenuation. 2016-02-05 17:17:30 -05:00
bunnei e9af70eaf3 renderer_opengl: Implement HW fragment lighting LUTs within our default UBO. 2016-02-05 17:17:29 -05:00
bunnei afbef52516 renderer_opengl: Implement diffuse component of HW fragment lighting. 2016-02-05 17:17:29 -05:00
bunnei b003075570 pica: Implement decoding of basic fragment lighting components.
- Diffuse
- Distance attenuation
- float16/float20 types
- Vertex Shader 'view' output
2016-02-05 17:17:28 -05:00
bunnei 281bc90ad2 pica: Implement fragment lighting LUTs. 2016-02-05 17:17:27 -05:00
bunnei 4369767c72 pica: Add decodings for distance attenuation and LUT registers. 2016-02-05 17:17:26 -05:00
bunnei 38c7b20475 pica: Add pica_types module and move float24 definition. 2016-02-05 17:17:26 -05:00
tfarley a15f4d1590 hwrasterizer: Use proper cached fb addr/size 2016-02-03 15:52:34 -05:00
Yuri Kunde Schlesner 05356543d9 OpenGL: Downgrade GL_DEBUG_SEVERITY_NOTIFICATION to Debug logging level
The nVidia driver is *extremely* spammy on this category, sending a
message on every buffer or texture upload, slowing down the emulator and
making the log useless.
2016-02-02 22:44:13 -08:00
bunnei a43f8d2fb7 Merge pull request #1367 from yuriks/jit-jmp
Shader JIT: Fix off-by-one error when compiling JMPs
2016-01-27 09:19:28 -05:00
bunnei c407b6ce2f Merge pull request #1369 from yuriks/jmpu-inverted
Shader: Implement "invert condition" feature of IFU instruction
2016-01-26 09:58:16 -05:00
Yuri Kunde Schlesner d01d1f7e01 Debugger: Use 3dbrew names for GPU registers
This list was imported from the 3dbrew wiki page and is pretty much
complete.
2016-01-24 20:29:44 -08:00
Yuri Kunde Schlesner 083d2d89a5 Shader: Implement "invert condition" feature of IFU instruction
If the bit 0 of the JMPU instruction is set, then the jump condition
will be inverted. That is, a jump will happen when the boolean is false
instead of when it is true.
2016-01-24 20:29:06 -08:00
Yuri Kunde Schlesner c1071c1ff7 Shader JIT: Fix off-by-one error when compiling JMPs
There was a mistake in the JMP code which meant that one instruction at
the destination would be skipped when the jump was taken. This commit
also changes the meaning of the culprit parameter to make it less
confusing and avoid similar mistakes in the future.
2016-01-24 02:15:56 -08:00
bunnei 0b6cc0592d Merge pull request #1334 from tfarley/hw-depth-modifiers
hwrasterizer: Use depth offset
2016-01-20 22:27:33 -05:00
tfarley f53dbafdae hwrasterizer: Use depth offset 2016-01-20 21:57:59 -05:00
Lioncash 4966568076 command_processor: Get rid of variable shadowing 2016-01-17 02:22:51 -05:00
bunnei 6a261e825c Merge pull request #1196 from linkmauve/khr_debug
Add optional GL_KHR_debug support
2016-01-12 22:54:52 -05:00
Lioncash 5e17a586da video_core: Make the renderer global a unique_ptr 2015-12-30 08:52:01 -05:00
Lioncash 97dc9634a2 swrasterizer: Add missing override specifier 2015-12-29 18:35:38 -05:00
Yuri Kunde Schlesner 015d7b9779 VideoCore: Sync state after changing rasterizers
This fixes various bugs that appear in the HW rasterizer after switching
between it and the SW one during emulation.
2015-12-20 17:37:15 -08:00
Yuri Kunde Schlesner 402692c08d Merge pull request #1267 from yuriks/flipped-framebuffer
OpenGL: Flip framebuffers during transfer rather than when rendering
2015-12-09 20:35:15 -08:00
bunnei 3013f26d70 Merge pull request #1269 from Subv/triangle_fan
GPU/PrimitiveAssembler: Fixed drawing triangle fans.
2015-12-08 10:27:40 -05:00
Yuri Kunde Schlesner 195fedccf0 VideoCore: Unify interface to OpenGL and SW rasterizers
This removes explicit checks sprinkled all over the codebase to instead
just have the SW rasterizer expose an implementation with no-ops for
most operations.
2015-12-07 20:20:38 -08:00
Yuri Kunde Schlesner 03835d04f4 VideoCore: Rename HWRasterizer methods to be less confusing 2015-12-06 19:08:37 -08:00
Yuri Kunde Schlesner da80ece8b9 OpenGL: Rename cache functions to better match what they actually do 2015-12-06 17:02:52 -08:00
Subv 7b33e163b9 GPU/PrimitiveAssembler: Fixed drawing triangle fans.
It was skipping the second vertex assignment and using uninitialized garbage when assembling the corresponding triangle.
2015-12-06 10:48:05 -05:00
Yuri Kunde Schlesner cf81e08389 OpenGL: Flip framebuffers during transfer rather than when rendering 2015-12-04 22:23:39 -08:00
Yuri Kunde Schlesner 95dbc6eb0e OpenGL: Add support for glFrontFace in the state tracker 2015-12-04 21:58:26 -08:00
Yuri Kunde Schlesner e9c209ccc8 PICA: Properly emulate 1-stage delay in the combiner buffer
This was discovered and verified by @fincs. The tev combiner buffer
actually lags behind by one stage, meaning stage 1 reads the initial
color, stage 2 reads stage 0's output, and so on.

Fixes character portraits in Fire Emblem: Awakening and world textures
in Zelda: ALBW. Closes #1140.
2015-11-30 22:45:18 -08:00
bunnei f008dfbaca renderer_opengl: Fix uniform issues introduced with kemenaran/avoid-explicit-uniform-location. 2015-11-25 22:33:24 -05:00
Pierre de La Morinerie 0735630744 Use regular uniform location
The support for GL_ARB_explicit_uniform_location is not that good
(53% according to http://feedback.wildfiregames.com/report/opengl/feature/GL_ARB_explicit_uniform_location).

This fix the shader compilation on Intel HD 4000 (#1222).
2015-11-25 11:56:11 +01:00
Subv 823ce62f2f FragShader: Use an UBO instead of several individual uniforms 2015-11-18 21:03:56 -05:00
Subv 7a37dba75b GPU/Loaders: Log an error when a loader tries to load from a component beyond the available ones (12).
Related to #1170
2015-11-09 21:16:11 -05:00
Emmanuel Gil Peyrot 53df67376d OpenGL: Log GL_KHR_debug messages we receive
This allows the driver to communicate errors, warnings and improvement
suggestions about our usage of the API.
2015-10-24 02:30:51 +01:00
bunnei 74186a5f01 gl_shader_gen: Use explicit locations for vertex shader attributes. 2015-10-21 22:29:56 -04:00
bunnei e663f5c914 gl_shader_gen: Optimize code for AppendAlphaTestCondition.
- Also add a comment to AppendColorCombiner.
2015-10-21 22:29:56 -04:00
bunnei e7b1f2ae0a gl_rasterizer: Define enum types for each vertex texcoord attribute. 2015-10-21 21:59:47 -04:00
bunnei 0ebcff710e gl_shader_gen: Various cleanups to shader generation. 2015-10-21 21:59:44 -04:00
bunnei 240a3b80d9 gl_rasterizer: Use MMH3 hash for shader cache hey.
- Includes a check to confirm no hash collisions.
2015-10-21 21:58:59 -04:00
bunnei 71edb55114 gl_shader_gen: Require explicit uniform locations.
- Fixes uniform issue on AMD.
2015-10-21 21:54:56 -04:00
bunnei 5ef2df056d gl_shader_gen: Rename 'o' to 'attr' in vertex/fragment shaders. 2015-10-21 21:53:19 -04:00
bunnei c2c4faef4c gl_shader_gen: AppendAlphaModifier default should be 0.0, not vec4(0.0). 2015-10-21 21:53:18 -04:00
bunnei bd833b8dd8 gl_shader_gen: Fix bug where TEV stage outputs should be clamped. 2015-10-21 21:53:18 -04:00
bunnei f2e7f7e101 gl_rasterizer: Add documentation to ShaderCacheKey. 2015-10-21 21:53:17 -04:00
bunnei 4b5141954e gl_shader_gen: Add additional function documentation. 2015-10-21 21:53:17 -04:00
bunnei 2a0a86f629 gl_shader_util: Cleanup header file + add docstring. 2015-10-21 21:53:16 -04:00
bunnei a74774257e gl_shader_gen: Various cleanups + moved TEV stage generation to its own function. 2015-10-21 21:53:16 -04:00
bunnei c86b9d4242 renderer_opengl: Refactor shader generation/caching to be more organized + various cleanups. 2015-10-21 21:53:14 -04:00
bunnei 3c057bd3d8 gl_rasterizer: Move logic for creating ShaderCacheKey to a static function. 2015-10-21 21:53:05 -04:00
bunnei b02a533d94 gl_shader_util: Use vec3 constants for AppendColorCombiner. 2015-10-21 21:51:24 -04:00
bunnei 37b0aa5af7 gl_rasterizer: Fix typo in uploading TEV const color uniforms. 2015-10-21 21:51:24 -04:00
bunnei 82f3e6dc69 gl_shader_util: Fix precision bug with alpha testing.
- Alpha testing is not done with float32 precision, this makes the HW renderer match the SW renderer.
2015-10-21 21:51:23 -04:00
Subv e3f4233cef Initial implementation of fragment shader generation with caching. 2015-10-21 21:51:23 -04:00
Emmanuel Gil Peyrot 14af5919ba CitraQt, SkyEye, Loader, VideoCore: Remove newlines in LOG_* calls.
The LOG_* function itself already appends one.
2015-10-09 22:14:56 +01:00
Rohit Nirmal 32391cffdd Silence -Wsign-compare warnings. 2015-10-06 22:16:15 -05:00
Martin Lindhe bafb7afba2 fix some xcode 7.0 warnings 2015-09-29 23:11:09 +02:00
Lioncash 751fbfdcc3 general: Silence some warnings when using clang 2015-09-16 08:51:53 -04:00
Lioncash aec28ed91e video_core: Reorganize headers 2015-09-11 07:31:15 -04:00
Lioncash 1fa772393b video_core: Remove unnecessary includes from headers 2015-09-11 00:10:03 -04:00
bunnei a008b28659 Merge pull request #1133 from lioncash/emplace-back
gl_rasterizer: Replace push_back calls with emplace_back in AddTriangle
2015-09-10 15:07:06 -04:00
bunnei 0d5604fdcb Merge pull request #1136 from lioncash/proto
renderer_opengl: Remove unimplemented function declaration
2015-09-10 11:29:33 -04:00
Lioncash 8a3428f16c renderer_opengl: Remove unimplemented function declaration 2015-09-10 10:45:44 -04:00
Lioncash 526eb33d1e video_core: Remove unused variables 2015-09-10 10:26:21 -04:00
Lioncash 7b72b71605 gl_rasterizer: Replace push_back calls with emplace_back in AddTriangle 2015-09-10 00:20:30 -04:00
aroulin 1484a23530 Shader JIT: Use SCALE constant from emitter 2015-09-07 16:50:28 +02:00
aroulin 87e3b9ffc0 Shader: Fix size_t to int casts of register offsets 2015-09-07 16:50:28 +02:00
Yuri Kunde Schlesner b044c047c4 OpenGL: Use Sampler Objects to decouple sampler config from textures
Fixes #978
2015-09-03 15:09:51 -03:00
Yuri Kunde Schlesner 466e608c19 OpenGL: Remove ugly and endian-unsafe color pointer casts 2015-09-03 15:09:51 -03:00
Yuri Kunde Schlesner ec28f037e6 OpenGL: Add support for Sampler Objects to state tracker 2015-09-03 15:09:50 -03:00
Yuri Kunde Schlesner cc19a76656 Merge pull request #1087 from yuriks/opengl-glad
Replace the previous OpenGL loader with a glad-generated 3.3 one
2015-09-03 15:07:01 -03:00
bunnei 918ca40c68 Merge pull request #1088 from aroulin/x64-emitter-abi-call
x64: Proper stack alignment in shader JIT function calls
2015-09-02 08:46:58 -04:00
aroulin ba998b85a1 video_core: Fix format specifiers warnings 2015-09-02 08:20:00 +02:00
aroulin 179ad35c2e x64: Proper stack alignment in shader JIT function calls
Import Dolphin stack handling and register saving routines
Also removes the x86 parts from abi files
2015-09-01 23:39:52 +02:00
Tony Wasserka 071510b367 Merge pull request #1092 from Subv/vertex_offset
Pica: Add the vertex_offset register to the Pica registers map.
2015-08-31 18:17:59 +02:00
Subv 58a04c0776 Pica: Added the primitive_restart register (0x25f) to the registers map. 2015-08-31 09:14:18 -05:00
Subv 149ea561a6 Pica: Add the vertex_offset register to the Pica registers map. 2015-08-31 07:02:30 -05:00
aroulin 84959be150 Shader JIT: Fix SGE/SGEI NaN behavior
SGE was incorrectly emulated w.r.t. NaN behavior as the CMPSS SSE
instruction was used with NLT
2015-08-31 08:16:15 +02:00
bunnei e77dc4e9d2 Merge pull request #1059 from Subv/vertex_offset
GPU: Implemented register 0x22A PICA_REG_DRAW_VERTEX_OFFSET
2015-08-30 17:12:33 -04:00
Subv 12a11472f1 GPU: Implemented register 0x22A.
This is the equivalent of the "first" parameter in glDrawArrays, it tells the GPU the vertex index at which to start rendering.

Register 0x22A doesn't affect indexed rendering.
2015-08-30 15:46:22 -05:00
Yuri Kunde Schlesner a1a5570e97 Replace the previous OpenGL loader with a glad-generated 3.3 one
The main advantage of switching to glad from glLoadGen is that, apart
from being actively maintained, it supports a customizable entrypoint
loader function, which makes it possible to also support OpenGL ES.
2015-08-30 08:45:56 -03:00
bunnei 58e9f78844 Merge pull request #1049 from Subv/stencil
Rasterizer: Corrected the stencil implementation.
2015-08-29 20:06:25 -04:00
Yuri Kunde Schlesner c5a4025b65 Merge pull request #1065 from yuriks/shader-fp
Shader FP compliance fixes
2015-08-27 16:34:13 -07:00
bunnei f3cef178e3 gl_rasterizer_cache: Detect and ignore unnecessary texture flushes. 2015-08-27 19:07:53 -04:00
aroulin f52d8c1a9b Shader JIT: Fix float to integer rounding in MOVA
MOVA converts new address register values from floats to integers using truncation
2015-08-27 15:26:41 +02:00
archshift dd0e1061ef Shader JIT: ifdef out reference to ifdef'd out shader_map
shader_map was only defined on x86 architectures, but was cleared on shutdown
with no ifdef protection. Ifdef this out so non-x86 architectures can be built.
2015-08-26 22:28:19 +00:00
Yuri Kunde Schlesner 0fcabd2b11 Integrate the MicroProfile profiling library
This brings goodies such as a configurable user interface and
multi-threaded timeline view.
2015-08-24 22:16:28 -03:00
bunnei afd45d1d7f Merge pull request #1063 from Subv/hw_renderer_debug_fb
HWRenderer: Only reload the framebuffer from gpu memory if the hw renderer is in use during a breakpoint
2015-08-24 13:02:44 -04:00
Subv 583d777b1a HWRenderer: Added a workaround for the Intel Windows driver bug that causes glTexSubImage2D to not change the stencil buffer.
Reported here https://communities.intel.com/message/324464
2015-08-24 11:28:28 -05:00
Yuri Kunde Schlesner eff10959de fixup! Shaders: Fix multiplications between 0.0 and inf 2015-08-24 02:10:11 -03:00
Yuri Kunde Schlesner d8ef20c856 Shader JIT: Tiny micro-optimization in DPH 2015-08-24 01:48:37 -03:00
Yuri Kunde Schlesner 630a850d4d Shaders: Fix multiplications between 0.0 and inf
The PICA200 semantics for multiplication are so that when multiplying
inf by exactly 0.0, the result is 0.0, instead of NaN, as defined by
IEEE. This is relied upon by games.

Fixes #1024 (missing OoT interface items)
2015-08-24 01:48:15 -03:00
Yuri Kunde Schlesner 082b74fa24 Shaders: Explicitly conform to PICA semantics in MAX/MIN 2015-08-24 01:46:58 -03:00
Yuri Kunde Schlesner 76247170df Shader JIT: Add name to second scratch register (XMM4) 2015-08-24 01:46:10 -03:00
Lioncash fa5076eb9b shader_jit: Replace two MDisp usages with MatR 2015-08-24 00:39:50 -04:00
Yuri Kunde Schlesner 455147ee95 Shader JIT: Fix CMP NaN behavior to match hardware 2015-08-24 01:29:40 -03:00
bunnei 83c214f6d8 Merge pull request #1062 from aroulin/shader-rcp-rsq
Shader: RCP and RSQ computes only the 1st component
2015-08-23 17:56:35 -04:00
Subv d1b9383d86 HWRenderer: Only reload the framebuffer from gpu memory if the hw renderer is in use during a breakpoint. 2015-08-23 15:26:17 -05:00
aroulin 03c5cfead4 Shader: Use std::sqrt for float instead of sqrt 2015-08-23 22:03:07 +02:00
aroulin fa552f11ef Shader: RCP and RSQ computes only the 1st component 2015-08-23 22:01:17 +02:00
aroulin 2f1514b904 Shader: implement DPH/DPHI in JIT 2015-08-22 11:09:53 +02:00
aroulin 2e7cf2f6cf Shader: implement DPH/DPHI in interpreter
Tests revealed that the component with w=1 is
SRC1 and not SRC2, it is now fixed on 3dbrew.
2015-08-22 11:09:53 +02:00
Subv 0c7da9b815 HWRasterizer: Implemented stencil ops 6 and 7. 2015-08-21 11:05:56 -05:00
Subv 7c1f84a92b SWRasterizer: Implemented stencil ops 6 and 7.
IncrementWrap and DecrementWrap, verified with hwtests.
2015-08-21 11:01:42 -05:00
Subv e43eb130d4 HWRasterizer: Implemented stencil op 1 (GL_ZERO) 2015-08-21 10:59:49 -05:00
Subv fef1462371 SWRasterizer: Implemented stencil action 1 (GL_ZERO).
Verified with hwtests.
2015-08-21 10:35:25 -05:00
Subv b3e530d005 SWRasterizer: Removed a todo. Verified with hwtests. 2015-08-21 10:09:15 -05:00
Subv 8e6336d96b SWRenderer: The stencil depth_pass action is executed even if depth testing is disabled.
The HW renderer already did this.
2015-08-21 09:48:43 -05:00
Subv e74825e3d0 Rasterizer: Abstract duplicated stencil code into a lambda. 2015-08-21 09:45:36 -05:00
Subv 46f660a789 GLRasterizer: Implemented stencil testing in the hw renderer. 2015-08-20 10:11:09 -05:00
Subv 186873420f GPU/Rasterizer: Corrected the stencil implementation.
Verified the behavior with hardware tests.
2015-08-20 10:10:35 -05:00
aroulin f3e8f42718 Shader: implement SGE, SGEI and SLT in JIT 2015-08-19 14:29:39 +02:00
aroulin 863730f6a7 Shader: implement SGE, SGEI in interpreter 2015-08-19 14:29:39 +02:00
bunnei 3c5ff418ca Merge pull request #1047 from aroulin/shader-ex2-lg2
Shader: Save caller-saved registers in JIT before a CALL
2015-08-18 22:02:25 -04:00
aroulin 2f9eb98f03 Shader: Save caller-saved registers in JIT before a CALL 2015-08-19 03:40:07 +02:00
bunnei 026379ed55 Merge pull request #1037 from aroulin/shader-ex2-lg2
Shader: Implement EX2 and LG2 in interpreter/JIT
2015-08-18 19:42:32 -04:00
bunnei 1f18c9f8dd Merge pull request #1034 from yuriks/rg8-textures
videocore: Added RG8 texture support
2015-08-16 22:17:12 -04:00
aroulin 7d3a6016d6 Shader: implement EX2 and LG2 in JIT 2015-08-17 01:12:34 +02:00
LittleWhite 9d6748fa94 Fix Linux GCC 4.9 build (complaining about undeclared memset) 2015-08-16 17:21:08 +02:00
aroulin 638e47c04d Shader: implement EX2 and LG2 in interpreter 2015-08-16 15:54:30 +02:00
Tony Wasserka 96820ae42a Build fix for Debug configurations. 2015-08-16 15:14:54 +02:00
Tony Wasserka f5144e6c10 Merge pull request #997 from Lectem/cmdlist_full_debug
citra-qt: Improve pica command list widget (add mask, fix some issues)
2015-08-16 13:34:45 +02:00
Tony Wasserka 33ba604fd9 Introduce a shader tracer to allow inspection of input/output values for each processed instruction. 2015-08-16 14:12:11 +02:00
Tony Wasserka 2e3601f415 Pica/DebugUtils: Include uniform information into shader dumps. 2015-08-16 13:22:01 +02:00
Tony Wasserka 4cb302c8ae citra-qt: Improve shader debugger.
Now supports dumping the current shader and recognizes a larger number of output semantics.
2015-08-16 13:22:00 +02:00
Patrick Martin 5b65d95310 videocore: Added RG8 texture support 2015-08-16 02:21:50 -03:00
bunnei db97090cad Shader: Use a POD struct for registers. 2015-08-15 18:03:27 -04:00
bunnei b39c053785 Rename ARCHITECTURE_X64 definition to ARCHITECTURE_x86_64. 2015-08-15 18:03:27 -04:00
bunnei 0ee00861f6 Common: Cleanup CPU capability detection code. 2015-08-15 18:03:26 -04:00
bunnei a1942238f5 Common: Move cpu_detect to x64 directory. 2015-08-15 18:03:26 -04:00
bunnei bd7e691f78 x64: Refactor to remove fake interfaces and general cleanups. 2015-08-15 18:03:25 -04:00
bunnei cfb354f11f JIT: Support negative address offsets. 2015-08-15 18:01:22 -04:00
bunnei 094ae6fadb Shader: Initial implementation of x86_x64 JIT compiler for Pica vertex shaders.
- Config: Add an option for selecting to use shader JIT or interpreter.
- Qt: Add a menu option for enabling/disabling the shader JIT.
2015-08-15 18:01:07 -04:00
bunnei d67e2f78b7 Common: Added MurmurHash3 hash function for general-purpose use. 2015-08-15 17:33:46 -04:00
bunnei 3f69c2039d Shader: Define a common interface for running vertex shader programs. 2015-08-15 17:33:44 -04:00
bunnei 18527b9e21 Shader: Move shader code to its own subdirectory, "shader". 2015-08-15 17:33:42 -04:00
bunnei 642b9b5030 GPU: Refactor "VertexShader" namespace to "Shader".
- Also renames "vertex_shader.*" to "shader_interpreter.*"
2015-08-15 17:33:41 -04:00
bunnei 35f3360663 Merge pull request #893 from linkmauve/remove-uint._t-int._t
Replace standard uint*_t and int*_t with CommonTypes’ u* and s* types
2015-08-11 17:55:24 -04:00
Emmanuel Gil Peyrot 5115d0177e ARM Core, Video Core, CitraQt, Citrace: Use CommonTypes types instead of the standard u?int*_t types. 2015-08-11 22:38:44 +01:00
Yuri Kunde Schlesner 254582aa35 OpenGL: Fix state tracking in situations with reused object handles
If an OpenGL object is created, bound to a binding using the state
tracker, and then destroyed, a newly created object can be assigned the
same numeric handle by OpenGL. However, even though it is a new object,
and thus needs to be bound to the binding again, the state tracker
compared the current and previous handles and concluded that no change
needed to be made, leading to failure to bind objects in certain cases.

This manifested as broken text in VVVVVV, which this commit fixes along
with similar texturing problems in other games.
2015-08-06 00:59:37 -03:00
Yuri Kunde Schlesner ff68db61bc OpenGL: Remove redundant texture.enable_2d field from OpenGLState
All uses of this field where it's false can just set the texture id to 0
instead.
2015-08-05 22:55:22 -03:00
Yuri Kunde Schlesner a96502edd3 Videocore: Implement simple vertex caching
This gives a ~2/3 reduction in the amount of vertices that need to be
processed through the vertex loaders and the vertex shader, yielding a
good speedup.
2015-08-04 23:41:47 -03:00