1210 Commits

Author SHA1 Message Date
baldurk a440589969 Fix crash with image viewing on last change, using wrong array length v0.22 2015-02-27 14:10:49 +00:00
baldurk cca206a356 Fix array indexing crashes, ditch a lot of messing with UAV start slot
* The UAV array is provided as we expect it - with UAVs from 0 onwards
  even if their 'slots' are 4, 5, 6 etc or whatever. UAVStartSlot is
  the slot of the 0th UAV.
2015-02-27 14:07:58 +00:00
baldurk a50445781f Updated documentation to reflect latest changes and features
* Also in many places OpenGL is now advertised as full support, since it
  is pretty close by now and needs people to jump on it full-time and
  use it in anger.
2015-02-27 13:18:54 +00:00
baldurk cd35c726bc Change GL pipeline state to just name shaders "<stage> Shader <ID>"
* Since there's no better identifier, as all shaders are main() and
  there are no filenames to pick up.
2015-02-27 12:24:47 +00:00
baldurk 9e908779ce Fix lone unescaped & being interpreted as accelerator 2015-02-27 11:05:11 +00:00
baldurk 954da5c0e4 Compile fix - uninitialised variable 2015-02-27 09:18:55 +00:00
baldurk 372647709a Add EXR registry key, add images filter to file->open dialog
* I doubt anyone will notice the file->open filter unless they look for
  it so it's no good for 'discovering' the image viewing capability, but
  it might be convenient for people who know about it.
2015-02-26 18:24:49 +00:00
baldurk f8e8ae1391 Add in gl_PerVertex redeclarations individually
* This means the redeclarations are a bit more flexible if a shader
  (like a geometry shader) redeclares one already, but not the other,
  we'll only substitute in the missing one.
* Note this code is still a bit flakey e.g. in edge cases like if
  someone puts "in gl_PerVertex" in a comment, then it will fail.
  I want to avoid putting a full parser in, but perhaps stripping the
  source of any comments is a reasonable future step.
2015-02-26 17:58:41 +00:00
baldurk 43d4fff314 Fix typo when fetching shader subroutine values 2015-02-26 17:40:16 +00:00
baldurk 3904fb636d Ensure that (where available) clip control is set for overlay text 2015-02-26 17:36:04 +00:00
baldurk 12519df942 Fix crash if we insert 0 into indices list that already contains 0 2015-02-26 17:28:25 +00:00
baldurk f160c28d16 Fix GL PickPixel to be able to read back depth & stencil in two passes
* GL doesn't seem to support reading both depth and stencil channels
  from a single texture, so we need to do a second pass to read back
  the stencil component
2015-02-26 15:41:47 +00:00
baldurk 08024a375b Make missing GL functionality not breakpoint, for release 2015-02-26 15:16:11 +00:00
baldurk 1597fa3f32 If no history is returned, empty out the history event list
* Otherwise it stays as "Loading..." forever
2015-02-26 15:13:21 +00:00
baldurk c69389864e Fix buffer map diff comparison, and skip it for range maps
* For range maps, similar to glFlushMappedBufferRange, we assume the
  user selected the range deliberately and we upload it all. We only
  find a difference range for whole-buffer maps (of large enough
  buffers). This includes glMapBuffer(), by definition.
* Also, the comparison point is between the map pointer, so we have to
  offset the shadow pointer to compare it against to get accurate
  results.
2015-02-26 14:25:40 +00:00
baldurk 5892899729 For glBufferData/glBufferStorage ensure 'invalidate' data is consistent
* glBufferStorage was less of a problem as it was immutable but the data
  that got uploaded was uninitialised memory, it is now filled with 0xdd
* glBufferData could be used to invalidate a whole buffer, by passing
  NULL as data for an existing buffer. This caused a mismatch where the
  driver could (legally) have the same data, but our serialised copy
  was random uninitialised memory. The diff was done against the 'real'
  data but on serialise the base data was different, causing invalid
  data to be used.
2015-02-26 14:24:35 +00:00
baldurk 5ffb7c65a5 Hack around glCopyImageSubData being broken for compressed cubes on AMD
* Also for the hack that involves readback to CPU and reupload, make
  sure there's no pixel pack or unpack buffer bound for the duration.
