Commit Graph

766 Commits

Author SHA1 Message Date
baldurk ffdcf5444e Don't print random data as a string 2014-12-01 18:36:40 +00:00
baldurk bf5320edae Make sure queries/conditional rendering are closed properly.
* If we do a partial replay of a frame, a query might be left open. We
  track this and make sure we close any that were left open before the next
  replay.
2014-12-01 18:32:01 +00:00
baldurk 3dfa8f17ab Fix serialising program array uniforms. 2014-12-01 18:13:28 +00:00
baldurk 04c2bba23f Don't use mipmapping for point sampler
* This fixes issues where textures wouldn't render because they weren't
  mipmap complete, and although I was point sampling a single mip the point
  sampler was referencing the mipchain.
2014-12-01 17:50:00 +00:00
baldurk 50d6b62adf Proper SRGB handling in opengl. See gl-320-fbo-srgb
* We create fake backbuffer as SRGB if the original default backbuffer was
  SRGB in the program.
* All of our output backbuffers are also SRGB, and we enable
  GL_FRAMEBUFFER_SRGB when writing to them.
* Add the 'fake' srgb curve applied to linear data to display it as if it
  were srgb, which tends to look intuitively correct even if it's not 100%
  accurate. See the behaviour existing in D3D11 already.
2014-12-01 17:13:30 +00:00
baldurk 962ac749bc Fix mip display 2014-12-01 16:07:04 +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 7add9a63dd Better handling for renderbuffer FBO attachments. See gl-320-fbo-blit
* To display them, we create a texture of the same size/format at creation
  time and do an FBO blit to it, then display that texture
2014-12-01 14:29:43 +00:00
baldurk 829647a924 Interpret index offset in GL drawcalls as byte offset 2014-12-01 13:15:02 +00:00
baldurk 49b2b2d2df Handle empty indices array without crashing 2014-12-01 13:14:43 +00:00
baldurk 332cf73591 Handle GL_FLUSH_EXPLICIT buffer maps. See g-truc gl-320-buffer-update
* The general idea is that while idle we can handle these as normal -
  If we ignore the map we ignore the map and mark the buffer dirty etc.
  This is fine because modified but unflushed regions become undefined, and
  we just let these become the modified values.
* While capturing a frame, we do everything to set up as normal, but then
  instead of comparing the modified shadow buffer to an unmodified version,
  detecting the modified range and making one big Unmap() chunk, we make a
  chunk per Flush() call with the flushed range, and ignore the unmap.
2014-12-01 12:41:01 +00:00
baldurk b6ba100ed1 Add a couple more buffer creation flags 2014-12-01 12:41:00 +00:00
baldurk 1bbed3b880 For glVertexAttrib*Pointer, serialise GL_ARRAY_BUFFER
* When glVertexAttrib*Pointer is called it 'latches' the current binding
  of GL_ARRAY_BUFFER (it sets the attrib binding and vertex buffer on the
  VAO internally).
* So when reading, we haven't serialised all the buffer bindings, so we
  need to bind the right buffer by hand.
2014-12-01 12:41:00 +00:00
baldurk 414473b56a Handle integer and normalized vertex attributes properly 2014-12-01 12:40:59 +00:00
baldurk 7b8ad8daf9 Handle when offset is beyond buffer size or length ends up 0 2014-12-01 12:40:58 +00:00
baldurk 6498424eed Check pipeline is valid. See g-truc gl-320-caps
* If no program or pipeline is bound, need to make sure we don't try and
  query a non-existant pipeline. This could happen if e.g. state is totally
  cleared at the start of the frame.
2014-12-01 12:40:52 +00:00
baldurk 5ae4b0d649 Make sure glGetBufferSubData call doesn't overrun buffer size 2014-11-30 20:16:33 +00:00
baldurk 3fa9dcdf47 Properly initialise parent variable structure 2014-11-30 17:13:55 +00:00
baldurk 7243881de5 Ensure parent refs are deleted before force-deleting resource records
* This most commonly happens with shaders and programs. A program record
  takes a reference on shader records when they are attached and linked,
  then a shader can be orphaned with only that reference remaining if the
  user code detaches and deletes it.
* Previously we would go through, force-delete the shader, then when we
  force-delete the program things would explode since it tries to decrement
  the refcount on the shader and it becomes -1. So now we make all records
  remove their parents (which might delete their parents), before we force
  delete them.
2014-11-30 16:23:11 +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 c4f73c2b58 Handle deleting logfile at program shutdown in core destructor
* Prevents order-of-destructor issues from losing the log filename before
  the core destructor uses it to delete the logfile.
2014-11-30 15:45:19 +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
baldurk 5e6e243c67 Add function to get true number of mips in GL texture
* If it's immutable, fetch immutable size, otherwise calculate number from
  top level width/height/depth.
