Commit Graph

753 Commits

Author SHA1 Message Date
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
baldurk c22a1bb82c Handle invalid UTF-8 bytes without infinite loop 2014-11-27 19:41:17 +00:00
baldurk 3c40d9ab72 Check for functions that might not be present in renderstate apply 2014-11-27 19:37:45 +00:00
baldurk cdf9146a3e Fix typo where scope was fetched twice 2014-11-27 19:33:11 +00:00
baldurk 3efa9378cf Add compile time asserts on number of pnames, add missing pname 2014-11-27 19:30:46 +00:00
baldurk 8b4475c73d Update mesh columns properly, and use correct stage when specified 2014-11-27 19:26:29 +00:00
baldurk 0892989b4b Handle B8G8R8A8 as R8G8B8A8 in pixel history. Refs #110
* We can't create a UAV of format B8G8R8A8, so just make it R8G8B8A8 and
  let the GPU do the swizzle (everything else is exactly the same).
2014-11-27 19:03:25 +00:00
baldurk d585c25633 Slightly expand pixel history column widths
* Should make exponential float values more obvious/visible.
2014-11-27 18:50:51 +00:00
baldurk 237744a6dd Simple implementation of capturing transform feedback
* This won't work if the feedback is started before the captured frame then
  captured inside it, either by being paused or actually active across the
  SwapBuffers call.
2014-11-27 08:29:38 +00:00
baldurk d4bc4e2999 Fix R11G11B10 decode - it's a truncated half format
* ie. not just an unnormalised mantissa plus biased exponent, it has proper
  IEEE style float properties with hidden bit on the mantissa etc. So full
  decoding is necessary, contrary to what some of the docs say :(.
2014-11-27 00:49:05 +00:00
baldurk 16dd0b77f4 Move bound vertex buffers from general state to VAO state 2014-11-25 23:58:04 +00:00
baldurk 11d6ca5956 Fix a few cases that were mistakenly not calling via 'real' funcptrs 2014-11-25 22:40:56 +00:00
baldurk c79fb99434 Implement some missing query/conditional render functions 2014-11-25 22:40:38 +00:00
baldurk 3f33541132 Implement glBindFragDataLocationIndexed and glUniformSubroutines
* Note that the uniform subroutines are saved and restored by the render
  state, but they are not properly restored anywhere where we fetch &
  restore the current program. Will probably need a special helper class
  to push/pop that correctly.
2014-11-25 22:18:24 +00:00