Commit Graph

1181 Commits

Author SHA1 Message Date
baldurk 07d65b8f9a Don't fetch/serialise/apply render state if no context is bound.
* Note that we serialise out the new render state any time we reach a
  MakeCurrent call, so we can safely 'skip' the initial render state
  at the start of a frame.
2015-02-24 23:01:17 +00:00
baldurk 8f10523b7e If program with initial contents doesn't link, try again as separable
* We can't just link ALL programs as separable to be safe, since this
  hits the same problem of some shaders not being valid as separable :(.
* This should fix the case where a separable program with initial state
  was failing to link before, without breaking non-separable programs.
2015-02-24 22:59:54 +00:00
baldurk c57c6b4bf8 Handle texture not being bound where expected, set default/empty state 2015-02-24 22:58:44 +00:00
baldurk 49a66defb0 When making a program separable, insert block after #extension lines 2015-02-24 22:58:30 +00:00
baldurk 06d14967ab Intercept queries to glGetBufferPointer that return the map pointer 2015-02-24 14:34:42 +00:00
baldurk 0dbc63fdb1 Persistent Map()s part 5 - add coherent map implicit barrier points
* These are placed a little conservatively to be sure we pick up changes
* They're placed on any drawcall, any buffer copy operation, any texture
  data operation that can source from a buffer via pixel unpack buffers,
  any texture copy or read (like framebuffer blits) since the buffer
  could be a texture buffer. Also on any function that returns the
  contents of a texture or buffer.
2015-02-24 14:34:41 +00:00
baldurk 01464a20f7 Persistent Map()s part 4 - implement persistent map interception
* Should support coherent & non-coherent persistent maps (coherent
  coming with a fair performance hit).
* Slightly changed the method from the one planned - coherent maps don't
  need to actually be mapped coherently. Since we're inserting a manual
  sync & copy point all over the place, we can map the underlying GL
  buffer as non-coherent and flush explicit, then just do the flushes
  when we do the copies.
* Still need to add all those implicit sync point calls, and I'm sure
  there are plenty of bugs in this implementation.
2015-02-24 13:56:01 +00:00
baldurk cc9c93db36 Persistent Map()s part 3 - Minor tidy up and document how Map code works
* The documentation also describes how persistent maps will be handled
  in the code to follow.
* There are a couple of edge-case bugfixes here that turned up as I was
  writing up how everything should work:
  - a high traffic resource wasn't being marked as dirty, which probably
    wouldn't ever break as if we ever acted on it being high traffic, we
    would mark it dirty, but better to be explicit.
  - fetching initial shadow storage contents in capframe, we need to
    fill the whole buffer, not just the mapped region.
  - if a flush explicit map were non-invalidating, it could be
    intercepted even while idle, but then the flush calls would have
    been discarded and never gone anywhere while idle. Instead we just
    explicitly don't intercept flush explicit maps except while
    capturing
2015-02-24 13:55:58 +00:00
baldurk 75b782d547 Persistent Map()s part 2 - Simplify Map() paths
* glMapBuffer can just be expressed in terms of glMapBufferRange, this
  simplifies the flow a bit.
* We can also romeve a couple of map statuses, as they're no longer
  used.
* Also, buffer creation chunks must go into the resource record, not the
  context record, in case a buffer is created in the frame that's
  captured.
2015-02-23 17:03:40 +00:00
baldurk d205572b9c Persistent Map()s part 1 - remove case handling where DataPtr == NULL
* This should be impossible, as Map() is only valid after glBufferData
  or glBufferStorage, and both of those will unconditionally set a data
  pointer to backing store.
2015-02-23 12:36:03 +00:00
baldurk da3ea0931b In glGen functions do an initial bind-to-create
* This was always a problem, but may have been hidden in some cases by
  lack of DSA type use causing a late bind-to-create. e.g. in a VAO we
  might have been binding an element array buffer that caused a bind-to-
  create on the VAO. Now we do it in the glGen functions to ensure the
  objects are fully initialised.
2015-02-22 23:36:34 +00:00
baldurk 1afbb0bfaa ARB_dsa part 2 - Implement glCreate* functions
* For the most part these are identical to the equivalent glGen*.
* For textures, we bake in the current type immediately, for buffers we
  would ideally want a type but the glCreateBuffers doesn't take one (it
  then gets renamed/retyped).
2015-02-22 23:36:34 +00:00
baldurk 33deeb8618 ARB_dsa part 2 - Implement Texture* family of functions
* Since this would be another duplicated set of code, move the variants
  into common functions - each of the variants (ARB_dsa, EXT_dsa,
  non-DSA and possibly MultiTex) calls into a common function just with
  a different resource record.
