X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fi965%2Fintel_tex.c;h=0650b6e629c6b5f60e80b2269314d2cba81f9b9b;hb=eb3047c094abfa03e071453d7c373e9c2c574370;hp=d3e24f49c7c67e64d6ec3836b2556f7f929611cf;hpb=d4d505d0b04b9bce7c346fe0710df9921861edd6;p=mesa.git diff --git a/src/mesa/drivers/dri/i965/intel_tex.c b/src/mesa/drivers/dri/i965/intel_tex.c index d3e24f49c7c..0650b6e629c 100644 --- a/src/mesa/drivers/dri/i965/intel_tex.c +++ b/src/mesa/drivers/dri/i965/intel_tex.c @@ -5,11 +5,11 @@ #include "main/mipmap.h" #include "drivers/common/meta.h" #include "brw_context.h" +#include "brw_defines.h" #include "intel_buffer_objects.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" #include "intel_fbo.h" -#include "intel_reg.h" #define FILE_DEBUG_FLAG DEBUG_TEXTURE @@ -71,7 +71,7 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, /* Quantize sample count */ if (image->NumSamples) { - image->NumSamples = intel_quantize_num_samples(brw->intelScreen, image->NumSamples); + image->NumSamples = intel_quantize_num_samples(brw->screen, image->NumSamples); if (!image->NumSamples) return false; } @@ -94,7 +94,9 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, } else { intel_image->mt = intel_miptree_create_for_teximage(brw, intel_texobj, intel_image, - 0); + MIPTREE_CREATE_DEFAULT); + if (!intel_image->mt) + return false; /* Even if the object currently has a mipmap tree associated * with it, this one is a more likely candidate to represent the @@ -128,7 +130,7 @@ intel_alloc_texture_storage(struct gl_context *ctx, struct brw_context *brw = brw_context(ctx); struct intel_texture_object *intel_texobj = intel_texture_object(texobj); struct gl_texture_image *first_image = texobj->Image[0][0]; - int num_samples = intel_quantize_num_samples(brw->intelScreen, + int num_samples = intel_quantize_num_samples(brw->screen, first_image->NumSamples); const int numFaces = _mesa_num_tex_faces(texobj->Target); int face; @@ -147,8 +149,8 @@ intel_alloc_texture_storage(struct gl_context *ctx, first_image->TexFormat, 0, levels - 1, width, height, depth, - num_samples, - MIPTREE_LAYOUT_TILING_ANY); + MAX2(num_samples, 1), + MIPTREE_CREATE_DEFAULT); if (intel_texobj->mt == NULL) { return false; @@ -174,7 +176,7 @@ intel_alloc_texture_storage(struct gl_context *ctx, intel_texobj->needs_validate = false; intel_texobj->validated_first_level = 0; intel_texobj->validated_last_level = levels - 1; - intel_texobj->_Format = intel_texobj->mt->format; + intel_texobj->_Format = first_image->TexFormat; return true; } @@ -300,72 +302,13 @@ intel_texture_view(struct gl_context *ctx, return GL_TRUE; } -static bool -intel_set_texture_storage_for_buffer_object(struct gl_context *ctx, - struct gl_texture_object *tex_obj, - struct gl_buffer_object *buffer_obj, - uint32_t buffer_offset, - uint32_t row_stride, - bool read_only) -{ - struct brw_context *brw = brw_context(ctx); - struct intel_texture_object *intel_texobj = intel_texture_object(tex_obj); - struct gl_texture_image *image = tex_obj->Image[0][0]; - struct intel_texture_image *intel_image = intel_texture_image(image); - struct intel_buffer_object *intel_buffer_obj = intel_buffer_object(buffer_obj); - - if (!read_only) { - /* Renderbuffers have the restriction that the buffer offset and - * surface pitch must be a multiple of the element size. If it's - * not, we have to fail and fall back to software. - */ - int cpp = _mesa_get_format_bytes(image->TexFormat); - if (buffer_offset % cpp || row_stride % cpp) { - perf_debug("Bad PBO alignment; fallback to CPU mapping\n"); - return false; - } - - if (!brw->format_supported_as_render_target[image->TexFormat]) { - perf_debug("Non-renderable PBO format; fallback to CPU mapping\n"); - return false; - } - } - - assert(intel_texobj->mt == NULL); - - drm_intel_bo *bo = intel_bufferobj_buffer(brw, intel_buffer_obj, - buffer_offset, - row_stride * image->Height); - intel_texobj->mt = - intel_miptree_create_for_bo(brw, bo, - image->TexFormat, - buffer_offset, - image->Width, image->Height, image->Depth, - row_stride, - 0); - if (!intel_texobj->mt) - return false; - - if (!_swrast_init_texture_image(image)) - return false; - - intel_miptree_reference(&intel_image->mt, intel_texobj->mt); - - /* The miptree is in a validated state, so no need to check later. */ - intel_texobj->needs_validate = false; - intel_texobj->validated_first_level = 0; - intel_texobj->validated_last_level = 0; - intel_texobj->_Format = intel_texobj->mt->format; - - return true; -} - static void intel_texture_barrier(struct gl_context *ctx) { struct brw_context *brw = brw_context(ctx); + const struct gen_device_info *devinfo = &brw->screen->devinfo; - if (brw->gen >= 6) { + if (devinfo->gen >= 6) { brw_emit_pipe_control_flush(brw, PIPE_CONTROL_DEPTH_CACHE_FLUSH | PIPE_CONTROL_RENDER_TARGET_FLUSH | @@ -391,7 +334,5 @@ intelInitTextureFuncs(struct dd_function_table *functions) functions->MapTextureImage = intel_map_texture_image; functions->UnmapTextureImage = intel_unmap_texture_image; functions->TextureView = intel_texture_view; - functions->SetTextureStorageForBufferObject = - intel_set_texture_storage_for_buffer_object; functions->TextureBarrier = intel_texture_barrier; }