2015-02-26 12:34:15 +00:00
baldurk d5b3337522 forcing all glBufferData calls into resource record isn't right
* glBufferData isn't only used for creation, it is often used to upload
  new data to a buffer, which means that during the captured frame any
  're-create' type calls should go into the context record.
2015-02-25 22:57:46 +00:00
baldurk 446d7d6da5 Take our own copy of the X connection that we are passed
* We need to copy the X display (by fetching its connection string and
  calling XOpenDisplay), so that if the Display* we had gets closed then
  nothing will crash.
2015-02-25 22:26:45 +00:00
baldurk fae5aabcce Handle missing/unsized formats on replay
* This can happen if someone binds an uncreated texture (!).
2015-02-25 22:22:32 +00:00
baldurk ae9e9e8f9f Fix highlight boxes to not have a little pixel missing in the corner
* Also in the HLSL version, we were indexing off the end of an array
  since we were drawing 5 lines but only had 4 verts in the array.
  Oops!
* We can remove D3D's OutlineStripVB, as we're doing it all in the
  shader.
2015-02-25 22:22:06 +00:00
baldurk 3a309dcd14 Fix for compile errors/warnings on linux
* The daily linux auto-compile script was broken, it's fixed now!
2015-02-25 19:02:26 +00:00
baldurk 884ee00107 Be much less forgiving about glBufferSubData calls marking high-traffic 2015-02-25 17:30:32 +00:00
baldurk debc787eb9 Check fast path for compressed pixel unpack requiring block dims
* The unpack parameters are ignored for compressed images unless the
  compressed width, height, depth and size parameters are set (whichever
  are required for the given unpack param). So we roll this into our
  calculation of the fast path, which means that we only use them in
  UnpackCompressed if they are valid.
2015-02-25 17:29:55 +00:00
baldurk 0796e5fbdf Handle cases where fragdata or attrib location idx is -1
* This can happen when we're copying from a source program to a dest
  program where the source is non-separable and had an attribute
  optimised out entirely, but the destination is separable and so still
  wants that attribute. In this case it'll come out in the wash and
  we can just skip it.
2015-02-25 17:28:06 +00:00
baldurk 75f58d19e8 Rejig initial state fetching for objects that are context-specific
* We used to switch to the context that the object was created on and
  fetch initial state there, but this isn't safe e.g. the switch
  operation could fail if the context was active on another thread.
  Instead we queue up such objects to have their data fetched the next
  time we see the context made current.
* If we never get the initial state for that object we assume that
  context is never used, so it's OK to just not have initial states -
  it's marked as invalid so we don't try to restore those states on
  replay.
* Note: this obviously falls down in the even that the context is
  already current on another thread and we just get commands from there
  without an explicit 'MakeCurrent' call. But we already don't handle
  that as we don't detect that and log the state change (or properly
  handle multithreaded commands), so it's not any worse support.
2015-02-25 16:47:50 +00:00
baldurk a0f35673bb Don't remove the MAPPED_BUFFER_BIT from glMemoryBarrier calls
* Apparently although there are no errors thrown if you pass
  GL_ALL_BARRIER_BITS (0xffffffff), if you remove a bit then an error
  will be thrown for unrecognised bits :(.
* Since it's not harmful to leave in the mapped buffer bit we just let
  it remain.
2015-02-25 14:04:23 +00:00
baldurk 8d54bbec32 Workaround for nvidia buggy implementation of glClearNamedFramebufferfi 2015-02-25 14:04:23 +00:00
baldurk cf24cb4ff5 Semi-hack, make last known context current if NULL is current on cap
* We need a context to be current when the frame capture happens so that
  we can fetch initial contents and such. This is a hack as there's no
  guarantee it's correct or will work, but we temporarily make the last
  context that was active on this thread active again, to fetch our
  data.
* This could break if that context is active elsewhere, or isn't a valid
  context (ie. maybe it was a temporary context used to fetch func
  pointers).
* A better fix would be to delay any GL work we need to do until the
  next time a good context becomes current, but that becomes dicey in
  itself.
2015-02-24 23:03:55 +00:00
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