1848b8605Smrg/* 2848b8605Smrg * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com> 3848b8605Smrg * 4848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5848b8605Smrg * copy of this software and associated documentation files (the "Software"), 6848b8605Smrg * to deal in the Software without restriction, including without limitation 7848b8605Smrg * on the rights to use, copy, modify, merge, publish, distribute, sub 8848b8605Smrg * license, and/or sell copies of the Software, and to permit persons to whom 9848b8605Smrg * the Software is furnished to do so, subject to the following conditions: 10848b8605Smrg * 11848b8605Smrg * The above copyright notice and this permission notice (including the next 12848b8605Smrg * paragraph) shall be included in all copies or substantial portions of the 13848b8605Smrg * Software. 14848b8605Smrg * 15848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16848b8605Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18848b8605Smrg * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 19848b8605Smrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20848b8605Smrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21848b8605Smrg * USE OR OTHER DEALINGS IN THE SOFTWARE. */ 22848b8605Smrg 23848b8605Smrg#ifndef R300_TEXTURE_H 24848b8605Smrg#define R300_TEXTURE_H 25848b8605Smrg 26848b8605Smrg#include "pipe/p_compiler.h" 27848b8605Smrg#include "pipe/p_format.h" 28b8e80941Smrg#include "pipe/p_screen.h" 29848b8605Smrg 30848b8605Smrgstruct pipe_screen; 31848b8605Smrgstruct pipe_context; 32848b8605Smrgstruct pipe_resource; 33848b8605Smrgstruct winsys_handle; 34848b8605Smrgstruct r300_texture_format_state; 35848b8605Smrgstruct r300_texture_desc; 36848b8605Smrgstruct r300_resource; 37848b8605Smrgstruct r300_screen; 38848b8605Smrg 39848b8605Smrgunsigned r300_get_swizzle_combined(const unsigned char *swizzle_format, 40848b8605Smrg const unsigned char *swizzle_view, 41848b8605Smrg boolean dxtc_swizzle); 42848b8605Smrg 43848b8605Smrguint32_t r300_translate_texformat(enum pipe_format format, 44848b8605Smrg const unsigned char *swizzle_view, 45848b8605Smrg boolean is_r500, 46848b8605Smrg boolean dxtc_swizzle); 47848b8605Smrg 48848b8605Smrguint32_t r500_tx_format_msb_bit(enum pipe_format format); 49848b8605Smrg 50848b8605Smrgboolean r300_is_colorbuffer_format_supported(enum pipe_format format); 51848b8605Smrg 52848b8605Smrgboolean r300_is_zs_format_supported(enum pipe_format format); 53848b8605Smrg 54848b8605Smrgboolean r300_is_sampler_format_supported(enum pipe_format format); 55848b8605Smrg 56848b8605Smrgvoid r300_texture_setup_format_state(struct r300_screen *screen, 57848b8605Smrg struct r300_resource *tex, 58848b8605Smrg enum pipe_format format, 59848b8605Smrg unsigned level, 60848b8605Smrg unsigned width0_override, 61848b8605Smrg unsigned height0_override, 62848b8605Smrg struct r300_texture_format_state *out); 63848b8605Smrg 64848b8605Smrgboolean r300_resource_get_handle(struct pipe_screen* screen, 65b8e80941Smrg struct pipe_context *ctx, 66848b8605Smrg struct pipe_resource *texture, 67b8e80941Smrg struct winsys_handle *whandle, 68b8e80941Smrg unsigned usage); 69848b8605Smrg 70848b8605Smrgstruct pipe_resource* 71848b8605Smrgr300_texture_from_handle(struct pipe_screen* screen, 72848b8605Smrg const struct pipe_resource* base, 73b8e80941Smrg struct winsys_handle *whandle, 74b8e80941Smrg unsigned usage); 75848b8605Smrg 76848b8605Smrgstruct pipe_resource* 77848b8605Smrgr300_texture_create(struct pipe_screen* screen, 78848b8605Smrg const struct pipe_resource* templ); 79848b8605Smrg 80848b8605Smrgstruct pipe_surface* r300_create_surface_custom(struct pipe_context * ctx, 81848b8605Smrg struct pipe_resource* texture, 82848b8605Smrg const struct pipe_surface *surf_tmpl, 83848b8605Smrg unsigned width0_override, 84848b8605Smrg unsigned height0_override); 85848b8605Smrg 86848b8605Smrgstruct pipe_surface* r300_create_surface(struct pipe_context *ctx, 87848b8605Smrg struct pipe_resource* texture, 88848b8605Smrg const struct pipe_surface *surf_tmpl); 89848b8605Smrg 90848b8605Smrgvoid r300_surface_destroy(struct pipe_context *ctx, struct pipe_surface* s); 91848b8605Smrg 92848b8605Smrg#endif /* R300_TEXTURE_H */ 93