* Handling the ARB/EXT dsa differences on the texture calls, the target
  parameter is set to GL_NONE for the ARB dsa calls (which lack a target
  parameter). Then in the serialise replay part, if the target is
  GL_NONE we use the ARB variant and otherwise use the EXT variant.
  See the comments at the top of gl_texture_funcs.cpp
* For functions with common code that needs to happen on replay, we pass
  the resource's ID instead of its record, to be compatible with replay
  where there are no records. To save time & unnecessary queries, also
  force all internal texture creates on replay to happen through the
  DSA interfaces so we don't have to go looking up the texture via
  selectors.
2015-02-22 23:36:33 +00:00
baldurk c9c52537f1 ARB_dsa part 1 - hook DSA functions, implement all but tex* & create*
* Doesn't compile yet! Just splitting this up logically so the change is
  a bit easier to digest.
* I've commented and organised a bit better the gl_hookset.h hook list.
* The function hooks are set up for all of the ARB_dsa entry points.
  Those that are semnatically identical to EXT_dsa are set up as aliases
  (with EXT_ being canonical, so we can fall back if ARB_dsa isn't
  supported - see comments in gl_hookset.h).
* Implemented the new functions except for the glTexture* family and the
  glCreate* family. No deduplication of code yet.
* As with EXT_dsa we "promote" to the DSA function for serialisation,
  but since unlike EXT_dsa we can't assume ARB_dsa is present, instead
  we emulate those functions that we might use unconditionally but may
  not be present.
2015-02-22 23:36:33 +00:00
baldurk 8b9459b841 Support shader editing for separable programs in pipelines
* We make the ReplaceResource call recursive - so if we replace a shader
  it will replace any programs that use that shader recursively and next
  iteration if we are replacing a program, we replace any pipelines that
  use it.
2015-02-21 23:41:45 +00:00
baldurk ac926b86d9 Split up RT/RW handling to be less D3D11-centric in texview thumbnails
* In D3D11 the RTs and UAVs have the same namespace, but GL has separate
  framebuffer attachments and images. This change splits up the concepts
  so the D3D11 case is a special case, in a way, and that we can handle
  any generic mix of the two nicely.
2015-02-21 22:39:36 +00:00
baldurk bf5980b6e9 Make sure glCreateShaderProgramv creates a re-linkable sep program
* We have a separable program for each shader that we can use to mess
  about with and relink for doing overlay/analysis type stuff. We need
  to make sure we create it properly and don't use re-use the separable
  program that is the 'real' version.
2015-02-21 22:04:30 +00:00
baldurk 53b24791e5 Add handling for RGBA16 backbuffers (with linear contents) 2015-02-14 21:02:16 +00:00
baldurk 80329f6e9b Channels selection and mip/slice selection are now stored per-texture
* For each texture you view, it will reset back to mip 0 and slice 0
  as it previously did, and it will also reset the channels back to
  RGB only, which is new behaviour.
* Then each texture remembers those settings, so if you choose to view
  slice 6 & alpha only of a texture any time you switch back to it
  you'll see slice 6 & alpha only.
* It can be disabled in the options, but this is the new default
  behaviour. Possibly in future the zoom level and visible range might
  be rolled into this, but for now I think they might work better as
  global state.
2015-02-14 12:19:13 +00:00
baldurk e8b2abc0a4 Remove old old disable thumbnails code 2015-02-14 12:01:26 +00:00
baldurk bf36b775b1 Make sure to pass through flush if we really mapped underlying buffer 2015-02-13 20:49:41 +00:00
baldurk 7eed980850 Speculative fix for crash upload, make sure node index is valid 2015-02-12 21:38:30 +00:00
baldurk ce20926f20 Try and be defensive about lack of index data
* ArgumentException thrown from BlockCopy seen in a crash upload, and
  it might be because of an empty or null buffer returned, maybe.
2015-02-12 21:36:46 +00:00
baldurk 3c6a1316d5 Fix using the wrong ID for replacements & removing them 2015-02-12 21:15:25 +00:00
baldurk 6a39ec4f52 Fetch texture buffer contents via GetBufferData 2015-02-12 21:15:13 +00:00
baldurk 8938c71853 Texture buffers now default to viewing in the buffer not texture viewer
* The pipeline state windows will open up the buffer viewer instead of
  the texture viewer to show the contents of texture buffers.
