X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fmtypes.h;h=0cb002469b242e49214c705440098a16fb7d5f69;hb=edd50828618ed2efe799013c2723d67c407d86b4;hp=002e692b6994cc72a454b9f62f82bd5f9208a601;hpb=2895d96a057b91214b7fe9919fb665faab59b849;p=mesa.git diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 002e692b699..0cb002469b2 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -47,6 +47,7 @@ #include "main/formats.h" /* MESA_FORMAT_COUNT */ #include "compiler/glsl/list.h" #include "util/bitscan.h" +#include "util/u_dynarray.h" #ifdef __cplusplus @@ -144,7 +145,8 @@ typedef enum BUFFER_COLOR5, BUFFER_COLOR6, BUFFER_COLOR7, - BUFFER_COUNT + BUFFER_COUNT, + BUFFER_NONE = -1, } gl_buffer_index; /** @@ -187,6 +189,9 @@ typedef enum BUFFER_BIT_COLOR6 | \ BUFFER_BIT_COLOR7) +/* Mask of bits for depth+stencil buffers */ +#define BUFFER_BITS_DEPTH_STENCIL (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL) + /** * Framebuffer configuration (aka visual / pixelformat) * Note: some of these fields should be boolean, but it appears that @@ -704,8 +709,8 @@ struct gl_multisample_attrib /* ARB_texture_multisample / GL3.2 additions */ GLboolean SampleMask; - GLfloat SampleCoverageValue; - GLfloat MinSampleShadingValue; + GLfloat SampleCoverageValue; /**< In range [0, 1] */ + GLfloat MinSampleShadingValue; /**< In range [0, 1] */ /** The GL spec defines this as an array but >32x MSAA is madness */ GLbitfield SampleMaskValue; @@ -798,7 +803,6 @@ struct gl_polygon_attrib GLenum FrontFace; /**< Either GL_CW or GL_CCW */ GLenum FrontMode; /**< Either GL_POINT, GL_LINE or GL_FILL */ GLenum BackMode; /**< Either GL_POINT, GL_LINE or GL_FILL */ - GLboolean _FrontBit; /**< 0=GL_CCW, 1=GL_CW */ GLboolean CullFlag; /**< Culling on/off flag */ GLboolean SmoothFlag; /**< True if GL_POLYGON_SMOOTH is enabled */ GLboolean StippleFlag; /**< True if GL_POLYGON_STIPPLE is enabled */ @@ -851,9 +855,6 @@ struct gl_stencil_attrib GLboolean Enabled; /**< Enabled flag */ GLboolean TestTwoSide; /**< GL_EXT_stencil_two_side */ GLubyte ActiveFace; /**< GL_EXT_stencil_two_side (0 or 2) */ - GLboolean _Enabled; /**< Enabled and stencil buffer present */ - GLboolean _WriteEnabled; /**< _Enabled and non-zero writemasks */ - GLboolean _TestTwoSide; GLubyte _BackFace; /**< Current back stencil state (1 or 2) */ GLenum Function[3]; /**< Stencil function */ GLenum FailFunc[3]; /**< Fail function */ @@ -987,6 +988,10 @@ struct gl_sampler_object GLenum CompareFunc; /**< GL_ARB_shadow */ GLenum sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */ GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */ + + /** GL_ARB_bindless_texture */ + struct util_dynarray Handles; + bool HandleAllocated; }; @@ -1051,6 +1056,11 @@ struct gl_texture_object /** GL_ARB_shader_image_load_store */ GLenum ImageFormatCompatibilityType; + + /** GL_ARB_bindless_texture */ + struct util_dynarray SamplerHandles; + struct util_dynarray ImageHandles; + bool HandleAllocated; }; @@ -1403,6 +1413,8 @@ struct gl_buffer_object unsigned MinMaxCacheHitIndices; unsigned MinMaxCacheMissIndices; bool MinMaxCacheDirty; + + bool HandleAllocated; /**< GL_ARB_bindless_texture */ }; @@ -1977,6 +1989,42 @@ struct gl_perf_query_state }; +/** + * A bindless sampler object. + */ +struct gl_bindless_sampler +{ + /** Texture unit (set by glUniform1()). */ + GLubyte unit; + + /** Texture Target (TEXTURE_1D/2D/3D/etc_INDEX). */ + gl_texture_index target; + + /** Whether this bindless sampler is bound to a unit. */ + GLboolean bound; + + /** Pointer to the base of the data. */ + GLvoid *data; +}; + +/** + * A bindless image object. + */ +struct gl_bindless_image +{ + /** Image unit (set by glUniform1()). */ + GLubyte unit; + + /** Access qualifier (GL_READ_WRITE, GL_READ_ONLY, GL_WRITE_ONLY) */ + GLenum access; + + /** Whether this bindless image is bound to a unit. */ + GLboolean bound; + + /** Pointer to the base of the data. */ + GLvoid *data; +}; + /** * Names of the various vertex/fragment program register files, etc. * @@ -2111,6 +2159,22 @@ struct gl_program */ gl_texture_index SamplerTargets[MAX_SAMPLERS]; + /** + * Number of samplers declared with the bindless_sampler layout + * qualifier as specified by ARB_bindless_texture. + */ + GLuint NumBindlessSamplers; + GLboolean HasBoundBindlessSampler; + struct gl_bindless_sampler *BindlessSamplers; + + /** + * Number of images declared with the bindless_image layout qualifier + * as specified by ARB_bindless_texture. + */ + GLuint NumBindlessImages; + GLboolean HasBoundBindlessImage; + struct gl_bindless_image *BindlessImages; + union { struct { /** @@ -2187,11 +2251,8 @@ struct gl_program_state struct gl_vertex_program_state { GLboolean Enabled; /**< User-set GL_VERTEX_PROGRAM_ARB/NV flag */ - GLboolean _Enabled; /**< Enabled and _valid_ user program? */ GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */ GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */ - /** Computed two sided lighting for fixed function/programs. */ - GLboolean _TwoSideEnabled; struct gl_program *Current; /**< User-bound vertex program */ /** Currently enabled and valid vertex program (including internal @@ -2253,7 +2314,6 @@ struct gl_geometry_program_state struct gl_fragment_program_state { GLboolean Enabled; /**< User-set fragment program enable flag */ - GLboolean _Enabled; /**< Enabled and _valid_ user program? */ struct gl_program *Current; /**< User-bound fragment program */ /** Currently enabled and valid fragment program (including internal @@ -2322,7 +2382,6 @@ struct ati_fragment_shader struct gl_ati_fragment_shader_state { GLboolean Enabled; - GLboolean _Enabled; /**< enabled and valid shader? */ GLboolean Compiling; GLfloat GlobalConstants[8][4]; struct ati_fragment_shader *Current; @@ -2547,6 +2606,16 @@ struct gl_shader bool origin_upper_left; bool pixel_center_integer; + /** + * Whether bindless_sampler/bindless_image, and respectively + * bound_sampler/bound_image are declared at global scope as defined by + * ARB_bindless_texture. + */ + bool bindless_sampler; + bool bindless_image; + bool bound_sampler; + bool bound_image; + /** Global xfb_stride out qualifier if any */ GLuint TransformFeedbackBufferStride[MAX_FEEDBACK_BUFFERS]; @@ -2596,8 +2665,7 @@ struct gl_uniform_block /** * Index (GL_UNIFORM_BLOCK_BINDING) into ctx->UniformBufferBindings[] to use - * with glBindBufferBase to bind a buffer object to this uniform block. When - * updated in the program, _NEW_BUFFER_OBJECT will be set. + * with glBindBufferBase to bind a buffer object to this uniform block. */ GLuint Binding; @@ -2804,6 +2872,13 @@ struct gl_shader_program_data bool cache_fallback; + /* TODO: This used by Gallium drivers to skip the cache on tgsi fallback. + * All structures (gl_program, uniform storage, etc) will get recreated + * even though we have already loaded them from cache. Once the i965 cache + * lands we should switch to using the cache_fallback support. + */ + bool skip_cache; + /** List of all active resources after linking. */ struct gl_program_resource *ProgramResourceList; unsigned NumProgramResourceList; @@ -2967,6 +3042,7 @@ struct gl_shader_program #define GLSL_REPORT_ERRORS 0x40 /**< Print compilation errors */ #define GLSL_DUMP_ON_ERROR 0x80 /**< Dump shaders to stderr on compile error */ #define GLSL_CACHE_INFO 0x100 /**< Print debug information about shader cache */ +#define GLSL_CACHE_FALLBACK 0x200 /**< Force shader cache fallback paths */ /** @@ -2993,8 +3069,6 @@ struct gl_pipeline_object struct gl_shader_program *ReferencedPrograms[MESA_SHADER_STAGES]; - struct gl_program *_CurrentFragmentProgram; - /** * Program used by glUniform calls. * @@ -3033,7 +3107,6 @@ struct gl_shader_compiler_options { /** Driver-selectable options: */ GLboolean EmitNoLoops; - GLboolean EmitNoFunctions; GLboolean EmitNoCont; /**< Emit CONT opcode? */ GLboolean EmitNoMainReturn; /**< Emit CONT/RET opcodes? */ GLboolean EmitNoPow; /**< Emit POW opcodes? */ @@ -3196,6 +3269,11 @@ struct gl_shared_state /** GL_ARB_sampler_objects */ struct _mesa_HashTable *SamplerObjects; + /* GL_ARB_bindless_texture */ + struct hash_table_u64 *TextureHandles; + struct hash_table_u64 *ImageHandles; + mtx_t HandlesMutex; /**< For texture/image handles safety */ + /** * Some context in this share group was affected by a GPU reset * @@ -3622,6 +3700,11 @@ struct gl_constants */ GLboolean AllowGLSLExtensionDirectiveMidShader; + /** + * Allow GLSL built-in variables to be redeclared verbatim + */ + GLboolean AllowGLSLBuiltinVariableRedeclaration; + /** * Allow creating a higher compat profile (version 3.1+) for apps that * request it. Be careful when adding that driconf option because some @@ -3901,6 +3984,9 @@ struct gl_constants /** Used as an input for sha1 generation in the on-disk shader cache */ unsigned char *dri_config_options_sha1; + + /** When drivers are OK with mapped buffers during draw and other calls. */ + bool AllowMappedBuffersDuringExecution; }; @@ -3920,6 +4006,7 @@ struct gl_extensions GLboolean ARB_ES3_2_compatibility; GLboolean ARB_arrays_of_arrays; GLboolean ARB_base_instance; + GLboolean ARB_bindless_texture; GLboolean ARB_blend_func_extended; GLboolean ARB_buffer_storage; GLboolean ARB_clear_texture; @@ -3979,7 +4066,6 @@ struct gl_extensions GLboolean ARB_shader_precision; GLboolean ARB_shader_stencil_export; GLboolean ARB_shader_storage_buffer_object; - GLboolean ARB_shader_subroutine; GLboolean ARB_shader_texture_image_samples; GLboolean ARB_shader_texture_lod; GLboolean ARB_shader_viewport_layer_array; @@ -4192,7 +4278,7 @@ struct gl_matrix_stack #define _NEW_TRACK_MATRIX (1u << 25) /**< gl_context::VertexProgram */ #define _NEW_PROGRAM (1u << 26) /**< New program/shader state */ #define _NEW_PROGRAM_CONSTANTS (1u << 27) -#define _NEW_BUFFER_OBJECT (1u << 28) +/* gap */ #define _NEW_FRAG_CLAMP (1u << 29) /* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */ #define _NEW_VARYING_VP_INPUTS (1u << 31) /**< gl_context::varying_vp_inputs */ @@ -4374,6 +4460,80 @@ struct gl_driver_flags * gl_context::IntelConservativeRasterization */ uint64_t NewIntelConservativeRasterization; + + /** + * gl_context::Scissor::WindowRects + */ + uint64_t NewWindowRectangles; + + /** gl_context::Color::sRGBEnabled */ + uint64_t NewFramebufferSRGB; + + /** gl_context::Scissor::EnableFlags */ + uint64_t NewScissorTest; + + /** gl_context::Scissor::ScissorArray */ + uint64_t NewScissorRect; + + /** gl_context::Color::Alpha* */ + uint64_t NewAlphaTest; + + /** gl_context::Color::Blend/Dither */ + uint64_t NewBlend; + + /** gl_context::Color::BlendColor */ + uint64_t NewBlendColor; + + /** gl_context::Color::Color/Index */ + uint64_t NewColorMask; + + /** gl_context::Depth */ + uint64_t NewDepth; + + /** gl_context::Color::LogicOp/ColorLogicOp/IndexLogicOp */ + uint64_t NewLogicOp; + + /** gl_context::Multisample::Enabled */ + uint64_t NewMultisampleEnable; + + /** gl_context::Multisample::SampleAlphaTo* */ + uint64_t NewSampleAlphaToXEnable; + + /** gl_context::Multisample::SampleCoverage/SampleMaskValue */ + uint64_t NewSampleMask; + + /** gl_context::Multisample::(Min)SampleShading */ + uint64_t NewSampleShading; + + /** gl_context::Stencil */ + uint64_t NewStencil; + + /** gl_context::Transform::ClipOrigin/ClipDepthMode */ + uint64_t NewClipControl; + + /** gl_context::Transform::EyeUserPlane */ + uint64_t NewClipPlane; + + /** gl_context::Transform::ClipPlanesEnabled */ + uint64_t NewClipPlaneEnable; + + /** gl_context::Transform::DepthClamp */ + uint64_t NewDepthClamp; + + /** gl_context::Line */ + uint64_t NewLineState; + + /** gl_context::Polygon */ + uint64_t NewPolygonState; + + /** gl_context::PolygonStipple */ + uint64_t NewPolygonStipple; + + /** gl_context::ViewportArray */ + uint64_t NewViewport; + + /** Shader constants (uniforms, program parameters, state constants) */ + uint64_t NewShaderConstants[MESA_SHADER_STAGES]; }; struct gl_uniform_buffer_binding @@ -4477,6 +4637,19 @@ struct gl_subroutine_index_binding GLuint *IndexPtr; }; +struct gl_texture_handle_object +{ + struct gl_texture_object *texObj; + struct gl_sampler_object *sampObj; + GLuint64 handle; +}; + +struct gl_image_handle_object +{ + struct gl_image_unit imgObj; + GLuint64 handle; +}; + /** * Mesa rendering context. * @@ -4831,6 +5004,14 @@ struct gl_context GLfloat PrimitiveBoundingBox[8]; struct disk_cache *Cache; + + /** + * \name GL_ARB_bindless_texture + */ + /*@{*/ + struct hash_table_u64 *ResidentTextureHandles; + struct hash_table_u64 *ResidentImageHandles; + /*@}*/ }; /**