#include "main/context.h"
#include "main/texstore.h"
#include "main/enums.h"
+#include "main/image.h"
#include "main/macros.h"
#include "pipe/p_context.h"
GLenum format, GLenum type)
{
enum pipe_format pFormat;
+ uint usage = PIPE_BIND_SAMPLER_VIEW;
(void) format;
(void) type;
+ /* GL textures may wind up being render targets, but we don't know
+ * that in advance. Specify potential render target flags now.
+ * An alternative would be to destroy and re-create a texture when
+ * we first start rendering to it.
+ */
+ if (_mesa_is_depth_format(internalFormat) ||
+ _mesa_is_depthstencil_format(internalFormat))
+ usage |= PIPE_BIND_DEPTH_STENCIL;
+ else
+ usage |= PIPE_BIND_RENDER_TARGET;
+
pFormat = st_choose_format(ctx->st->pipe->screen, internalFormat,
- PIPE_TEXTURE_2D, PIPE_BIND_SAMPLER_VIEW);
+ PIPE_TEXTURE_2D, usage);
if (pFormat == PIPE_FORMAT_NONE)
return MESA_FORMAT_NONE;