Commit Graph
76 Commits
Author SHA1 Message Date
baldurk 607b8d48c9 Remove 'debug' serialiser that synchronously flushes out debug text 2016-02-07 18:42:15 +01:00
baldurk 2804c4414d Restore mip/level value for non-layered FBO attachments. Refs #172 2016-01-25 20:28:51 +01:00
baldurk 7edf87daf3 Don't rely on GL_TEXTURE_COMPRESSED queries, check format on our own 2015-10-09 13:11:21 +02:00
baldurk 73c1049ecf Don't apply TEXTURE_MIN/MAX_LOD state to texture rectangles 2015-09-26 23:48:13 +02:00
baldurk 822cbd879d Convert GL_CLAMP to GL_CLAMP_TO_EDGE 2015-09-16 08:37:17 +02:00
baldurk a01b3badfa Create initial state for textures/VAOs that don't have it. Refs #148 2015-09-12 18:18:45 +02:00
baldurk b9ba4099ba Rename Serialise() overload that does array to SerialisePODArray()
* To emphasise that it's serialised as a blob of memory, and that
  Serialise isn't called on each member.
* Restore the ToStr()
2015-08-31 17:39:49 +02:00
baldurk 249b79e383 Don't fetch or use FBO attach params when object is 0 2015-08-08 14:54:36 -07:00
baldurk 296d7e39b1 Handle glTextureBufferRangeEXT not being available
* This way we don't have to require GL_ARB_texture_buffer_range as well
  when technically it should only be needed if the application used it.
2015-07-23 23:06:25 +02:00
baldurk 70d98240d9 Handle initialising texture levels that might not be ready
* This could happen with a missed call to glGenerateMipmap
2015-07-18 20:18:33 +02:00
baldurk e5c1f8ee3b Make sure any time VAOs/FBOs are ref'd, we also ref the child objects
* By the logic that means we need to iterate into the VAO/FBO bound
  objects on frame start, we also need to do for bound VAOs and FBOs
  later in the frame.
* Also FBO state needs to include the actual attached objects and their
  attachment parameters, since this information is lost when we stop
  tracking FBOs.
2015-07-18 18:05:19 +02:00
baldurk e818c4e517 Don't bother with initial states for render buffers 2015-07-11 18:41:34 +02:00
baldurk d4372847f3 Better handling of emulated (luminance/alpha) textures in initial states
* To simplify things we assume there won't be any user swizzling on
  luminance or alpha textures, and just apply our own to emulate rather
  than attempting to store & stack them.
2015-06-09 22:02:05 +02:00
baldurk 9d0c7bd41a In GL don't serialise any texture initial state if storage isn't alloc'd 2015-06-09 21:43:43 +02:00
baldurk 954da5c0e4 Compile fix - uninitialised variable 2015-02-27 09:18:55 +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 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 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 d75b62c072 In case drawbuffers is set to GL_BACK, just set to COLOR_ATTACHMENT0
* This is invalid since we are talking about real FBOs, not the default
  FBO, but it might come up in compatibility context programs and it's
  harmless to correct to try and replay correctly.
2014-12-30 23:56:10 +00:00
baldurk c1727e9035 Don't initialise VAO if attribs have invalid parameters
* Technically we need to try and restore the VAOs even if disabled to the
  correct setup, so that if they're just enabled they are in the expected
  state. However if the attribs are in an invalid state it's not legal to
  just enable them again, so they need to be respecified anyway.
* This might have something to do with compatibility profiles - it was
  seen capturing Wolfenstein: The New Order, which runs 3.2 compatibility.
2014-12-30 23:49:44 +00:00
baldurk efdffaef6e Support all the crazy different pixel store unpack parameters
* If the pixel store parameters are relatively simple we go through a
  fast path that's about the same as it was before, otherwise we manually
  unpack to a tightly packed buffer for serialising. Hopefully this should
  rarely happen.
* glPixelStore parameters are only serialised when capturing a frame, and
  the pixel store parameters at frame start form part of the initial state
  vector.
2014-12-27 01:07:03 +00:00
baldurk 4647eee9f2 Handle repeated re-specifying of buffer textures by marking dirty
* Also added handling for dirty buffer textures - there are no contents to
  copy, those are handled with the buffer, so instead we just grab the few
  parameters that are valid to re-specify the buffer texture.
2014-12-26 12:25:41 +00:00
baldurk 3cec05c3d9 Support VAO 0 being used, by creating fake resource record for it
* We pick up the properties of VAO 0 on frame capture as dirty state, and
  then replay it into the fake VAO we were already creating for VAO 0.
* Eventually this record will be entirely trimmed/ignored for programs that
  don't use VAO 0 by frame references, but for now we fetch it needlessly.
  It doesn't seem to fire any errors.
2014-12-26 12:04:19 +00:00
baldurk 517e3480c4 Don't switch to GL context to fetch VAO/FBO if it's NULL!
* If the 'context shared' VAOs/FBOs hack is on, their context is set to
  NULL (so any context will match the resource), but this also means we
  shouldn't try and bind that context to fetch data.
2014-12-23 00:00:24 +00:00
baldurk dc8e865301 Track and restore per-texture seamless cubemap state
* This is for the ARB_seamless_cubemap_per_texture extension. We already
  track the global state that isn't specific to a texture.