* Then clamp by TEXTURE_MAX_LEVEL.
* THEN we need to go through each mip and check that it's been set if the
  texture wasn't immutable, since some mips might be uninitialised and
  that is legal, as long as those mips aren't used (e.g. by point sampling
  or as a FBO attachment).
2014-11-30 14:46:22 +00:00
baldurk fabc319b0b Mute all DEBUG_TYPE_OTHER messages from logspamming 2014-11-29 01:58:20 +00:00
baldurk 4d1d816e80 Add function to identify compressed texture formats 2014-11-29 01:58:11 +00:00
baldurk 71ef286e51 Element array buffer binding is part of VAO state 2014-11-29 01:58:00 +00:00
baldurk 87f9a15a3e Number of mips should be clamped to MAX_LEVEL+1
* Even this isn't quite enough. We're actually assuming a 'complete'
  texture, i.e. one which has had all mips uploaded/init'd. It's actually
  valid to have a texture that doesn't have all of its mips initialised
  but as long as you don't use them, ie. you bind a point sampler or you
  use it as a framebuffer attachments, it's valid. So REALLY in the
  non-immutable case, we need to iterate over every level and query to see
  if it's been configured, e.g. by fetching its width. Sigh.
2014-11-29 01:31:22 +00:00
baldurk 322c341fa2 Make it more obvious when input assembler buffers are not set. 2014-11-29 00:36:06 +00:00
baldurk 696eddaf22 Respect MSAA resolve when downcasting from HDR format. Refs #83
* This means saving to png, jpg, etc will now correctly either select the
  chosen sample, or resolve samples down before returning the data.
2014-11-28 22:52:49 +00:00
baldurk 4de6080b06 Use the right variable consistently 2014-11-28 22:26:58 +00:00
baldurk 3f89f12a8d Make sure numSlices doesn't become 0. Refs #83 2014-11-28 22:21:45 +00:00
baldurk 98856f5b62 Don't use MAX_LEVEL to calc mips for non-immutable textures
* GL_TEXTURE_MAX_LEVEL acts as a bound on the number of mips for either
  immutable or non-immutable textures. Instead for non-immutable textures
  we do the standard mip calculation and that's what's necessary for a
  "complete" texture.
2014-11-28 21:15:21 +00:00
baldurk 4a79ac8039 Move CalcNumMips to common header so GL code can access it 2014-11-28 21:12:17 +00:00
baldurk c1c6d635d9 Bugfixes for wchar_t handling 2014-11-28 21:11:49 +00:00
baldurk 35b670d37c Fetch number of active subroutine uniform locations from right place 2014-11-28 21:11:08 +00:00
baldurk 31b965c61c Fix enum typo in GL render state 2014-11-28 21:10:26 +00:00
baldurk e0a0c88972 Only fetch clip control states when available, else use default vals 2014-11-28 21:09:41 +00:00
baldurk 800751f267 Compile fixes for release, wchar_t use in crash handler 2014-11-28 15:30:06 +00:00
baldurk d5439a59a6 Compile fix for 64-bit 2014-11-28 14:18:44 +00:00
Baldur Karlsson 4b3f016cbd Merge pull request #111 from kvark/build
minor build fix for Linux
2014-11-28 07:47:00 +00:00
Dzmitry Malyshau 2cf42bd889 minor build fix for Linux 2014-11-27 21:44:34 -05:00
baldurk ea8203e160 Add backface culling overlay 2014-11-27 23:36:06 +00:00
baldurk 19d2eeb33f Handle instances when stream-out'ing an indexed mesh 2014-11-27 23:19:47 +00:00
baldurk ad352cebc3 Only apply vertexOffset when fetching input vertex data 2014-11-27 23:16:20 +00:00
baldurk c7e83dcaf2 Ignore shader op restype, and copy 32byte types literally
* This prevents e.g. copy as float modifying the data if it's actually an
  int and it evalutes to a NaN.
2014-11-27 22:24:50 +00:00
baldurk 2040a57e5d Check for new versions even if we think one is available
* This way if someone updates their install without clicking the menu item
  to clear this flag, it will still detect the update after a few days.
* (And when I forget to update which beta is latest, it will fix itself
  eventually. Oops).
2014-11-27 21:08:41 +00:00
baldurk de7cabe6f3 Don't read off end of indices buffer data if it's not big enough
* Fix for uploaded crash report.
2014-11-27 21:02:27 +00:00
baldurk 5ad5a0af49 Potentially overestimate compressed image size to avoid crashes
* I need to investigate this more. It seems that on AMD the compressed
  image size returned is the size of the whole cubemap, and then you get
  each face one-by-one. On nVidia the compressed image size is the size of
  one face, so dividing by 6 gives too little space.
* I don't know which one is standard correct, but that kind of doesn't
  matter since I probably need to query the size for maybe a 1x1 cubemap
  or a known dimension & compression format (like BC1 1 byte per pixel).
2014-11-27 19:52:26 +00:00