st/mesa: set default tessellation levels

This commit is contained in:
Marek Olšák
2015-05-18 12:49:10 +02:00
parent 82f7fad966
commit bda9094f1d
6 changed files with 67 additions and 1 deletions

View File

@@ -407,6 +407,7 @@ STATETRACKER_FILES = \
state_tracker/st_atom_shader.c \
state_tracker/st_atom_shader.h \
state_tracker/st_atom_stipple.c \
state_tracker/st_atom_tess.c \
state_tracker/st_atom_texture.c \
state_tracker/st_atom_viewport.c \
state_tracker/st_cache.h \

View File

@@ -78,6 +78,7 @@ static const struct st_tracked_state *atoms[] =
&st_bind_fs_ubos,
&st_bind_gs_ubos,
&st_update_pixel_transfer,
&st_update_tess,
/* this must be done after the vertex program update */
&st_update_array

View File

@@ -80,6 +80,7 @@ extern const struct st_tracked_state st_bind_gs_ubos;
extern const struct st_tracked_state st_bind_tcs_ubos;
extern const struct st_tracked_state st_bind_tes_ubos;
extern const struct st_tracked_state st_update_pixel_transfer;
extern const struct st_tracked_state st_update_tess;
GLuint st_compare_func_to_pipe(GLenum func);

View File

@@ -0,0 +1,62 @@
/**************************************************************************
*
* Copyright 2015 Advanced Micro Devices, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
/*
* Authors:
* Marek Olšák <maraeo@gmail.com>
*/
#include "main/macros.h"
#include "st_context.h"
#include "pipe/p_context.h"
#include "st_atom.h"
static void
update_tess(struct st_context *st)
{
const struct gl_context *ctx = st->ctx;
struct pipe_context *pipe = st->pipe;
if (!pipe->set_tess_state)
return;
pipe->set_tess_state(pipe,
ctx->TessCtrlProgram.patch_default_outer_level,
ctx->TessCtrlProgram.patch_default_inner_level);
}
const struct st_tracked_state st_update_tess = {
"update_tess", /* name */
{ /* dirty */
0, /* mesa */
ST_NEW_TESS_STATE, /* st */
},
update_tess /* update */
};

View File

@@ -313,6 +313,7 @@ static void st_init_driver_flags(struct gl_driver_flags *f)
f->NewArray = ST_NEW_VERTEX_ARRAYS;
f->NewRasterizerDiscard = ST_NEW_RASTERIZER;
f->NewUniformBuffer = ST_NEW_UNIFORM_BUFFER;
f->NewDefaultTessLevels = ST_NEW_TESS_STATE;
}
struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,

View File

@@ -53,7 +53,7 @@ struct u_upload_mgr;
#define ST_NEW_FRAGMENT_PROGRAM (1 << 1)
#define ST_NEW_VERTEX_PROGRAM (1 << 2)
#define ST_NEW_FRAMEBUFFER (1 << 3)
/* gap, re-use it */
#define ST_NEW_TESS_STATE (1 << 4)
#define ST_NEW_GEOMETRY_PROGRAM (1 << 5)
#define ST_NEW_VERTEX_ARRAYS (1 << 6)
#define ST_NEW_RASTERIZER (1 << 7)