summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_gen_mipmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker/st_gen_mipmap.c')
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index 6c09b86033..841d77abbc 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -43,6 +43,7 @@
#include "st_draw.h"
#include "st_gen_mipmap.h"
#include "st_program.h"
+#include "st_texture.h"
#include "st_cb_drawpixels.h"
#include "st_cb_texture.h"
@@ -110,14 +111,22 @@ st_init_generate_mipmap(struct st_context *st)
struct pipe_rasterizer_state rasterizer;
struct pipe_depth_stencil_alpha_state depthstencil;
+ /* we don't use blending, but need to set valid values */
memset(&blend, 0, sizeof(blend));
+ blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
+ blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
+ blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
+ blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
blend.colormask = PIPE_MASK_RGBA;
st->gen_mipmap.blend_cso = pipe->create_blend_state(pipe, &blend);
memset(&depthstencil, 0, sizeof(depthstencil));
st->gen_mipmap.depthstencil_cso = pipe->create_depth_stencil_alpha_state(pipe, &depthstencil);
+ /* Note: we're assuming zero is valid for all non-specified fields */
memset(&rasterizer, 0, sizeof(rasterizer));
+ rasterizer.front_winding = PIPE_WINDING_CW;
+ rasterizer.cull_mode = PIPE_WINDING_NONE;
st->gen_mipmap.rasterizer_cso = pipe->create_rasterizer_state(pipe, &rasterizer);
st->gen_mipmap.stfp = make_tex_fragment_program(st->ctx);
@@ -218,6 +227,7 @@ st_render_mipmap(struct st_context *st,
uint baseLevel, uint lastLevel)
{
struct pipe_context *pipe = st->pipe;
+ struct pipe_screen *screen = pipe->screen;
struct pipe_framebuffer_state fb;
struct pipe_sampler_state sampler;
void *sampler_cso;
@@ -228,7 +238,7 @@ st_render_mipmap(struct st_context *st,
assert(target != GL_TEXTURE_3D); /* not done yet */
/* check if we can render in the texture's format */
- if (!pipe->is_format_supported(pipe, pt->format, PIPE_SURFACE)) {
+ if (!screen->is_format_supported(screen, pt->format, PIPE_SURFACE)) {
return FALSE;
}
@@ -266,7 +276,7 @@ st_render_mipmap(struct st_context *st,
/*
* Setup framebuffer / dest surface
*/
- fb.cbufs[0] = pipe->get_tex_surface(pipe, pt, face, dstLevel, zslice);
+ fb.cbufs[0] = screen->get_tex_surface(screen, pt, face, dstLevel, zslice);
pipe->set_framebuffer_state(pipe, &fb);
/*
@@ -314,6 +324,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj)
{
struct pipe_context *pipe = ctx->st->pipe;
+ struct pipe_screen *screen = pipe->screen;
struct pipe_winsys *ws = pipe->winsys;
struct pipe_texture *pt = st_get_texobj_texture(texObj);
const uint baseLevel = texObj->BaseLevel;
@@ -334,8 +345,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
const ubyte *srcData;
ubyte *dstData;
- srcSurf = pipe->get_tex_surface(pipe, pt, face, srcLevel, zslice);
- dstSurf = pipe->get_tex_surface(pipe, pt, face, dstLevel, zslice);
+ srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice);
+ dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice);
srcData = (ubyte *) ws->buffer_map(ws, srcSurf->buffer,
PIPE_BUFFER_USAGE_CPU_READ)