2015-02-12 21:15:02 +00:00
baldurk 40e06c17de Include vec3, vec4, dvec3 and dvec4 as input attributes 2015-02-12 20:55:49 +00:00
baldurk ae243b8a49 Create MS/Array copy shaders even in replay - needed for initial states
* This means these will spam errors if anyone is using a feature level
  10.x or below device without ps_5_0 support, but that's unavoidable
  and not too important (in release it'll just be some log spam).
2015-02-12 20:38:15 +00:00
baldurk 7cbb68f329 Implement quad overdraw overlays for GL
* The implementation needs the fine dFdx/dFdy variants, which are only
  available in GLSL 4.50 and above. Without that support we fall back
  to the normal dFdx/dFdy which are implementation dependent. In my
  quick test on nvidia it so happened that it was still fine, but that's
  not guaranteed.
2015-02-12 20:04:48 +00:00
baldurk a7185cbf9c Remove pipeline validation (was just for debugging) 2015-02-12 18:13:11 +00:00
baldurk 4a3217fdcc Be cheeky and pack extra overdraw levels into slight colour changes
* Since we decode the visual colours into an integer by looking them up
  in the overdraw ramp rather than re-running to get an integer return,
  we make some invisibly subtly different colours above the highest
  overdraw colour, and use these to tell overdraw levels above 20.
2015-02-12 17:02:46 +00:00
baldurk 086cc0e491 Rejig overlays to use separable programs instead of monolithic prog
* This means the overlays should now work for separable and monolithic
  program setups.
2015-02-12 16:46:09 +00:00
baldurk 3679205256 Compile fix for 64-bit 2015-02-12 09:02:02 +00:00
baldurk 6cc506f7fd Expose GetTextureData function to user code (no resolving/downcasting) 2015-02-11 15:25:44 +00:00
baldurk e048d5ba6b Implement proxy textures/buffers on GL, needed for local proxy replay 2015-02-11 15:15:01 +00:00
baldurk dad64bf6cb Implement MakeGLFormat and add a couple of details for ResourceFormats 2015-02-11 15:13:22 +00:00
baldurk be65a45f23 Fix crash on proxy serialising 2015-02-11 15:12:49 +00:00
baldurk 424f5ab964 Set texture viewer status bar to fixed width font. Partly experimental
* Since the addition of the normalised UV co-ords the status bar will
  flicker in width horrendously when scanning over a texture and it's
  impossible to track where you are. Even worse, if the text is wide
  enough (or the window narrow enough) you'll end up with the status
  bar flickering between one and two lines - which is awful.
* For now I've added some padding for numbers and set a fixed width font
  so the only varying element is the actual texel value, which is
  unavoidable in the general case. The text is probably wider overall
  so I'll need to see what feedback I get.
2015-02-10 17:37:08 +00:00
baldurk 3f5d87f290 Make generic values show up in the mesh viewer 2015-02-10 17:16:32 +00:00
baldurk 3e4aba535f Format the generic vertex attribute values correctly according to type 2015-02-10 16:59:19 +00:00
baldurk 7da38a9a8b Pass through signature parameter types properly 2015-02-10 16:49:34 +00:00
baldurk be6cbf4536 Implement editing GL shaders in-place via resource replacements 2015-02-10 16:46:33 +00:00
baldurk 54ad900f53 Set parameters for custom shaders, and update template & snippet buttons
* RENDERDOC_TextureType has different value meanings for the different
  types on GL - need to update the docs to reflect this.
2015-02-09 22:38:44 +00:00
baldurk 86d0b8a952 Implement custom display shaders for OpenGL logs, no parameters yet
* glsl and hlsl custom display shaders are kept separate, and only shown
  for the appropriate log type.
* The little snippets added in the shader editor aren't updated yet, and
  none of the pre-defined shader constants are filled out.
2015-02-09 22:19:13 +00:00
baldurk 72cfee5c0f Add GLSL syntax highlighting 2015-02-09 18:14:20 +00:00
baldurk 8ccf071865 Implement GetTextureData for GL - underlying code behind texture saving
* This should support all forms of textures off the bat, multisampled
  textures, 3D textures, arrays, compressed and uncompressed, etc.
2015-02-09 17:29:13 +00:00
baldurk bdb823c20b Slice index for 3D textures is always relative to overall depth 2015-02-09 12:32:44 +00:00
baldurk 381eb24b01 Don't set depth to 6 for cubemaps, set array size 2015-02-09 11:52:57 +00:00
baldurk f64e2ce1d1 Do a default inversion of Y co-ordinates on GL and invert w/ height-1 2015-02-09 11:50:11 +00:00
baldurk a282b68c58 Flip UV sample vertically for cubemap +ve X direction 2015-02-09 11:48:31 +00:00