2014-12-20 19:54:47 +00:00
baldurk b1150987a4 Just warn for programs found that have no shaders attached
* Seen in Clockwork Empires, eventually this won't be a problem as the
  programs will get trimmed via not being referenced in the captured frame
2014-12-17 20:57:49 +00:00
baldurk 7c663de948 Add vendor check to avoid glCopyImageSubData on <4x4 compressed mips 2014-12-14 12:17:41 +00:00
baldurk 86c110184a Only query depth stencil texture mode for depth-stencil textures 2014-12-14 12:17:39 +00:00
baldurk 35a13fe160 Make sure all arrays preserve 'depth' when calculating mip dims 2014-12-13 21:15:42 +00:00
baldurk 15e7764b89 Ignore lack of initial state for VAOs 2014-12-11 23:18:32 +00:00
baldurk 9be802082f Add a vendor check to detect if FBOs or VAOs are actually shared
* This lets us detect if the FBO/VAO behaviour is different from the main
  spec, and so we won't miss deletes or other events if the context is
  different since we'll treat them as shared like any other object.
2014-12-11 20:30:34 +00:00
baldurk 723faec986 Cubemap array 'depth' is the same for all mips, it's the array size 2014-12-07 15:24:50 +00:00
baldurk 1cff12ee87 Store read/draw buffers for FBOs in initial data
* This avoids spamming of glReadBuffer/glDrawBuffer calls pointlessly into
  the pre-frame chunk stream.
* The default FBO stores its ReadBuffer and DrawBuffers in the initial
  frame state vector.
2014-12-07 15:24:46 +00:00
baldurk e3374c74c2 Switch to the proper context to fetch VAO/feedback initial data 2014-12-06 20:27:09 +00:00
baldurk 1cef745534 linux compile fixes 2014-12-05 17:17:03 +00:00
baldurk 9561f88fd5 As a hack for now, don't save/restore D32F_S8 texture data
* On nvidia it seems that doing glCopyImageSubData() on a D32F_S8 texture
  can cause serious problems, so ignore it for now. We can generally get
  away with it, as usually the only depth buffer in this format is the
  'main' depth buffer, which isn't used frame-to-frame.
2014-12-05 09:28:34 +00:00
baldurk 637232af14 Use existing texture to fetch number of mips, not copy texture! 2014-12-05 00:51:07 +00:00
baldurk 34b554d0bf Make sure initial state structures are properly zeroed out. 2014-12-04 21:29:42 +00:00
baldurk 4bd1f940d6 only use CUBE_POSITIVE_X as a query target for CUBE_MAP
* GL_TEXTURE_CUBE_MAP_ARRAY can be used directly as a query target
2014-12-03 20:18:33 +00:00
baldurk 431eef4e6d 64-bit compile fixes 2014-12-03 14:10:57 +00:00
baldurk 03f631bc82 Actually serialise SRGB decode value (!) 2014-12-03 13:07:46 +00:00
baldurk 08174ef277 Serialise transform feedback buffer bindings into feedback record 2014-12-03 11:45:16 +00:00
baldurk c0c436f6ed Make sure to set all sources at once (glShaderSource replaces). 2014-12-03 10:23:31 +00:00
baldurk 90e33ab95f Handle GL_EXT_texture_sRGB_decode. See gl-420-fbo-srgb-decode-ext 2014-12-02 00:25:49 +00:00
baldurk 976e89787b Avoid using glGetTextureImageEXT as it might be buggy for cubemaps 2014-12-01 20:57:39 +00:00
baldurk c370c164ae Force texture completion for copy. See gl-320-fbo-multisample-explicit
* When we do glCopyImageSubData, this seems to require a complete texture
  across all mips - ie. the full mip chain (up to MAX_LEVEL) must be set.
  This requirement holds even if we only copy the mips that are present.
* However, for example attaching an image to a framebuffer, it doesn't
  have to be mipmap complete even if the min/mag filters want mipmaps.
  So in this case we have to force the texture to be complete enough for
  our purposes, and we do this just by setting MAX_LEVEL to clamp the mips
2014-12-01 15:47:27 +00:00
baldurk ba2fe1ccc3 Don't use sampler state for MS texs. See gl-320-fbo-depth-multisample 2014-12-01 14:38:37 +00:00
baldurk 9748813eb1 Use serialised program initial states to translate uniform locations
* If you're capturing and replaying on the same driver it's insanely
  unlikely that this translation will be anything other than the identity
  map, although it wouldn't be illegal to renumber locations. However this
  should allow moving captures between vendors/driver versions/platforms,
  which in the past wasn't possible because locations would change (quite
  validly) when the programs were recompiled. There might be other issues,
  but at least this one is fixed.
2014-11-30 16:05:01 +00:00
baldurk e8f5e78811 Check extensions by enum and centralised checking for 'hacks'
* I need to double check the cubemap texture size query thing, I think I'm
  getting different results on a different nvidia driver (and maybe card).
2014-11-30 15:31:31 +00:00
baldurk 4cbb4c888a Favour DSA texture queries, avoid binding, use GetNumMips
* We only bind where necessary to create (as I don't want to rely on
  glCreate* from ARB_dsa/4.5 yet).
2014-11-30 14:48:08 +00:00