mesa/st: move fbo code to direct calling
Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14100>
This commit is contained in:
parent
6d79ce5a58
commit
2d912b5caa
|
@ -34,6 +34,7 @@
|
|||
#include "state.h"
|
||||
#include "mtypes.h"
|
||||
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
|
||||
|
@ -82,9 +83,9 @@ _mesa_clear_accum_buffer(struct gl_context *ctx)
|
|||
width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
|
||||
height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
|
||||
|
||||
ctx->Driver.MapRenderbuffer(ctx, accRb, x, y, width, height,
|
||||
GL_MAP_WRITE_BIT, &accMap, &accRowStride,
|
||||
ctx->DrawBuffer->FlipY);
|
||||
st_MapRenderbuffer(ctx, accRb, x, y, width, height,
|
||||
GL_MAP_WRITE_BIT, &accMap, &accRowStride,
|
||||
ctx->DrawBuffer->FlipY);
|
||||
|
||||
if (!accMap) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAccum");
|
||||
|
@ -115,7 +116,7 @@ _mesa_clear_accum_buffer(struct gl_context *ctx)
|
|||
_mesa_warning(ctx, "unexpected accum buffer type");
|
||||
}
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, accRb);
|
||||
st_UnmapRenderbuffer(ctx, accRb);
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,10 +138,10 @@ accum_scale_or_bias(struct gl_context *ctx, GLfloat value,
|
|||
|
||||
assert(accRb);
|
||||
|
||||
ctx->Driver.MapRenderbuffer(ctx, accRb, xpos, ypos, width, height,
|
||||
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
|
||||
&accMap, &accRowStride,
|
||||
ctx->DrawBuffer->FlipY);
|
||||
st_MapRenderbuffer(ctx, accRb, xpos, ypos, width, height,
|
||||
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
|
||||
&accMap, &accRowStride,
|
||||
ctx->DrawBuffer->FlipY);
|
||||
|
||||
if (!accMap) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAccum");
|
||||
|
@ -174,7 +175,7 @@ accum_scale_or_bias(struct gl_context *ctx, GLfloat value,
|
|||
/* other types someday? */
|
||||
}
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, accRb);
|
||||
st_UnmapRenderbuffer(ctx, accRb);
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,21 +209,21 @@ accum_or_load(struct gl_context *ctx, GLfloat value,
|
|||
mappingFlags |= GL_MAP_READ_BIT;
|
||||
|
||||
/* Map accum buffer */
|
||||
ctx->Driver.MapRenderbuffer(ctx, accRb, xpos, ypos, width, height,
|
||||
mappingFlags, &accMap, &accRowStride,
|
||||
ctx->DrawBuffer->FlipY);
|
||||
st_MapRenderbuffer(ctx, accRb, xpos, ypos, width, height,
|
||||
mappingFlags, &accMap, &accRowStride,
|
||||
ctx->DrawBuffer->FlipY);
|
||||
if (!accMap) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAccum");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Map color buffer */
|
||||
ctx->Driver.MapRenderbuffer(ctx, colorRb, xpos, ypos, width, height,
|
||||
GL_MAP_READ_BIT,
|
||||
&colorMap, &colorRowStride,
|
||||
ctx->DrawBuffer->FlipY);
|
||||
st_MapRenderbuffer(ctx, colorRb, xpos, ypos, width, height,
|
||||
GL_MAP_READ_BIT,
|
||||
&colorMap, &colorRowStride,
|
||||
ctx->DrawBuffer->FlipY);
|
||||
if (!colorMap) {
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, accRb);
|
||||
st_UnmapRenderbuffer(ctx, accRb);
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAccum");
|
||||
return;
|
||||
}
|
||||
|
@ -272,8 +273,8 @@ accum_or_load(struct gl_context *ctx, GLfloat value,
|
|||
/* other types someday? */
|
||||
}
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, accRb);
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, colorRb);
|
||||
st_UnmapRenderbuffer(ctx, accRb);
|
||||
st_UnmapRenderbuffer(ctx, colorRb);
|
||||
}
|
||||
|
||||
|
||||
|
@ -291,7 +292,7 @@ accum_return(struct gl_context *ctx, GLfloat value,
|
|||
GLuint buffer;
|
||||
|
||||
/* Map accum buffer */
|
||||
ctx->Driver.MapRenderbuffer(ctx, accRb, xpos, ypos, width, height,
|
||||
st_MapRenderbuffer(ctx, accRb, xpos, ypos, width, height,
|
||||
GL_MAP_READ_BIT,
|
||||
&accMap, &accRowStride, fb->FlipY);
|
||||
if (!accMap) {
|
||||
|
@ -312,7 +313,7 @@ accum_return(struct gl_context *ctx, GLfloat value,
|
|||
mappingFlags |= GL_MAP_READ_BIT;
|
||||
|
||||
/* Map color buffer */
|
||||
ctx->Driver.MapRenderbuffer(ctx, colorRb, xpos, ypos, width, height,
|
||||
st_MapRenderbuffer(ctx, colorRb, xpos, ypos, width, height,
|
||||
mappingFlags, &colorMap, &colorRowStride,
|
||||
fb->FlipY);
|
||||
if (!colorMap) {
|
||||
|
@ -380,10 +381,10 @@ accum_return(struct gl_context *ctx, GLfloat value,
|
|||
/* other types someday? */
|
||||
}
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, colorRb);
|
||||
st_UnmapRenderbuffer(ctx, colorRb);
|
||||
}
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, accRb);
|
||||
st_UnmapRenderbuffer(ctx, accRb);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "util/bitscan.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
|
||||
#define BAD_MASK ~0u
|
||||
|
||||
|
@ -315,8 +316,7 @@ draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
|||
|
||||
/* Call device driver function only if fb is the bound draw buffer */
|
||||
if (fb == ctx->DrawBuffer) {
|
||||
if (ctx->Driver.DrawBufferAllocate)
|
||||
ctx->Driver.DrawBufferAllocate(ctx);
|
||||
st_DrawBufferAllocate(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,8 +622,7 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLsizei n,
|
|||
* may not be valid.
|
||||
*/
|
||||
if (fb == ctx->DrawBuffer) {
|
||||
if (ctx->Driver.DrawBufferAllocate)
|
||||
ctx->Driver.DrawBufferAllocate(ctx);
|
||||
st_DrawBufferAllocate(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -932,8 +931,7 @@ read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
|||
|
||||
/* Call the device driver function only if fb is the bound read buffer */
|
||||
if (fb == ctx->ReadBuffer) {
|
||||
if (ctx->Driver.ReadBuffer)
|
||||
ctx->Driver.ReadBuffer(ctx, buffer);
|
||||
st_ReadBuffer(ctx, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -444,21 +444,6 @@ struct dd_function_table {
|
|||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_object *origTexObj);
|
||||
|
||||
/**
|
||||
* Map a renderbuffer into user space.
|
||||
* \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
|
||||
* GL_MAP_INVALIDATE_RANGE_BIT (if writing)
|
||||
*/
|
||||
void (*MapRenderbuffer)(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint x, GLuint y, GLuint w, GLuint h,
|
||||
GLbitfield mode,
|
||||
GLubyte **mapOut, GLint *rowStrideOut,
|
||||
bool flip_y);
|
||||
|
||||
void (*UnmapRenderbuffer)(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
|
@ -650,10 +635,6 @@ struct dd_function_table {
|
|||
* May add more functions like these to the device driver in the future.
|
||||
*/
|
||||
/*@{*/
|
||||
/** Used to allocated any buffers with on-demand creation */
|
||||
void (*DrawBufferAllocate)(struct gl_context *ctx);
|
||||
/* Specifies the current buffer for reading */
|
||||
void (*ReadBuffer)( struct gl_context *ctx, GLenum buffer );
|
||||
/** Set texture parameter (callee gets param value from the texObj) */
|
||||
void (*TexParameter)(struct gl_context *ctx,
|
||||
struct gl_texture_object *texObj, GLenum pname);
|
||||
|
@ -721,25 +702,12 @@ struct dd_function_table {
|
|||
/**
|
||||
* \name Functions for GL_EXT_framebuffer_{object,blit,discard}.
|
||||
*/
|
||||
/*@{*/
|
||||
struct gl_renderbuffer * (*NewRenderbuffer)(struct gl_context *ctx,
|
||||
GLuint name);
|
||||
void (*RenderTexture)(struct gl_context *ctx,
|
||||
struct gl_framebuffer *fb,
|
||||
struct gl_renderbuffer_attachment *att);
|
||||
void (*FinishRenderTexture)(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb);
|
||||
void (*ValidateFramebuffer)(struct gl_context *ctx,
|
||||
struct gl_framebuffer *fb);
|
||||
/*@}*/
|
||||
void (*BlitFramebuffer)(struct gl_context *ctx,
|
||||
struct gl_framebuffer *readFb,
|
||||
struct gl_framebuffer *drawFb,
|
||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||
GLbitfield mask, GLenum filter);
|
||||
void (*DiscardFramebuffer)(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
struct gl_renderbuffer_attachment *att);
|
||||
|
||||
/**
|
||||
* \name Functions for GL_ARB_sample_locations
|
||||
|
@ -747,7 +715,6 @@ struct dd_function_table {
|
|||
void (*GetProgrammableSampleCaps)(struct gl_context *ctx,
|
||||
const struct gl_framebuffer *fb,
|
||||
GLuint *bits, GLuint *width, GLuint *height);
|
||||
void (*EvaluateDepthValues)(struct gl_context *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include "teximage.h"
|
||||
#include "texobj.h"
|
||||
|
||||
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
/**
|
||||
* Notes:
|
||||
*
|
||||
|
@ -421,8 +421,8 @@ remove_attachment(struct gl_context *ctx,
|
|||
struct gl_renderbuffer *rb = att->Renderbuffer;
|
||||
|
||||
/* tell driver that we're done rendering to this texture. */
|
||||
if (rb && rb->NeedsFinishRenderTexture)
|
||||
ctx->Driver.FinishRenderTexture(ctx, rb);
|
||||
if (rb)
|
||||
st_finish_render_texture(ctx, rb);
|
||||
|
||||
if (att->Type == GL_TEXTURE) {
|
||||
assert(att->Texture);
|
||||
|
@ -485,7 +485,7 @@ _mesa_update_texture_renderbuffer(struct gl_context *ctx,
|
|||
|
||||
rb = att->Renderbuffer;
|
||||
if (!rb) {
|
||||
rb = ctx->Driver.NewRenderbuffer(ctx, ~0);
|
||||
rb = st_new_renderbuffer(ctx, ~0);
|
||||
if (!rb) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glFramebufferTexture()");
|
||||
return;
|
||||
|
@ -496,8 +496,6 @@ _mesa_update_texture_renderbuffer(struct gl_context *ctx,
|
|||
* for clarity compared to user renderbuffers.
|
||||
*/
|
||||
rb->AllocStorage = NULL;
|
||||
|
||||
rb->NeedsFinishRenderTexture = ctx->Driver.FinishRenderTexture != NULL;
|
||||
}
|
||||
|
||||
if (!texImage)
|
||||
|
@ -514,7 +512,7 @@ _mesa_update_texture_renderbuffer(struct gl_context *ctx,
|
|||
rb->TexImage = texImage;
|
||||
|
||||
if (driver_RenderTexture_is_safe(att))
|
||||
ctx->Driver.RenderTexture(ctx, fb, att);
|
||||
st_render_texture(ctx, fb, att);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -531,8 +529,8 @@ set_texture_attachment(struct gl_context *ctx,
|
|||
{
|
||||
struct gl_renderbuffer *rb = att->Renderbuffer;
|
||||
|
||||
if (rb && rb->NeedsFinishRenderTexture)
|
||||
ctx->Driver.FinishRenderTexture(ctx, rb);
|
||||
if (rb)
|
||||
st_finish_render_texture(ctx, rb);
|
||||
|
||||
if (att->Texture == texObj) {
|
||||
/* re-attaching same texture */
|
||||
|
@ -1520,12 +1518,10 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
|
|||
* Drivers will most likely set the status to GL_FRAMEBUFFER_UNSUPPORTED
|
||||
* if anything.
|
||||
*/
|
||||
if (ctx->Driver.ValidateFramebuffer) {
|
||||
ctx->Driver.ValidateFramebuffer(ctx, fb);
|
||||
if (fb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
fbo_incomplete(ctx, "driver marked FBO as incomplete", -1);
|
||||
return;
|
||||
}
|
||||
st_validate_framebuffer(ctx, fb);
|
||||
if (fb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
fbo_incomplete(ctx, "driver marked FBO as incomplete", -1);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1565,7 +1561,7 @@ allocate_renderbuffer_locked(struct gl_context *ctx, GLuint renderbuffer,
|
|||
struct gl_renderbuffer *newRb;
|
||||
|
||||
/* create new renderbuffer object */
|
||||
newRb = ctx->Driver.NewRenderbuffer(ctx, renderbuffer);
|
||||
newRb = st_new_renderbuffer(ctx, renderbuffer);
|
||||
if (!newRb) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
|
||||
return NULL;
|
||||
|
@ -3016,7 +3012,6 @@ static void
|
|||
check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
|
||||
{
|
||||
GLuint i;
|
||||
assert(ctx->Driver.RenderTexture);
|
||||
|
||||
if (_mesa_is_winsys_fbo(fb))
|
||||
return; /* can't render to texture with winsys framebuffers */
|
||||
|
@ -3025,7 +3020,7 @@ check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
|
|||
struct gl_renderbuffer_attachment *att = fb->Attachment + i;
|
||||
if (att->Texture && att->Renderbuffer->TexImage
|
||||
&& driver_RenderTexture_is_safe(att)) {
|
||||
ctx->Driver.RenderTexture(ctx, fb, att);
|
||||
st_render_texture(ctx, fb, att);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3039,18 +3034,15 @@ check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
|
|||
static void
|
||||
check_end_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
|
||||
{
|
||||
/* Skip if we know NeedsFinishRenderTexture won't be set. */
|
||||
if (_mesa_is_winsys_fbo(fb))
|
||||
return;
|
||||
|
||||
if (ctx->Driver.FinishRenderTexture) {
|
||||
GLuint i;
|
||||
for (i = 0; i < BUFFER_COUNT; i++) {
|
||||
struct gl_renderbuffer_attachment *att = fb->Attachment + i;
|
||||
struct gl_renderbuffer *rb = att->Renderbuffer;
|
||||
if (rb && rb->NeedsFinishRenderTexture) {
|
||||
ctx->Driver.FinishRenderTexture(ctx, rb);
|
||||
}
|
||||
GLuint i;
|
||||
for (i = 0; i < BUFFER_COUNT; i++) {
|
||||
struct gl_renderbuffer_attachment *att = fb->Attachment + i;
|
||||
struct gl_renderbuffer *rb = att->Renderbuffer;
|
||||
if (rb) {
|
||||
st_finish_render_texture(ctx, rb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5161,9 +5153,6 @@ static void
|
|||
discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
GLsizei numAttachments, const GLenum *attachments)
|
||||
{
|
||||
if (!ctx->Driver.DiscardFramebuffer)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < numAttachments; i++) {
|
||||
struct gl_renderbuffer_attachment *att =
|
||||
get_fb_attachment(ctx, fb, attachments[i]);
|
||||
|
@ -5173,7 +5162,7 @@ discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
|||
|
||||
/* If we're asked to invalidate just depth or just stencil, but the
|
||||
* attachment is packed depth/stencil, then we can only use
|
||||
* Driver.DiscardFramebuffer if the attachments list includes both depth
|
||||
* DiscardFramebuffer if the attachments list includes both depth
|
||||
* and stencil and they both point at the same renderbuffer.
|
||||
*/
|
||||
if ((attachments[i] == GL_DEPTH_ATTACHMENT ||
|
||||
|
@ -5195,7 +5184,7 @@ discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
|||
continue;
|
||||
}
|
||||
|
||||
ctx->Driver.DiscardFramebuffer(ctx, fb, att);
|
||||
st_discard_framebuffer(ctx, fb, att);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5537,6 +5526,5 @@ _mesa_EvaluateDepthValuesARB(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (ctx->Driver.EvaluateDepthValues)
|
||||
ctx->Driver.EvaluateDepthValues(ctx);
|
||||
st_EvaluateDepthValues(ctx);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "state.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
|
||||
/**
|
||||
* Compute/set the _DepthMax field for the given framebuffer.
|
||||
|
@ -611,8 +611,7 @@ update_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
|
|||
|
||||
/* Call device driver function if fb is the bound draw buffer. */
|
||||
if (fb == ctx->DrawBuffer) {
|
||||
if (ctx->Driver.DrawBufferAllocate)
|
||||
ctx->Driver.DrawBufferAllocate(ctx);
|
||||
st_DrawBufferAllocate(ctx);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -3499,15 +3499,6 @@ struct gl_renderbuffer
|
|||
GLuint Depth;
|
||||
GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */
|
||||
GLboolean AttachedAnytime; /**< TRUE if it was attached to a framebuffer */
|
||||
/**
|
||||
* True for renderbuffers that wrap textures, giving the driver a chance to
|
||||
* flush render caches through the FinishRenderTexture hook.
|
||||
*
|
||||
* Drivers may also set this on renderbuffers other than those generated by
|
||||
* glFramebufferTexture(), though it means FinishRenderTexture() would be
|
||||
* called without a rb->TexImage.
|
||||
*/
|
||||
GLboolean NeedsFinishRenderTexture;
|
||||
GLubyte NumSamples; /**< zero means not multisampled */
|
||||
GLubyte NumStorageSamples; /**< for AMD_framebuffer_multisample_advanced */
|
||||
GLenum16 InternalFormat; /**< The user-specified format */
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "format_utils.h"
|
||||
#include "pixeltransfer.h"
|
||||
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
|
||||
/**
|
||||
* Return true if the conversion L=R+G+B is needed.
|
||||
|
@ -241,8 +242,8 @@ readpixels_memcpy(struct gl_context *ctx,
|
|||
dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height,
|
||||
format, type, 0, 0);
|
||||
|
||||
ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &stride, ctx->ReadBuffer->FlipY);
|
||||
st_MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &stride, ctx->ReadBuffer->FlipY);
|
||||
if (!map) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
|
||||
return GL_TRUE; /* don't bother trying the slow path */
|
||||
|
@ -262,7 +263,7 @@ readpixels_memcpy(struct gl_context *ctx,
|
|||
}
|
||||
}
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, rb);
|
||||
st_UnmapRenderbuffer(ctx, rb);
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
@ -292,8 +293,8 @@ read_uint_depth_pixels( struct gl_context *ctx,
|
|||
if (_mesa_get_format_datatype(rb->Format) != GL_UNSIGNED_NORMALIZED)
|
||||
return GL_FALSE;
|
||||
|
||||
ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &stride, fb->FlipY);
|
||||
st_MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &stride, fb->FlipY);
|
||||
|
||||
if (!map) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
|
||||
|
@ -310,7 +311,7 @@ read_uint_depth_pixels( struct gl_context *ctx,
|
|||
map += stride;
|
||||
dst += dstStride;
|
||||
}
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, rb);
|
||||
st_UnmapRenderbuffer(ctx, rb);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
@ -350,8 +351,8 @@ read_depth_pixels( struct gl_context *ctx,
|
|||
dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height,
|
||||
GL_DEPTH_COMPONENT, type, 0, 0);
|
||||
|
||||
ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &stride, fb->FlipY);
|
||||
st_MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &stride, fb->FlipY);
|
||||
if (!map) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
|
||||
return;
|
||||
|
@ -375,7 +376,7 @@ read_depth_pixels( struct gl_context *ctx,
|
|||
|
||||
free(depthValues);
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, rb);
|
||||
st_UnmapRenderbuffer(ctx, rb);
|
||||
}
|
||||
|
||||
|
||||
|
@ -398,8 +399,8 @@ read_stencil_pixels( struct gl_context *ctx,
|
|||
if (!rb)
|
||||
return;
|
||||
|
||||
ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &stride, fb->FlipY);
|
||||
st_MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &stride, fb->FlipY);
|
||||
if (!map) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
|
||||
return;
|
||||
|
@ -427,7 +428,7 @@ read_stencil_pixels( struct gl_context *ctx,
|
|||
|
||||
free(stencil);
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, rb);
|
||||
st_UnmapRenderbuffer(ctx, rb);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -469,8 +470,8 @@ read_rgba_pixels( struct gl_context *ctx,
|
|||
format, type, 0, 0);
|
||||
|
||||
/* Map the source render buffer */
|
||||
ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &rb_stride, fb->FlipY);
|
||||
st_MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &rb_stride, fb->FlipY);
|
||||
if (!map) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
|
||||
return;
|
||||
|
@ -633,7 +634,7 @@ done_swap:
|
|||
}
|
||||
|
||||
done_unmap:
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, rb);
|
||||
st_UnmapRenderbuffer(ctx, rb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -659,8 +660,8 @@ fast_read_depth_stencil_pixels(struct gl_context *ctx,
|
|||
rb->Format != MESA_FORMAT_Z24_UNORM_S8_UINT)
|
||||
return GL_FALSE;
|
||||
|
||||
ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &stride, fb->FlipY);
|
||||
st_MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
|
||||
&map, &stride, fb->FlipY);
|
||||
if (!map) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
|
||||
return GL_TRUE; /* don't bother trying the slow path */
|
||||
|
@ -673,7 +674,7 @@ fast_read_depth_stencil_pixels(struct gl_context *ctx,
|
|||
dst += dstStride;
|
||||
}
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, rb);
|
||||
st_UnmapRenderbuffer(ctx, rb);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
@ -699,17 +700,17 @@ fast_read_depth_stencil_pixels_separate(struct gl_context *ctx,
|
|||
if (_mesa_get_format_datatype(depthRb->Format) != GL_UNSIGNED_NORMALIZED)
|
||||
return GL_FALSE;
|
||||
|
||||
ctx->Driver.MapRenderbuffer(ctx, depthRb, x, y, width, height,
|
||||
GL_MAP_READ_BIT, &depthMap, &depthStride, fb->FlipY);
|
||||
st_MapRenderbuffer(ctx, depthRb, x, y, width, height,
|
||||
GL_MAP_READ_BIT, &depthMap, &depthStride, fb->FlipY);
|
||||
if (!depthMap) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
|
||||
return GL_TRUE; /* don't bother trying the slow path */
|
||||
}
|
||||
|
||||
ctx->Driver.MapRenderbuffer(ctx, stencilRb, x, y, width, height,
|
||||
GL_MAP_READ_BIT, &stencilMap, &stencilStride, fb->FlipY);
|
||||
st_MapRenderbuffer(ctx, stencilRb, x, y, width, height,
|
||||
GL_MAP_READ_BIT, &stencilMap, &stencilStride, fb->FlipY);
|
||||
if (!stencilMap) {
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, depthRb);
|
||||
st_UnmapRenderbuffer(ctx, depthRb);
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
|
||||
return GL_TRUE; /* don't bother trying the slow path */
|
||||
}
|
||||
|
@ -737,8 +738,8 @@ fast_read_depth_stencil_pixels_separate(struct gl_context *ctx,
|
|||
|
||||
free(stencilVals);
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, depthRb);
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, stencilRb);
|
||||
st_UnmapRenderbuffer(ctx, depthRb);
|
||||
st_UnmapRenderbuffer(ctx, stencilRb);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
@ -763,19 +764,19 @@ slow_read_depth_stencil_pixels_separate(struct gl_context *ctx,
|
|||
/* The depth and stencil buffers might be separate, or a single buffer.
|
||||
* If one buffer, only map it once.
|
||||
*/
|
||||
ctx->Driver.MapRenderbuffer(ctx, depthRb, x, y, width, height,
|
||||
GL_MAP_READ_BIT, &depthMap, &depthStride, fb->FlipY);
|
||||
st_MapRenderbuffer(ctx, depthRb, x, y, width, height,
|
||||
GL_MAP_READ_BIT, &depthMap, &depthStride, fb->FlipY);
|
||||
if (!depthMap) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
|
||||
return;
|
||||
}
|
||||
|
||||
if (stencilRb != depthRb) {
|
||||
ctx->Driver.MapRenderbuffer(ctx, stencilRb, x, y, width, height,
|
||||
GL_MAP_READ_BIT, &stencilMap,
|
||||
&stencilStride, fb->FlipY);
|
||||
st_MapRenderbuffer(ctx, stencilRb, x, y, width, height,
|
||||
GL_MAP_READ_BIT, &stencilMap,
|
||||
&stencilStride, fb->FlipY);
|
||||
if (!stencilMap) {
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, depthRb);
|
||||
st_UnmapRenderbuffer(ctx, depthRb);
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
|
||||
return;
|
||||
}
|
||||
|
@ -809,9 +810,9 @@ slow_read_depth_stencil_pixels_separate(struct gl_context *ctx,
|
|||
free(stencilVals);
|
||||
free(depthVals);
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, depthRb);
|
||||
st_UnmapRenderbuffer(ctx, depthRb);
|
||||
if (stencilRb != depthRb) {
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, stencilRb);
|
||||
st_UnmapRenderbuffer(ctx, stencilRb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -300,7 +300,7 @@ st_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb)
|
|||
/**
|
||||
* Called via ctx->Driver.NewRenderbuffer()
|
||||
*/
|
||||
static struct gl_renderbuffer *
|
||||
struct gl_renderbuffer *
|
||||
st_new_renderbuffer(struct gl_context *ctx, GLuint name)
|
||||
{
|
||||
struct st_renderbuffer *strb = ST_CALLOC_STRUCT(st_renderbuffer);
|
||||
|
@ -597,7 +597,7 @@ get_teximage_resource(struct gl_texture_object *texObj,
|
|||
/**
|
||||
* Called by ctx->Driver.RenderTexture
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_render_texture(struct gl_context *ctx,
|
||||
struct gl_framebuffer *fb,
|
||||
struct gl_renderbuffer_attachment *att)
|
||||
|
@ -640,7 +640,7 @@ st_render_texture(struct gl_context *ctx,
|
|||
/**
|
||||
* Called via ctx->Driver.FinishRenderTexture.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_finish_render_texture(struct gl_context *ctx, struct gl_renderbuffer *rb)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
|
@ -726,7 +726,7 @@ st_validate_attachment(struct gl_context *ctx,
|
|||
*
|
||||
* For Gallium we only supports combined Z+stencil, not separate buffers.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
|
@ -804,7 +804,7 @@ st_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
|
|||
/**
|
||||
* Called by ctx->Driver.DiscardFramebuffer
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
struct gl_renderbuffer_attachment *att)
|
||||
{
|
||||
|
@ -833,7 +833,7 @@ st_discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
|||
* that buffer. Note, this is only for window system buffers, not user-
|
||||
* created FBOs.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_DrawBufferAllocate(struct gl_context *ctx)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
|
@ -857,7 +857,7 @@ st_DrawBufferAllocate(struct gl_context *ctx)
|
|||
* Called via glReadBuffer. As with st_DrawBufferAllocate, we use this
|
||||
* function to check if we need to allocate a renderbuffer on demand.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
|
@ -885,7 +885,7 @@ st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
|
|||
/**
|
||||
* Called via ctx->Driver.MapRenderbuffer.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_MapRenderbuffer(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint x, GLuint y, GLuint w, GLuint h,
|
||||
|
@ -958,7 +958,7 @@ st_MapRenderbuffer(struct gl_context *ctx,
|
|||
/**
|
||||
* Called via ctx->Driver.UnmapRenderbuffer.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_UnmapRenderbuffer(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb)
|
||||
{
|
||||
|
@ -979,7 +979,7 @@ st_UnmapRenderbuffer(struct gl_context *ctx,
|
|||
/**
|
||||
* Called via ctx->Driver.EvaluateDepthValues.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_EvaluateDepthValues(struct gl_context *ctx)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
|
@ -988,21 +988,3 @@ st_EvaluateDepthValues(struct gl_context *ctx)
|
|||
|
||||
st->pipe->evaluate_depth_buffer(st->pipe);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
st_init_fbo_functions(struct dd_function_table *functions)
|
||||
{
|
||||
functions->NewRenderbuffer = st_new_renderbuffer;
|
||||
functions->RenderTexture = st_render_texture;
|
||||
functions->FinishRenderTexture = st_finish_render_texture;
|
||||
functions->ValidateFramebuffer = st_validate_framebuffer;
|
||||
functions->DiscardFramebuffer = st_discard_framebuffer;
|
||||
|
||||
functions->DrawBufferAllocate = st_DrawBufferAllocate;
|
||||
functions->ReadBuffer = st_ReadBuffer;
|
||||
|
||||
functions->MapRenderbuffer = st_MapRenderbuffer;
|
||||
functions->UnmapRenderbuffer = st_UnmapRenderbuffer;
|
||||
functions->EvaluateDepthValues = st_EvaluateDepthValues;
|
||||
}
|
||||
|
|
|
@ -109,11 +109,28 @@ extern void
|
|||
st_update_renderbuffer_surface(struct st_context *st,
|
||||
struct st_renderbuffer *strb);
|
||||
|
||||
extern void
|
||||
st_init_fbo_functions(struct dd_function_table *functions);
|
||||
|
||||
extern void
|
||||
st_regen_renderbuffer_surface(struct st_context *st,
|
||||
struct st_renderbuffer *strb);
|
||||
|
||||
struct gl_renderbuffer *st_new_renderbuffer(struct gl_context *ctx, GLuint name);
|
||||
void st_render_texture(struct gl_context *ctx,
|
||||
struct gl_framebuffer *fb,
|
||||
struct gl_renderbuffer_attachment *att);
|
||||
void st_finish_render_texture(struct gl_context *ctx, struct gl_renderbuffer *rb);
|
||||
void st_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb);
|
||||
void st_discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
struct gl_renderbuffer_attachment *att);
|
||||
void st_DrawBufferAllocate(struct gl_context *ctx);
|
||||
void st_ReadBuffer(struct gl_context *ctx, GLenum buffer);
|
||||
|
||||
void st_MapRenderbuffer(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint x, GLuint y, GLuint w, GLuint h,
|
||||
GLbitfield mode,
|
||||
GLubyte **mapOut, GLint *rowStrideOut,
|
||||
bool flip_y);
|
||||
void st_UnmapRenderbuffer(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb);
|
||||
void st_EvaluateDepthValues(struct gl_context *ctx);
|
||||
#endif /* ST_CB_FBO_H */
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include "st_cb_rasterpos.h"
|
||||
#include "st_cb_drawtex.h"
|
||||
#include "st_cb_eglimage.h"
|
||||
#include "st_cb_fbo.h"
|
||||
#include "st_cb_feedback.h"
|
||||
#include "st_cb_msaa.h"
|
||||
#include "st_cb_perfmon.h"
|
||||
|
@ -942,7 +941,6 @@ st_init_driver_functions(struct pipe_screen *screen,
|
|||
|
||||
st_init_eglimage_functions(functions, has_egl_image_validate);
|
||||
|
||||
st_init_fbo_functions(functions);
|
||||
st_init_msaa_functions(functions);
|
||||
st_init_program_functions(functions);
|
||||
st_init_readpixels_functions(functions);
|
||||
|
|
Loading…
Reference in New Issue